i started developing a boot loader for my kernel a few weeks back but every time i test it using Bochs i get this error:
'00014058132i[CPU0 ] BOUND_GdMa: fails bounds test' and i get no output.
i did a few search and read that this error seems to be because of an incorrectly set up stack.
But what confuses me is no matter what method i use to set up the stack,
whether i read about it and write my own code or steal it from another boot loader from some tutorial, i still get this error.
what im asking is what does this error acctually mean, how can i fix it and how do you go about setting up the stack?
further info:
my boot loader is in NASM assembly,
it loads the kernel from the second sector of the floppy then jumps to the kernel. simples.
here is the code:
Code: Select all
; ================================
;OS/B boot loader
; ================================
msg_wait db "press any key to boot kernel", 0x0D, 0x0A , 0
org 0x07C0
;==============================================================================
;this is from MikeOS, because no matter how hard i try i cant get any sort of stack set up to work :(
mov ax, 07C0h ; Set up 4K of stack space above buffer
add ax, 544 ; 8k buffer = 512 paragraphs + 32 paragraphs (loader)
cli ; Disable interrupts while changing stack
mov ss, ax
mov sp, 4096
sti ; Restore interrupts
mov ax, 07C0h ; Set data segment to where we're loaded
mov ds, ax
;================================================================================
;ok, load the kernel from the second sector of the floppy drive into 0x1000 of the RAM
mov si, msg_wait
call print_string
mov ah, 0
int 0x16 ; wait for keypress
mov dl, 0x00 ;drive is set as first floppy
mov ah,0x00 ; reset drive
int 0x13
mov ax, 0x1000 ;memory adress for second sector to be loaded into
mov cl, 2 ;sector to be read
mov al, 1 ;number of sectors to be read
mov dh, 0 ;head
mov ch, 0 ;track
mov ah, 0x02 ;set up interrupt
mov bx, 0
int 0x13 ;go go go!
jmp 0x1000
cli
hlt
; ================
; calls ( from an OSDev tutorial, called something like 'writing a 16 bit real mode OS' i think...)
; ================
print_string:
lodsb ; grab a byte from SI
or al, al ; logical or AL by itself
jz .done ; if the result is zero, get out
mov ah, 0x0E
int 0x10 ; otherwise, print out the character!
jmp print_string
.done:
ret
times 510-($-$$) db 0 ;fill whatever is left of the first sector with 0's
dw 0AA55h ; BIOS boot sig