diff options
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/patches/19_cpu_detect.patch | 93 |
2 files changed, 94 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 5ba94f5..1d2acc9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ gnumach (1:20040915.dfsg.1-1) unstable; urgency=low Thanks to Neal H. Walfield <neal@cs.uml.edu>. * Fix possible buffer overrun on linux printk. Thanks to Neal H. Walfield <neal@cs.uml.edu>. + * Fix cpu detection code. * Do not use stamp files for build targets. -- Guillem Jover <guillem@debian.org> Tue, 16 Nov 2004 07:58:02 +0100 diff --git a/debian/patches/19_cpu_detect.patch b/debian/patches/19_cpu_detect.patch new file mode 100644 index 0000000..5eb27d5 --- /dev/null +++ b/debian/patches/19_cpu_detect.patch @@ -0,0 +1,93 @@ +#DPATCHLEVEL=0 + +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_AC, EFL_VI, EFL_VIP, EFL_ID): New bits. + + +diff -Naur i386/i386/locore.S i386/i386/locore.S +--- i386/i386/locore.S 2001-10-07 21:47:15.000000000 +0200 ++++ i386/i386/locore.S 2004-11-21 21:40:21.000000000 +0100 +@@ -1144,13 +1144,16 @@ + 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 @@ + 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 @@ + 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 -Naur i386/i386at/model_dep.c i386/i386at/model_dep.c +--- i386/i386at/model_dep.c 2002-05-23 03:54:57.000000000 +0200 ++++ i386/i386at/model_dep.c 2004-11-21 21:41:09.000000000 +0100 +@@ -372,7 +372,6 @@ + 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 @@ + machine_slot[0].cpu_type = CPU_TYPE_PENTIUMPRO; + break; + } +-#else +- machine_slot[0].cpu_type = CPU_TYPE_I386; +-#endif +- + + /* + * Start the system. +diff -Naur i386/include/mach/i386/eflags.h i386/include/mach/i386/eflags.h +--- i386/include/mach/i386/eflags.h 2001-04-05 08:39:21.000000000 +0200 ++++ i386/include/mach/i386/eflags.h 2004-11-21 21:39:13.000000000 +0100 +@@ -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_ */ |