diff options
Diffstat (limited to 'src/cpu/x86/smm')
-rw-r--r-- | src/cpu/x86/smm/smm_stub.S | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cpu/x86/smm/smm_stub.S b/src/cpu/x86/smm/smm_stub.S index aa48ab69ec..e409983eae 100644 --- a/src/cpu/x86/smm/smm_stub.S +++ b/src/cpu/x86/smm/smm_stub.S @@ -9,6 +9,7 @@ * found in smm.h. */ +#include <cpu/x86/cpu_info.S.inc> #include <cpu/x86/cr.h> #include <cpu/x86/msr.h> #include <cpu/x86/lapic_def.h> @@ -82,8 +83,21 @@ smm_relocate_gdt: /* gdt selector 0x20 tss segment */ .word 0xffff, 0x0000 .byte 0x00, 0x8b, 0x80, 0x00 + +#if CONFIG(CPU_INFO_V2) +per_cpu_segment_descriptors: + .rept CONFIG_MAX_CPUS + /* selgdt 0x28, flat data segment */ + .word 0xffff, 0x0000 + .byte 0x00, 0x93, 0xcf, 0x00 + .endr +#endif /* CPU_INFO_V2 */ smm_relocate_gdt_end: +#if CONFIG(CPU_INFO_V2) +.set per_cpu_segment_selector, per_cpu_segment_descriptors - smm_relocate_gdt +#endif /* CPU_INFO_V2 */ + .align 4 .code32 .global smm_trampoline32 @@ -153,6 +167,22 @@ apicid_end: movl $0, 4(%ebx) #endif +#if CONFIG(CPU_INFO_V2) + push_cpu_info index=%ecx + push_per_cpu_segment_data + + /* + * Update the AP's per_cpu_segment_descriptor to point to the + * per_cpu_segment_data that was allocated on the stack. + */ + set_segment_descriptor_base $per_cpu_segment_descriptors, %esp, %ecx + + mov %ecx, %eax + shl $3, %eax /* The index is << 3 in the segment selector */ + add $per_cpu_segment_selector, %eax + mov %eax, %gs +#endif + /* Create stack frame by pushing a NULL stack base pointer */ pushl $0x0 mov %esp, %ebp |