Skip to contentSkip to conversation

2.5.33 PNPBIOS does not compile

PATCH Ray Lee 1 participant 2 messages Sep 1, 2002 Pnp support

lore
Share & tools
lore

Ray Lee

author
#0 lore raw

Hi there,

Review

Quoted 9 lines

#define Q_SET_SEL(cpu, selname, address, size) \
set_base(cpu_gdt_table[cpu][(selname) >> 3], __va((u32)(address))); \

(quoted diff) +2 -2
-set_limit(&cpu_gdt_table[cpu][(selname) >> 3], size)
+set_limit(cpu_gdt_table[cpu][(selname) >> 3], size)
 
 #define Q2_SET_SEL(cpu, selname, address, size) \
 set_base(cpu_gdt_table[cpu][(selname) >> 3], (u32)(address)); \
-set_limit(&cpu_gdt_table[cpu][(selname) >> 3], size)
+set_limit(cpu_gdt_table[cpu][(selname) >> 3], size)

These look very wrong. They're not wrapped in the standard do {...} while(0) protection, and used inside bare if statements below. Can someone who knows the code verify that these should be wrapped?

(Not, mind you, that I'm complaining about your patch. You didn't introduce the problem, it just caught my eye.)

Ray

author
#1 lore raw
Quoted 3 lines · Ray Lee

These look very wrong. They're not wrapped in the standard do {...} while(0) protection, and used inside bare if statements below. Can someone who knows the code verify that these should be wrapped?

Back from running errands, and took a longer look at the code. I don't know if the current form is harmless or not, but it is definitely incorrect. The patch below corrects the compile failure, as well as the multi-statement macro defines used in bare if statements; please apply.

Ray

drivers/pnp/pnpbios_core.c renamed from linux-2.5.33/drivers/pnp/pnpbios_core.c +6 -2
diff -urX ../dontdiff ../linux-2.5.33/drivers/pnp/pnpbios_core.c ./drivers/pnp/pnpbios_core.c
@@ -126,12 +126,16 @@
 );
 
 #define Q_SET_SEL(cpu, selname, address, size) \
+do { \
 set_base(cpu_gdt_table[cpu][(selname) >> 3], __va((u32)(address))); \
-set_limit(&cpu_gdt_table[cpu][(selname) >> 3], size)
+set_limit(cpu_gdt_table[cpu][(selname) >> 3], size); \
+} while(0)
 
 #define Q2_SET_SEL(cpu, selname, address, size) \
+do { \
 set_base(cpu_gdt_table[cpu][(selname) >> 3], (u32)(address)); \
-set_limit(&cpu_gdt_table[cpu][(selname) >> 3], size)
+set_limit(cpu_gdt_table[cpu][(selname) >> 3], size); \
+} while(0)
 
 /*
  * At some point we want to use this stack frame pointer to unwind