From a8a4f0710210ed91097a30fc26308c50be73d4de Mon Sep 17 00:00:00 2001 From: Jake Mannens Date: Tue, 9 Oct 2018 23:11:46 +1100 Subject: Added the f_inode element to struct file as a pointer to the file's inode in memory. Added a jump instruction in front of the multiboot header so that the kernel may be run as a binary image. The jump instruction will skip over the multiboot header to the beginning of the kernel's startup procedure in kboot. Moved the call to initialize the timer to earlier in the boot sequence. This is to allow for some drivers that may require it's functionality during the startup to function properly. Added functionality for the 'fast-gate' to the enable_a20 subroutine. Now, if the keyboard controller method fails when enabling the gate, an attempt is made to enable the A20 gate using the PS/2's fast-gate interface. If this also fails, the kernel will panic. Implemented TTY output for the console. The console is now TTY device 0 (the default for new userspace programs). --- kernel/boot.s | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'kernel/boot.s') diff --git a/kernel/boot.s b/kernel/boot.s index 8d07354..5050705 100644 --- a/kernel/boot.s +++ b/kernel/boot.s @@ -18,6 +18,7 @@ extern tty_init ; Multiboot header section .mboothdr +jmp kboot mboot_hdr: align 4 dd 0x1BADB002 @@ -44,10 +45,10 @@ kboot: call printk add esp, 4 ; initialize secondary subsystems + call timer_init call fs_init call tty_init ; last minute setup, then transfer to kmain - call timer_init call kmain ; if kmain decides to return (which it shouldn't), ; disable interrupts and halt the system. @@ -243,6 +244,14 @@ enable_a20: xchg ax, cx or al, 0x02 out 0x60, al + ; check if the gate is now enabled + call .testgate + jne .end + ; if the gate is still not working, try the fast-gate method + in al, 0x92 + and al, 0xFE + or al, 0x02 + out 0x92, al ; make sure the gate is working (panic if not) call .testgate jne .end @@ -272,7 +281,7 @@ enable_a20: pop ebp ret .tmp: dw 0xDEAD -.msg: db "Failed to enable A20 gate!", 10, 0 +.msg: db "Failed to enable the A20 gate!", 10, 0 pic_init: push ebp -- cgit v1.3