Monday, May 22, 2006

Kernel head

This is a late post. Simply explains how the kernel sits in after grub.



[BITS 32]

global _start
extern kernel_entry

PAGEALIGN equ 1<<0
MEMORYINFO equ 1<<1
HEADERFLAGS equ PAGEALIGN | MEMORYINFO ; 0x3 that is
HEADERMAGIC equ 0x1BADB002
CHECKSUM equ -(HEADERMAGIC + HEADERFLAGS)
STACKSIZE equ 0x4000

section .text
ALIGN 4 ; section must be 4 byte-aligned
multibootheader ;
dd HEADERMAGIC
dd HEADERFLAGS
dd CHECKSUM

_start:
mov esp, stack+STACKSIZE
push eax
push ebx
call kernel_entry
jmp $

; GDT here

; ISRs here

section .bss
ALIGN 4
stack resb STACKSIZE ; 16KB of memory

I’m just sad tonight, that’s why I decided to post this out of nothing. Well I guess keeping myself busy would be wise enough.

No comments: