Skip to contentSkip to conversation

i386 Use protected segment for 16bit stack

PATCH In review Zachary Amsden 1 participant 1 message Nov 8, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 10/21 i386 Use protected segment for 16bit stack

Use prepare_protected_segment macro to set up the 16-bit stack.

Whee!! This code is almost readable now.

arch/i386/kernel/cpu/common.c +2 -4
Index: linux-2.6.14-zach-work/arch/i386/kernel/cpu/common.c
===================================================================
@@ -607,10 +607,8 @@ void __devinit cpu_init(void)
 	set_base(gdt[GDT_ENTRY_BAD_BIOS_CACHE], __va(BAD_BIOS_AREA));
 
 	/* Set up GDT entry for 16bit stack */
- 	*(__u64 *)(&gdt[GDT_ENTRY_ESPFIX_SS]) |=
-		((((__u64)stk16_off) << 16) & 0x000000ffffff0000ULL) |
-		((((__u64)stk16_off) << 32) & 0xff00000000000000ULL) |
-		(CPU_16BIT_STACK_SIZE - 1);
+	prepare_protected_segment(cpu, GDT_ENTRY_ESPFIX_SS, (void *) stk16_off,
+				  CPU_16BIT_STACK_SIZE);
 
 	cpu_gdt_descr[cpu].size = GDT_SIZE - 1;
  	cpu_gdt_descr[cpu].address = (unsigned long)gdt;