2005-09-28 21:42:17

by Zachary Amsden

[permalink] [raw]
Subject: [PATCH 1/3] Gdt page isolation fix

Andrew Morton's fix for PnP BIOS.

Signed-off-by: Zachary Amsden <[email protected]>

Index: linux-2.6.14-rc1/drivers/pnp/pnpbios/bioscalls.c
===================================================================
--- linux-2.6.14-rc1.orig/drivers/pnp/pnpbios/bioscalls.c 2005-08-28 16:41:01.000000000 -0700
+++ linux-2.6.14-rc1/drivers/pnp/pnpbios/bioscalls.c 2005-09-28 13:13:42.000000000 -0700
@@ -69,14 +69,14 @@ __asm__(

#define Q_SET_SEL(cpu, selname, address, size) \
do { \
-set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], __va((u32)(address))); \
-set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \
+set_base(get_cpu_gdt_table(cpu)[(selname) >> 3], __va((u32)(address))); \
+set_limit(get_cpu_gdt_table(cpu)[(selname) >> 3], size); \
} while(0)

#define Q2_SET_SEL(cpu, selname, address, size) \
do { \
-set_base(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], (u32)(address)); \
-set_limit(per_cpu(cpu_gdt_table,cpu)[(selname) >> 3], size); \
+set_base(get_cpu_gdt_table(cpu)[(selname) >> 3], (u32)(address)); \
+set_limit(get_cpu_gdt_table(cpu)[(selname) >> 3], size); \
} while(0)

static struct desc_struct bad_bios_desc = { 0, 0x00409200 };
@@ -115,8 +115,8 @@ static inline u16 call_pnp_bios(u16 func
return PNP_FUNCTION_NOT_SUPPORTED;

cpu = get_cpu();
- save_desc_40 = per_cpu(cpu_gdt_table,cpu)[0x40 / 8];
- per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = bad_bios_desc;
+ save_desc_40 = get_cpu_gdt_table(cpu)[0x40 / 8];
+ get_cpu_gdt_table(cpu)[0x40 / 8] = bad_bios_desc;

/* On some boxes IRQ's during PnP BIOS calls are deadly. */
spin_lock_irqsave(&pnp_bios_lock, flags);
@@ -158,7 +158,7 @@ static inline u16 call_pnp_bios(u16 func
);
spin_unlock_irqrestore(&pnp_bios_lock, flags);

- per_cpu(cpu_gdt_table,cpu)[0x40 / 8] = save_desc_40;
+ get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40;
put_cpu();

/* If we get here and this is set then the PnP BIOS faulted on us. */