Added kinda working key input checking
This commit is contained in:
29
boot/boot.s
29
boot/boot.s
@@ -1,6 +1,11 @@
|
||||
global _start
|
||||
extern long_mode_start
|
||||
|
||||
%define ERR_NO_MB "0"
|
||||
%define ERR_NO_CPUID "1"
|
||||
%define ERR_NO_LONG_MODE "2"
|
||||
%define ERR_NO_V86 "3"
|
||||
|
||||
section .text
|
||||
bits 32
|
||||
_start:
|
||||
@@ -19,6 +24,7 @@ _start:
|
||||
|
||||
call set_up_page_tables
|
||||
call enable_paging
|
||||
call enable_sce
|
||||
|
||||
; load the 64-bit GDT
|
||||
lgdt [gdt64.pointer]
|
||||
@@ -32,12 +38,29 @@ _start:
|
||||
mov dword [0xb8000], 0x2f4b2f4f
|
||||
hlt
|
||||
|
||||
detect_v86:
|
||||
smsw ax
|
||||
and eax,1 ;CR0.PE bit
|
||||
cmp eax, 1
|
||||
je .no_v86
|
||||
ret
|
||||
.no_v86:
|
||||
mov al, ERR_NO_V86
|
||||
jmp error
|
||||
|
||||
enable_sce: ; System Call Extensions
|
||||
mov ecx, 0xC0000080
|
||||
rdmsr
|
||||
or eax, 1
|
||||
wrmsr
|
||||
ret
|
||||
|
||||
check_multiboot:
|
||||
cmp eax, 0x36d76289
|
||||
jne .no_multiboot
|
||||
ret
|
||||
.no_multiboot:
|
||||
mov al, "0"
|
||||
mov al, ERR_NO_MB
|
||||
jmp error
|
||||
|
||||
check_cpuid:
|
||||
@@ -73,7 +96,7 @@ check_cpuid:
|
||||
je .no_cpuid
|
||||
ret
|
||||
.no_cpuid:
|
||||
mov al, "1"
|
||||
mov al, ERR_NO_CPUID
|
||||
jmp error
|
||||
|
||||
check_long_mode:
|
||||
@@ -90,7 +113,7 @@ check_long_mode:
|
||||
jz .no_long_mode ; If it's not set, there is no long mode
|
||||
ret
|
||||
.no_long_mode:
|
||||
mov al, "2"
|
||||
mov al, ERR_NO_LONG_MODE
|
||||
jmp error
|
||||
|
||||
set_up_page_tables:
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
set timeout=0
|
||||
set default=0
|
||||
|
||||
|
||||
insmod all_video
|
||||
menuentry "poppin" {
|
||||
multiboot2 /boot/poppin.bin
|
||||
set gfxpayload=1024x768x32
|
||||
boot
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user