Fix early reboot on 32-bit CPUs that don't support long mode (issue #38)

This commit is contained in:
Martin Whitaker 2022-04-13 20:37:47 +01:00
parent 31f06ea7c8
commit 32b9ce38e7

View File

@ -105,18 +105,21 @@ startup:
# ...and check if the processor supports long mode.
pushl %ebx # ebx is overwritten by cpuid
movl $0x80000000, %eax # check if function 0x80000001 is available
pushl %ebx # ebx is overwritten by cpuid
cpuid
popl %ebx # restore ebx
cmpl $0x80000001, %eax
jb 1f
movl $0x80000001, %eax # test the LM flag
pushl %ebx # ebx is overwritten by cpuid
cpuid
andl $0x20000000, %edx
popl %ebx # restore ebx
andl $0x20000000, %edx
jz 1f
movl $1, use_long_mode@GOTOFF(%ebx)
1:
# Pick the correct stack.
call smp_my_cpu_num