mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 12:30:31 +00:00
Kernel/x86_64: Halt if we happen to boot on non-x86_64 machine
This commit is contained in:
parent
e0cf6f3cf0
commit
458ac9bbba
Notes:
sideshowbarker
2024-07-18 11:03:21 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/458ac9bbbae Pull-request: https://github.com/SerenityOS/serenity/pull/8406 Reviewed-by: https://github.com/gunnarbeutner ✅
1 changed files with 17 additions and 0 deletions
|
@ -101,6 +101,23 @@ start:
|
|||
cli
|
||||
cld
|
||||
|
||||
/* test for long mode presence, save the most important registers from corruption */
|
||||
pushl %eax
|
||||
pushl %edx
|
||||
pushl %ebx
|
||||
|
||||
movl $0x80000001, %eax
|
||||
cpuid
|
||||
testl $(1 << 29), %edx /* Test if the LM-bit, which is bit 29, is set in the edx register. */
|
||||
jnz continue /* If LM-bit is not enabled, there is no long mode. */
|
||||
hlt
|
||||
|
||||
continue:
|
||||
/* restore the pushed registers */
|
||||
popl %ebx
|
||||
popl %edx
|
||||
popl %eax
|
||||
|
||||
/* We don't know where the bootloader might have put the command line.
|
||||
* It might be at an inconvenient location that we're not about to map,
|
||||
* so let's just copy it to a convenient location while we have the whole
|
||||
|
|
Loading…
Reference in a new issue