Revision c570fd16 target-mips/helper.c
b/target-mips/helper.c | ||
---|---|---|
86 | 86 |
#endif |
87 | 87 |
if (user_mode && address > 0x7FFFFFFFUL) |
88 | 88 |
return TLBRET_BADADDR; |
89 |
if (address < 0x80000000UL) {
|
|
89 |
if (address < SIGN_EXTEND32(0x80000000UL)) {
|
|
90 | 90 |
if (!(env->hflags & MIPS_HFLAG_ERL)) { |
91 | 91 |
#ifdef MIPS_USES_R4K_TLB |
92 | 92 |
ret = map_address(env, physical, prot, address, rw, access_type); |
... | ... | |
98 | 98 |
*physical = address; |
99 | 99 |
*prot = PAGE_READ | PAGE_WRITE; |
100 | 100 |
} |
101 |
} else if (address < 0xA0000000UL) {
|
|
101 |
} else if (address < SIGN_EXTEND32(0xA0000000UL)) {
|
|
102 | 102 |
/* kseg0 */ |
103 | 103 |
/* XXX: check supervisor mode */ |
104 |
*physical = address - 0x80000000UL;
|
|
104 |
*physical = address - SIGN_EXTEND32(0x80000000UL);
|
|
105 | 105 |
*prot = PAGE_READ | PAGE_WRITE; |
106 |
} else if (address < 0xC0000000UL) {
|
|
106 |
} else if (address < SIGN_EXTEND32(0xC0000000UL)) {
|
|
107 | 107 |
/* kseg1 */ |
108 | 108 |
/* XXX: check supervisor mode */ |
109 |
*physical = address - 0xA0000000UL;
|
|
109 |
*physical = address - SIGN_EXTEND32(0xA0000000UL);
|
|
110 | 110 |
*prot = PAGE_READ | PAGE_WRITE; |
111 |
} else if (address < 0xE0000000UL) {
|
|
111 |
} else if (address < SIGN_EXTEND32(0xE0000000UL)) {
|
|
112 | 112 |
/* kseg2 */ |
113 | 113 |
#ifdef MIPS_USES_R4K_TLB |
114 | 114 |
ret = map_address(env, physical, prot, address, rw, access_type); |
... | ... | |
129 | 129 |
} |
130 | 130 |
#if 0 |
131 | 131 |
if (logfile) { |
132 |
fprintf(logfile, "%08x %d %d => %08x %d (%d)\n", address, rw,
|
|
133 |
access_type, *physical, *prot, ret);
|
|
132 |
fprintf(logfile, TLSZ " %d %d => " TLSZ " %d (%d)\n",
|
|
133 |
address, rw, access_type, *physical, *prot, ret);
|
|
134 | 134 |
} |
135 | 135 |
#endif |
136 | 136 |
|
... | ... | |
171 | 171 |
#if 0 |
172 | 172 |
cpu_dump_state(env, logfile, fprintf, 0); |
173 | 173 |
#endif |
174 |
fprintf(logfile, "%s pc %08x ad %08x rw %d is_user %d smmu %d\n",
|
|
174 |
fprintf(logfile, "%s pc " TLSZ " ad " TLSZ " rw %d is_user %d smmu %d\n",
|
|
175 | 175 |
__func__, env->PC, address, rw, is_user, is_softmmu); |
176 | 176 |
} |
177 | 177 |
|
... | ... | |
189 | 189 |
ret = get_physical_address(env, &physical, &prot, |
190 | 190 |
address, rw, access_type); |
191 | 191 |
if (logfile) { |
192 |
fprintf(logfile, "%s address=%08x ret %d physical %08x prot %d\n",
|
|
192 |
fprintf(logfile, "%s address=" TLSZ " ret %d physical " TLSZ " prot %d\n",
|
|
193 | 193 |
__func__, address, ret, physical, prot); |
194 | 194 |
} |
195 | 195 |
if (ret == TLBRET_MATCH) { |
... | ... | |
255 | 255 |
int cause = -1; |
256 | 256 |
|
257 | 257 |
if (logfile && env->exception_index != EXCP_EXT_INTERRUPT) { |
258 |
fprintf(logfile, "%s enter: PC %08x EPC %08x cause %d excp %d\n",
|
|
258 |
fprintf(logfile, "%s enter: PC " TLSZ " EPC " TLSZ " cause %d excp %d\n",
|
|
259 | 259 |
__func__, env->PC, env->CP0_EPC, cause, env->exception_index); |
260 | 260 |
} |
261 | 261 |
if (env->exception_index == EXCP_EXT_INTERRUPT && |
... | ... | |
299 | 299 |
enter_debug_mode: |
300 | 300 |
env->hflags |= MIPS_HFLAG_DM; |
301 | 301 |
/* EJTAG probe trap enable is not implemented... */ |
302 |
env->PC = 0xBFC00480;
|
|
302 |
env->PC = SIGN_EXTEND32(0xBFC00480);
|
|
303 | 303 |
break; |
304 | 304 |
case EXCP_RESET: |
305 | 305 |
cpu_reset(env); |
... | ... | |
321 | 321 |
} |
322 | 322 |
env->hflags |= MIPS_HFLAG_ERL; |
323 | 323 |
env->CP0_Status |= (1 << CP0St_ERL) | (1 << CP0St_BEV); |
324 |
env->PC = 0xBFC00000;
|
|
324 |
env->PC = SIGN_EXTEND32(0xBFC00000);
|
|
325 | 325 |
break; |
326 | 326 |
case EXCP_MCHECK: |
327 | 327 |
cause = 24; |
... | ... | |
389 | 389 |
env->CP0_Cause &= ~0x80000000; |
390 | 390 |
} |
391 | 391 |
if (env->CP0_Status & (1 << CP0St_BEV)) { |
392 |
env->PC = 0xBFC00200;
|
|
392 |
env->PC = SIGN_EXTEND32(0xBFC00200);
|
|
393 | 393 |
} else { |
394 |
env->PC = 0x80000000;
|
|
394 |
env->PC = SIGN_EXTEND32(0x80000000);
|
|
395 | 395 |
} |
396 | 396 |
env->hflags |= MIPS_HFLAG_EXL; |
397 | 397 |
env->CP0_Status |= (1 << CP0St_EXL); |
... | ... | |
407 | 407 |
exit(1); |
408 | 408 |
} |
409 | 409 |
if (logfile && env->exception_index != EXCP_EXT_INTERRUPT) { |
410 |
fprintf(logfile, "%s: PC %08x EPC %08x cause %d excp %d\n"
|
|
411 |
" S %08x C %08x A %08x D %08x\n",
|
|
410 |
fprintf(logfile, "%s: PC " TLSZ " EPC " TLSZ " cause %d excp %d\n"
|
|
411 |
" S %08x C %08x A " TLSZ " D " TLSZ "\n",
|
|
412 | 412 |
__func__, env->PC, env->CP0_EPC, cause, env->exception_index, |
413 | 413 |
env->CP0_Status, env->CP0_Cause, env->CP0_BadVAddr, |
414 | 414 |
env->CP0_DEPC); |
Also available in: Unified diff