mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-27 03:47:43 +00:00
x86, realmode: Remove indirect jumps in trampoline_32 and wakeup_asm
Remove indirect jumps in trampoline_32.S and the 32-bit part of wakeup_asm.S. There exist systems which are known to do weird things if an SMI comes in right after a mode switch, and the safest way to deal with it is to always follow with a simple absolute far jump. In the 64-bit code we then to a register indirect near jump; follow that pattern for the 32-bit code. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Link: http://lkml.kernel.org/r/1336501366-28617-14-git-send-email-jarkko.sakkinen@intel.com
This commit is contained in:
parent
056a43a6d3
commit
968ff9ee56
@ -47,24 +47,29 @@ trampoline_data:
|
|||||||
|
|
||||||
cli # We should be safe anyway
|
cli # We should be safe anyway
|
||||||
|
|
||||||
|
movl startup_32_smp, %eax # where we need to go
|
||||||
|
|
||||||
movl $0xA5A5A5A5, trampoline_status
|
movl $0xA5A5A5A5, trampoline_status
|
||||||
# write marker for master knows we're running
|
# write marker for master knows we're running
|
||||||
|
|
||||||
/* GDT tables in non default location kernel can be beyond 16MB and
|
/*
|
||||||
|
* GDT tables in non default location kernel can be beyond 16MB and
|
||||||
* lgdt will not be able to load the address as in real mode default
|
* lgdt will not be able to load the address as in real mode default
|
||||||
* operand size is 16bit. Use lgdtl instead to force operand size
|
* operand size is 16bit. Use lgdtl instead to force operand size
|
||||||
* to 32 bit.
|
* to 32 bit.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lidtl boot_idt_descr # load idt with 0, 0
|
lidtl boot_idt_descr # load idt with 0, 0
|
||||||
lgdtl boot_gdt_descr # load gdt with whatever is appropriate
|
lgdtl boot_gdt_descr # load gdt with whatever is appropriate
|
||||||
|
|
||||||
xor %ax, %ax
|
movw $1, %dx # protected mode (PE) bit
|
||||||
inc %ax # protected mode (PE) bit
|
lmsw %dx # into protected mode
|
||||||
lmsw %ax # into protected mode
|
|
||||||
|
|
||||||
# flush prefetch and jump to startup_32_smp in arch/i386/kernel/head.S
|
ljmpl $__BOOT_CS, $pa_startup_32
|
||||||
ljmpl *(startup_32_smp)
|
|
||||||
|
.section ".text32","ax"
|
||||||
|
.code32
|
||||||
|
ENTRY(startup_32) # note: also used from wakeup_asm.S
|
||||||
|
jmp *%eax
|
||||||
|
|
||||||
.data
|
.data
|
||||||
.globl startup_32_smp, boot_gdt, trampoline_status
|
.globl startup_32_smp, boot_gdt, trampoline_status
|
||||||
@ -82,5 +87,4 @@ trampoline_status:
|
|||||||
.long 0
|
.long 0
|
||||||
|
|
||||||
startup_32_smp:
|
startup_32_smp:
|
||||||
.long 0x00000000
|
.long 0
|
||||||
.word __BOOT_CS, 0
|
|
||||||
|
@ -124,9 +124,11 @@ wakeup_start:
|
|||||||
lgdtl pmode_gdt
|
lgdtl pmode_gdt
|
||||||
|
|
||||||
/* This really couldn't... */
|
/* This really couldn't... */
|
||||||
movl pmode_cr0, %eax
|
movl pmode_entry, %eax
|
||||||
movl %eax, %cr0
|
movl pmode_cr0, %ecx
|
||||||
ljmpl *pmode_entry
|
movl %ecx, %cr0
|
||||||
|
ljmpl $__KERNEL_CS, $pa_startup_32
|
||||||
|
/* -> jmp *%eax in trampoline_32.S */
|
||||||
#else
|
#else
|
||||||
jmp trampoline_data
|
jmp trampoline_data
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user