Commit b7f0f463 authored by bellard's avatar bellard
Browse files

debug fixes - use more generic TLB mappings


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@486 c046a42c-6fe2-441c-8c8c-71466251a162
parent 8e682019
...@@ -73,7 +73,9 @@ void cpu_x86_close(CPUX86State *env) ...@@ -73,7 +73,9 @@ void cpu_x86_close(CPUX86State *env)
static const char *cc_op_str[] = { static const char *cc_op_str[] = {
"DYNAMIC", "DYNAMIC",
"EFLAGS", "EFLAGS",
"MUL", "MULB",
"MULW",
"MULL",
"ADDB", "ADDB",
"ADDW", "ADDW",
"ADDL", "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)
{ {
a20_state = (a20_state != 0); a20_state = (a20_state != 0);
if (a20_state != a20_enabled) { if (a20_state != a20_enabled) {
#if defined(DEBUG_MMU)
printf("A20 update: a20=%d\n", a20_state);
#endif
/* if the cpu is currently executing code, we must unlink it and /* if the cpu is currently executing code, we must unlink it and
all the potentially executing TB */ all the potentially executing TB */
cpu_interrupt(env, 0); cpu_interrupt(env, 0);
/* when a20 is changed, all the MMU mappings are invalid, so /* when a20 is changed, all the MMU mappings are invalid, so
we must flush everything */ we must flush everything */
page_unmap();
tlb_flush(env); tlb_flush(env);
a20_enabled = a20_state; a20_enabled = a20_state;
if (a20_enabled) 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)
{ {
int pg_state, pe_state; int pg_state, pe_state;
#ifdef DEBUG_MMU #if defined(DEBUG_MMU)
printf("CR0 update: CR0=0x%08x\n", env->cr[0]); printf("CR0 update: CR0=0x%08x\n", env->cr[0]);
#endif #endif
pg_state = env->cr[0] & CR0_PG_MASK; pg_state = env->cr[0] & CR0_PG_MASK;
if (pg_state != last_pg_state) { if (pg_state != last_pg_state) {
page_unmap();
tlb_flush(env); tlb_flush(env);
last_pg_state = pg_state; last_pg_state = pg_state;
} }
pe_state = env->cr[0] & CR0_PE_MASK; pe_state = env->cr[0] & CR0_PE_MASK;
if (last_pe_state != pe_state) { if (last_pe_state != pe_state) {
tb_flush(); tb_flush(env);
last_pe_state = pe_state; last_pe_state = pe_state;
} }
} }
...@@ -233,7 +236,6 @@ void cpu_x86_update_cr3(CPUX86State *env) ...@@ -233,7 +236,6 @@ void cpu_x86_update_cr3(CPUX86State *env)
#if defined(DEBUG_MMU) #if defined(DEBUG_MMU)
printf("CR3 update: CR3=%08x\n", env->cr[3]); printf("CR3 update: CR3=%08x\n", env->cr[3]);
#endif #endif
page_unmap();
tlb_flush(env); tlb_flush(env);
} }
} }
...@@ -250,19 +252,7 @@ void cpu_x86_init_mmu(CPUX86State *env) ...@@ -250,19 +252,7 @@ void cpu_x86_init_mmu(CPUX86State *env)
/* XXX: also flush 4MB pages */ /* XXX: also flush 4MB pages */
void cpu_x86_flush_tlb(CPUX86State *env, uint32_t addr) void cpu_x86_flush_tlb(CPUX86State *env, uint32_t addr)
{ {
int flags;
unsigned long virt_addr;
tlb_flush_page(env, addr); tlb_flush_page(env, addr);
flags = page_get_flags(addr);
if (flags & PAGE_VALID) {
virt_addr = addr & ~0xfff;
#if !defined(CONFIG_SOFTMMU)
munmap((void *)virt_addr, 4096);
#endif
page_set_flags(virt_addr, virt_addr + 4096, 0);
}
} }
/* return value: /* return value:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment