diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-02-05 23:22:00 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-02-05 23:22:00 +0100 |
commit | 429762dca4d313140067d14e1c448ee68d1644d2 (patch) | |
tree | b91e1abc297e58440894855007f80023b8f385ef /i386/i386/cpuboot.S | |
parent | e211bdce3388a3c9e3dafab903dd53374f6d9759 (diff) |
apboot: avoid self-modifying code
self-modifying code is generally frowned upon, Intel largely says the
support is model-dependent. We can as well just relocate from the C
code like we did for the temporary gdt.
Diffstat (limited to 'i386/i386/cpuboot.S')
-rw-r--r-- | i386/i386/cpuboot.S | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S index b2f9e520..3e4d5420 100644 --- a/i386/i386/cpuboot.S +++ b/i386/i386/cpuboot.S @@ -100,7 +100,7 @@ apboot_percpu_med: apboot_percpu_high: .byte 0 -.globl apboot, apbootend, gdt_descr_tmp +.globl apboot, apbootend, gdt_descr_tmp, apboot_jmp_offset .align 16 .code16 @@ -128,21 +128,11 @@ _apboot: orl $CR0_SET_FLAGS, %eax movl %eax, %cr0 - xorl %eax, %eax - mov %cs, %ax - shll $4, %eax - addl $M(0f), %eax - movl %eax, M(ljmp_offset32) - - /* Flush cached instruction queue */ - jmp 1f -1: - - /* ljmpl with relocation */ + /* ljmpl with relocation from machine_init */ .byte 0x66 .byte 0xea -ljmp_offset32: - .long 0xffffffff +apboot_jmp_offset: + .long M(0f) .word BOOT_CS 0: |