--- trunk/src/cpus/cpu_x86.c 2007/10/08 16:19:16 19 +++ trunk/src/cpus/cpu_x86.c 2007/10/08 16:19:23 20 @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * - * $Id: cpu_x86.c,v 1.3 2005/09/30 14:17:03 debug Exp $ + * $Id: cpu_x86.c,v 1.5 2005/11/13 00:14:07 debug Exp $ * * x86 (and amd64) CPU emulation. * @@ -95,6 +95,8 @@ cpu->cd.x86.model = models[i]; + cpu->translate_address = x86_translate_address; + /* Initial startup is in 16-bit real mode: */ cpu->pc = 0xfff0; @@ -109,16 +111,32 @@ cpu->cd.x86.descr_cache[X86_S_CS].writable = 1; cpu->cd.x86.descr_cache[X86_S_CS].granularity = 0; cpu->cd.x86.s[X86_S_CS] = 0xf000; + cpu->cd.x86.cursegment = X86_S_CS; cpu->cd.x86.idtr = 0; cpu->cd.x86.idtr_limit = 0x3ff; - cpu->translate_address = x86_translate_address; - cpu->cd.x86.rflags = 0x0002; if (cpu->cd.x86.model.model_number == X86_MODEL_8086) cpu->cd.x86.rflags |= 0xf000; + cpu->is_32bit = (cpu->cd.x86.model.model_number < X86_MODEL_AMD64)? + 1 : 0; + + if (cpu->is_32bit) { + cpu->update_translation_table = x8632_update_translation_table; + cpu->invalidate_translation_caches = + x8632_invalidate_translation_caches; + cpu->invalidate_code_translation = + x8632_invalidate_code_translation; + } else { + cpu->update_translation_table = x86_update_translation_table; + cpu->invalidate_translation_caches = + x86_invalidate_translation_caches; + cpu->invalidate_code_translation = + x86_invalidate_code_translation; + } + /* Only show name and caches etc for CPU nr 0 (in SMP machines): */ if (cpu_id == 0) { debug("%s", cpu->name); @@ -443,32 +461,6 @@ } -/* - * x86_cpu_show_full_statistics(): - * - * Show detailed statistics on opcode usage on each cpu. - */ -void x86_cpu_show_full_statistics(struct machine *m) -{ - fatal("x86_cpu_show_full_statistics(): TODO\n"); -} - - -/* - * x86_cpu_tlbdump(): - * - * Called from the debugger to dump the TLB in a readable format. - * x is the cpu number to dump, or -1 to dump all CPUs. - * - * If rawflag is nonzero, then the TLB contents isn't formated nicely, - * just dumped. - */ -void x86_cpu_tlbdump(struct machine *m, int x, int rawflag) -{ - fatal("ppc_cpu_tlbdump(): TODO\n"); -} - - /* Macro which modifies the lower part of a value, or the entire value, depending on 'mode': */ #define modify(old,new) ( \