Commit b7f0f463a55e4f4bded580905582f2dfa6652fca

Authored by bellard
1 parent 8e682019

debug fixes - use more generic TLB mappings


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@486 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 18 deletions
target-i386/helper2.c
@@ -73,7 +73,9 @@ void cpu_x86_close(CPUX86State *env) @@ -73,7 +73,9 @@ void cpu_x86_close(CPUX86State *env)
73 static const char *cc_op_str[] = { 73 static const char *cc_op_str[] = {
74 "DYNAMIC", 74 "DYNAMIC",
75 "EFLAGS", 75 "EFLAGS",
76 - "MUL", 76 + "MULB",
  77 + "MULW",
  78 + "MULL",
77 "ADDB", 79 "ADDB",
78 "ADDW", 80 "ADDW",
79 "ADDL", 81 "ADDL",
@@ -191,13 +193,15 @@ void cpu_x86_set_a20(CPUX86State *env, int a20_state) @@ -191,13 +193,15 @@ void cpu_x86_set_a20(CPUX86State *env, int a20_state)
191 { 193 {
192 a20_state = (a20_state != 0); 194 a20_state = (a20_state != 0);
193 if (a20_state != a20_enabled) { 195 if (a20_state != a20_enabled) {
  196 +#if defined(DEBUG_MMU)
  197 + printf("A20 update: a20=%d\n", a20_state);
  198 +#endif
194 /* if the cpu is currently executing code, we must unlink it and 199 /* if the cpu is currently executing code, we must unlink it and
195 all the potentially executing TB */ 200 all the potentially executing TB */
196 cpu_interrupt(env, 0); 201 cpu_interrupt(env, 0);
197 202
198 /* when a20 is changed, all the MMU mappings are invalid, so 203 /* when a20 is changed, all the MMU mappings are invalid, so
199 we must flush everything */ 204 we must flush everything */
200 - page_unmap();  
201 tlb_flush(env); 205 tlb_flush(env);
202 a20_enabled = a20_state; 206 a20_enabled = a20_state;
203 if (a20_enabled) 207 if (a20_enabled)
@@ -211,18 +215,17 @@ void cpu_x86_update_cr0(CPUX86State *env) @@ -211,18 +215,17 @@ void cpu_x86_update_cr0(CPUX86State *env)
211 { 215 {
212 int pg_state, pe_state; 216 int pg_state, pe_state;
213 217
214 -#ifdef DEBUG_MMU 218 +#if defined(DEBUG_MMU)
215 printf("CR0 update: CR0=0x%08x\n", env->cr[0]); 219 printf("CR0 update: CR0=0x%08x\n", env->cr[0]);
216 #endif 220 #endif
217 pg_state = env->cr[0] & CR0_PG_MASK; 221 pg_state = env->cr[0] & CR0_PG_MASK;
218 if (pg_state != last_pg_state) { 222 if (pg_state != last_pg_state) {
219 - page_unmap();  
220 tlb_flush(env); 223 tlb_flush(env);
221 last_pg_state = pg_state; 224 last_pg_state = pg_state;
222 } 225 }
223 pe_state = env->cr[0] & CR0_PE_MASK; 226 pe_state = env->cr[0] & CR0_PE_MASK;
224 if (last_pe_state != pe_state) { 227 if (last_pe_state != pe_state) {
225 - tb_flush(); 228 + tb_flush(env);
226 last_pe_state = pe_state; 229 last_pe_state = pe_state;
227 } 230 }
228 } 231 }
@@ -233,7 +236,6 @@ void cpu_x86_update_cr3(CPUX86State *env) @@ -233,7 +236,6 @@ void cpu_x86_update_cr3(CPUX86State *env)
233 #if defined(DEBUG_MMU) 236 #if defined(DEBUG_MMU)
234 printf("CR3 update: CR3=%08x\n", env->cr[3]); 237 printf("CR3 update: CR3=%08x\n", env->cr[3]);
235 #endif 238 #endif
236 - page_unmap();  
237 tlb_flush(env); 239 tlb_flush(env);
238 } 240 }
239 } 241 }
@@ -250,19 +252,7 @@ void cpu_x86_init_mmu(CPUX86State *env) @@ -250,19 +252,7 @@ void cpu_x86_init_mmu(CPUX86State *env)
250 /* XXX: also flush 4MB pages */ 252 /* XXX: also flush 4MB pages */
251 void cpu_x86_flush_tlb(CPUX86State *env, uint32_t addr) 253 void cpu_x86_flush_tlb(CPUX86State *env, uint32_t addr)
252 { 254 {
253 - int flags;  
254 - unsigned long virt_addr;  
255 -  
256 tlb_flush_page(env, addr); 255 tlb_flush_page(env, addr);
257 -  
258 - flags = page_get_flags(addr);  
259 - if (flags & PAGE_VALID) {  
260 - virt_addr = addr & ~0xfff;  
261 -#if !defined(CONFIG_SOFTMMU)  
262 - munmap((void *)virt_addr, 4096);  
263 -#endif  
264 - page_set_flags(virt_addr, virt_addr + 4096, 0);  
265 - }  
266 } 256 }
267 257
268 /* return value: 258 /* return value: