Boot Loader Issues
Posted: Thu May 27, 2010 4:09 am
Hi, I'm having several issues with my new boot loader code. I am trying to load my kernel from floppy disk, but when I jump to where I loaded it in memory, the CPU triple faults.
Here is the flow of my second stage loader with the relevant code:
Here is the flow of my second stage loader with the relevant code:
- org 0x2000
- make stack
- A20/GDT Stuff
- Enter Unreal Mode
- Read Floppy starting at sector 0x90 till n sectors [code] ;disk buffer mov ax, 0x1000 mov es, ax xor bx, bx mov ax, 0x90 ;starting sector, temp, will locate actual sector via code eventually .loop: pusha call linear_to_chs call kread_cylinder popa add ax, 18 pusha xor dx, dx test dx, dx jnz .no_marker .no_marker: popa push ds push es pushad mov cx, 0 mov es, cx mov ds, cx mov edi, 0x100000 sub eax, 18 shl eax, 9 add edi, eax mov esi, 0x10000 mov ecx, (512*18)/4 a32 rep movsd popad pop es pop ds cmp ax, ((0x400*24)/0x200) + 0x91 ; temp calc, will have actual size eventually jl .loop [CODE SNIPPED] [/code]
- Jump to Protected Mode & Start Kernel [code] cli mov eax, cr0 or al, 1 mov cr0, eax jmp 0x8: _protected ; switch to 32 bits [BITS 32] _protected: mov ax, 0x10 mov ds, ax mov es, ax mov ss, ax mov fs, ax mov gs, ax mov esp, 0x200000 - 16 call 0x100000 ; start kernel [/code]