From 3122de1666c5fb026a069bb1fa986ad9f470d4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Mon, 5 Feb 2018 14:09:36 +0100 Subject: [PATCH] Remove cpuid and longmode checks. Let's assume we have a modern processor --- src/kernel/boot/boot.S | 52 +----------------------------------------- 1 file changed, 1 insertion(+), 51 deletions(-) diff --git a/src/kernel/boot/boot.S b/src/kernel/boot/boot.S index 4dbd047..087800f 100644 --- a/src/kernel/boot/boot.S +++ b/src/kernel/boot/boot.S @@ -10,63 +10,13 @@ BootStack: .section .text .code32 -error: - //; Print "ERR!" in upper left corner - mov [0xb8000], dword ptr 0x4f004f00 - mov [0xb8004], dword ptr 0x4f004f00 - mov [0xb8000], byte ptr 'E' - mov [0xb8002], byte ptr 'R' - mov [0xb8004], byte ptr 'R' - mov [0xb8006], byte ptr '!' - jmp $ - -check_cpuid: - //; Save EFLAGS - pushfd - - //; Try to modify EFLAGS.ID - pushfd - xor dword ptr [esp], 1<<21 - popfd - - //;Read EFLAGS into eax - pushfd - pop eax - - //; Restore original EFLAGS - popfd - - //; Check if EFLAGS.ID was modified - xor eax, [esp+4] - and eax, 1<<21 - jz error - ret - -check_longmode: - //; cpuid 0x8000 0000 - mov eax, 0x80000000 - cpuid - cmp eax, 0x80000001 - jb error - - //; cpuid 0x8000 0001 - mov eax, 0x80000001 - cpuid - - //; Test for long mode flag - test edx, 1<<29 - jz error - ret - .global _start _start: cli + //; Set up a known stack mov esp, offset BootStack - call check_cpuid - call check_longmode - //; Set CR4.PAE //; enabling Page Address Extension mov eax, cr4