Patch for F0 0F bug fix for SMP, against pre-64.

David Woodhouse (dwmw2@cam.ac.uk)
Thu, 13 Nov 1997 17:03:19 +0000


This is a multipart MIME message.

--==_Exmh_17500874900
Content-Type: text/plain; charset=us-ascii

This has been compiled and tested. If I'm lucky, I've even managed to include
all the necessary files in the diff this time!

This gets the F0 0F bug workaround working happily on all processors in real
SMP boxes.

Patch against pre-64. Against 63, you have to apply Linus' patches too.

--==_Exmh_17500874900
Content-Type: text/plain ; name="f00fbug-smp-pre-64-5"; charset=us-ascii
Content-Description: f00fbug-smp-pre-64-5
Content-Disposition: attachment; filename="f00fbug-smp-pre-64-5"

--- linux/arch/i386/kernel/smp.c.orig Thu Nov 13 16:51:29 1997
+++ linux/arch/i386/kernel/smp.c Thu Nov 13 16:08:07 1997
@@ -649,6 +649,8 @@
static int cpucount = 0;

extern int cpu_idle(void * unused);
+extern struct f00fbug_idt_struct idt_d;
+extern int pentium_f00f_bug;

/*
* Activate a secondary processor.
@@ -656,6 +658,9 @@
__initfunc(int start_secondary(void *unused))
{
smp_callin();
+ if (pentium_f00f_bug) {
+ __asm__ __volatile__("\tlidt %0": "=m" (idt_d));
+ }
while (!smp_commenced)
barrier();
return cpu_idle(NULL);
--- linux/include/asm-i386/processor.h.orig Thu Nov 13 16:51:29 1997
+++ linux/include/asm-i386/processor.h Thu Nov 13 15:56:57 1997
@@ -175,4 +175,10 @@
#define init_task (init_task_union.task)
#define init_stack (init_task_union.stack)

+struct f00fbug_idt_struct {
+ short limit __attribute__((packed));
+ void * addr __attribute__((packed));
+ short __pad __attribute__((packed));
+};
+
#endif /* __ASM_I386_PROCESSOR_H */
--- linux/arch/i386/kernel/traps.c.orig Thu Nov 13 16:51:29 1997
+++ linux/arch/i386/kernel/traps.c Thu Nov 13 16:32:50 1997
@@ -413,13 +413,7 @@

#endif /* CONFIG_MATH_EMULATION */

-static struct
-{
- short limit __attribute__((packed));
- void * addr __attribute__((packed));
- short __pad __attribute__((packed));
-} idt_d;
-
+struct f00fbug_idt_struct idt_d;
void * idt2;

__initfunc(void trap_init_f00f_bug(void))

--==_Exmh_17500874900
Content-Type: text/plain; charset=us-ascii

---- ---- ----
David Woodhouse, Robinson College, CB3 9AN, England. (+44) 0976 658355
dwmw2@cam.ac.uk http://dwmw2.robinson.cam.ac.uk
finger pgp@dwmw2.robinson.cam.ac.uk for PGP key.

--==_Exmh_17500874900--