mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
x86/boot/compressed: Pull global variable reference into startup32_load_idt()
commit d73a257f7f upstream.
In preparation for moving startup32_load_idt() out of head_64.S and
turning it into an ordinary function using the ordinary 32-bit calling
convention, pull the global variable reference to boot32_idt up into
startup32_load_idt() so that startup32_set_idt_entry() does not need to
discover its own runtime physical address, which will no longer be
correlated with startup_32 once this code is moved into .text.
While at it, give startup32_set_idt_entry() static linkage.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221122161017.2426828-11-ardb@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
530a4271b7
commit
29134968f7
@@ -744,16 +744,11 @@ SYM_DATA_END_LABEL(boot32_idt, SYM_L_GLOBAL, boot32_idt_end)
|
|||||||
*
|
*
|
||||||
* %eax: Handler address
|
* %eax: Handler address
|
||||||
* %edx: Vector number
|
* %edx: Vector number
|
||||||
*
|
* %ecx: IDT address
|
||||||
* Physical offset is expected in %ebp
|
|
||||||
*/
|
*/
|
||||||
SYM_FUNC_START(startup32_set_idt_entry)
|
SYM_FUNC_START_LOCAL(startup32_set_idt_entry)
|
||||||
push %ebx
|
/* IDT entry address to %ecx */
|
||||||
|
leal (%ecx, %edx, 8), %ecx
|
||||||
/* IDT entry address to %ebx */
|
|
||||||
leal rva(boot32_idt)(%ebp), %ebx
|
|
||||||
shl $3, %edx
|
|
||||||
addl %edx, %ebx
|
|
||||||
|
|
||||||
/* Build IDT entry, lower 4 bytes */
|
/* Build IDT entry, lower 4 bytes */
|
||||||
movl %eax, %edx
|
movl %eax, %edx
|
||||||
@@ -761,7 +756,7 @@ SYM_FUNC_START(startup32_set_idt_entry)
|
|||||||
orl $(__KERNEL32_CS << 16), %edx # Target code segment selector
|
orl $(__KERNEL32_CS << 16), %edx # Target code segment selector
|
||||||
|
|
||||||
/* Store lower 4 bytes to IDT */
|
/* Store lower 4 bytes to IDT */
|
||||||
movl %edx, (%ebx)
|
movl %edx, (%ecx)
|
||||||
|
|
||||||
/* Build IDT entry, upper 4 bytes */
|
/* Build IDT entry, upper 4 bytes */
|
||||||
movl %eax, %edx
|
movl %eax, %edx
|
||||||
@@ -769,15 +764,16 @@ SYM_FUNC_START(startup32_set_idt_entry)
|
|||||||
orl $0x00008e00, %edx # Present, Type 32-bit Interrupt Gate
|
orl $0x00008e00, %edx # Present, Type 32-bit Interrupt Gate
|
||||||
|
|
||||||
/* Store upper 4 bytes to IDT */
|
/* Store upper 4 bytes to IDT */
|
||||||
movl %edx, 4(%ebx)
|
movl %edx, 4(%ecx)
|
||||||
|
|
||||||
pop %ebx
|
|
||||||
RET
|
RET
|
||||||
SYM_FUNC_END(startup32_set_idt_entry)
|
SYM_FUNC_END(startup32_set_idt_entry)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SYM_FUNC_START(startup32_load_idt)
|
SYM_FUNC_START(startup32_load_idt)
|
||||||
#ifdef CONFIG_AMD_MEM_ENCRYPT
|
#ifdef CONFIG_AMD_MEM_ENCRYPT
|
||||||
|
leal rva(boot32_idt)(%ebp), %ecx
|
||||||
|
|
||||||
/* #VC handler */
|
/* #VC handler */
|
||||||
leal rva(startup32_vc_handler)(%ebp), %eax
|
leal rva(startup32_vc_handler)(%ebp), %eax
|
||||||
movl $X86_TRAP_VC, %edx
|
movl $X86_TRAP_VC, %edx
|
||||||
|
|||||||
Reference in New Issue
Block a user