diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | i386/i386/locore.S | 15 | ||||
-rw-r--r-- | i386/i386at/model_dep.c | 5 | ||||
-rw-r--r-- | i386/include/mach/i386/eflags.h | 4 |
4 files changed, 24 insertions, 11 deletions
@@ -1,3 +1,14 @@ +2004-11-22 Guillem Jover <guillem@hadrons.org> + + * i386/i386/locore.S (discover_x86_cpu_type): Enable function. + Enable ID flag for Cyrix CPU. Use %ebp to save the stack pointer. + Restore EFLAGS just after its last usage. + * i386/i386at/model_dep.c (c_boot_entry): Enable use of + discover_x86_cpu_type. Remove hardcoded cpu_type assignment. + * i386/include/mach/i386/eflags.h + (EFL_VI, EFL_VIP): New bits. + (EFL_AC, EFL_ID): Bits finally added. + 2004-10-26 Guillem Jover <guillem@hadrons.org> * i386/i386/fpe.b: Remove binary without source. diff --git a/i386/i386/locore.S b/i386/i386/locore.S index 01467ae..3a6d350 100644 --- a/i386/i386/locore.S +++ b/i386/i386/locore.S @@ -1144,13 +1144,16 @@ syscall_addr: jmp _take_trap /* treat as a trap */ -#if 0 /* Discover what kind of cpu we have; return the family number (3, 4, 5, 6, for 386, 486, 586, 686 respectively). */ ENTRY(discover_x86_cpu_type) - movl %esp,%edx /* Save stack pointer */ + pushl %ebp /* Save frame pointer */ + movl %esp,%ebp /* Save stack pointer */ and $~0x3,%esp /* Align stack pointer */ + inb $0xe8,%al /* Enable ID flag for Cyrix CPU ... */ + andb $0x80,%al /* ... in CCR4 reg bit7 */ + outb %al,$0xe8 pushfl /* Fetch flags ... */ popl %eax /* ... into eax */ movl %eax,%ecx /* Save original flags for return */ @@ -1159,6 +1162,8 @@ ENTRY(discover_x86_cpu_type) popfl /* ... In EFLAGS */ pushfl /* Fetch flags back ... */ popl %eax /* ... into eax */ + pushl %ecx /* From ecx... */ + popfl /* ... restore original flags */ xorl %ecx,%eax /* See if any bits didn't change */ testl $EFL_AC,%eax /* Test AC bit */ @@ -1178,11 +1183,9 @@ ENTRY(discover_x86_cpu_type) shrl $8,%eax /* Slide family bits down */ andl $15,%eax /* And select them */ -9: pushl %ecx /* From ecx... */ - popfl /* ... restore original flags */ - movl %edx,%esp /* Restore stack pointer */ +9: movl %ebp,%esp /* Restore stack pointer */ + popl %ebp /* Restore frame pointer */ ret /* And return */ -#endif /**/ diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c index 02e5b2e..f3a210d 100644 --- a/i386/i386at/model_dep.c +++ b/i386/i386at/model_dep.c @@ -372,7 +372,6 @@ void c_boot_entry(vm_offset_t bi) machine_slot[0].running = TRUE; machine_slot[0].cpu_subtype = CPU_SUBTYPE_AT386; -#if 0 switch (discover_x86_cpu_type ()) { case 3: @@ -389,10 +388,6 @@ void c_boot_entry(vm_offset_t bi) machine_slot[0].cpu_type = CPU_TYPE_PENTIUMPRO; break; } -#else - machine_slot[0].cpu_type = CPU_TYPE_I386; -#endif - /* * Start the system. diff --git a/i386/include/mach/i386/eflags.h b/i386/include/mach/i386/eflags.h index 72bf9d4..336a73a 100644 --- a/i386/include/mach/i386/eflags.h +++ b/i386/include/mach/i386/eflags.h @@ -45,5 +45,9 @@ #define EFL_NT 0x00004000 /* nested task */ #define EFL_RF 0x00010000 /* resume without tracing */ #define EFL_VM 0x00020000 /* virtual 8086 mode */ +#define EFL_AC 0x00040000 /* alignment check */ +#define EFL_VI 0x00080000 /* virtual interrupt */ +#define EFL_VIP 0x00100000 /* virtual interrupt pending */ +#define EFL_ID 0x00200000 /* cpuid available */ #endif /* _MACH_I386_EFLAGS_H_ */ |