Change bootg.asm to:
Code:
bits 32
%include "gdt.inc"
%include "idt.inc"
global start
extern kernelmain
section .multiboot
ALIGN 4
mboot:
MULTIBOOT_PAGE_ALIGN equ 1<<0
MULTIBOOT_MEMORY_INFO equ 1<<1
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
section .text
start:
mov esp, _sys_stack
call InstallGDT
call kernelmain
jmp $
section .bss
resb 8192
_sys_stack:
Change grub.cfg to:
Code:
menuentry "Gryphus" {
echo Gryphus is loading. Please wait.
multiboot /boot/os.elf
}
In gdt.inc you have an STI instruction after loading the GDT but you don't have an IDT installed. You will probably want to remove that STI. Your InstallGDT doesn't reload the segment registers so it should probably look something like:
Code:
InstallGDT:
pusha ; save registers
lgdt[toc] ; load GDT into GDTR
jmp 0x08:.setcs ; Set CS to 0x08
.setcs:
mov ax, 0x10 ; Set the data segment registers
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
popa ; restore registers
ret ; All done!
I'd also highly recommend putting a
section .text at the top of idt.inc. a
section .text before InstallGDT in gdt.inc and a
section .data before the GDT data in gdt.inc . This is useful to put the code and data in the right sections when they are included by bootg.asm .