Heres the stack right before the call to _putch (within printf):
Code: Select all
0x0008ffc4 [0x00000000]
0x0008ffc8 [0x00000000]
0x0008ffcc [0x00000f00]
0x0008ffd0 [0x000b8000]
0x0008ffd4 [0x1f000000]
0x0008ffd8 [0x00008fffc]
0x0008ffdc [0x00001032]
0x0008ffe0 [0x00002008]
0x0008ffe4 through 0x0008fffc [0x0] (Always)
I have written a custom bootloader. I know its a low address,
I soon plan to enabe A20 (Its not enabled yet), and load it above
the bootloader (for alot of reasons)
As for loading the entire kernel...nope. atm, it only loads one sector.
I dont think this the problem tough, because I can make calls
to _putch inside of printf(), and it works just fine.. I can also add
additional code, and still works.
Unless Im missing something?
Heres the code that loads the kernel (Part of my bootloader)...
Code: Select all
; load second stage to 0:1000h ----------------
LoadStage2:
mov ax, 0
mov es, ax
mov bx, 1000h ; load stage2 at offset es:1000h (0:1000h)
;;; mov ax, 1 ; start reading from head 1 sector 0
mov ah, 02h
mov al, 02h
mov ch, 0
mov cl, 02h
mov dh, 0
int 13h
or ah, ah
jnz LoadStage2
;;; mov cx, 50 ; read 50 sectors
;;; call LoadSectors
At the moment, it only reads sector 1 (I was getting triple faults
when loading previosuly, so commented it out and tested with one
sector)
Here is where I jump to the stage 2 loader (I get a warning from
the linker reguarding not finding _Stage--Please see my other post for
details):
Code: Select all
;------------------------------------------ Enter: Protected Mode ---------
[BITS 32]
EnterStage2:
; setup 32bit registers
mov ax, 10h
mov ds, ax
mov ss, ax
mov esp, 90000h ; stack begins from 90000h
; stop floppy drive controller
xor al, al
mov dx, 03f2h ; port number
out dx, al
; jump to second stage bootloader (0:01000h)
jmp 08h:1000h
The bootloader isnt linked at all. Only the second stage (Which
*supposed* to be loaded at 08h:1000h). I only link
my stage2 with my C kernel.
(I am getting a warning from the linker not finding _Stage2 though
(Yet my OS executes fine). Please see my other post reguarding this...