Boch error...
Boch error...
Well since my last post(not too long ago) I managed to load a simple kernel and i even tried to load a second bootloader and kernel...and to my surprise it worked so i've managed to move along steadily. But now my problem is in bochs. im programming in win95 using bochs 2.0.2 and when i try loading up the kernel it gives me the error prefetch: RIP > CS.limit ... I did a search on the board but only found EIP > CS.limit errors not RIP so i don't know....any ideas out there???
Re:Boch error...
Hmm...well that explains it...thanks...ill do a search and see if i can figure it out.
Re:Boch error...
Correct me if I?me wrong, but isn?t RIP the 64bit variant of EIP? I think AMD call teir register so.
Re:Boch error...
i know this error is caused by my jump to the kernel, but is it because im loading it at 0x1000 or is it the actual jump code? ??? i just loaded it to memory and did
mov ax, 0x1000
mov es, ax
mov ds, ax
push ax
xor ax,ax
push ax
retf
maybe its the retf that bochs is not agreeing with? when i do a jmp 0x0000:0x1000 it doesn't even work at all on bochs or on a reboot....so i really don't know...i still have a lot to learn...
mov ax, 0x1000
mov es, ax
mov ds, ax
push ax
xor ax,ax
push ax
retf
maybe its the retf that bochs is not agreeing with? when i do a jmp 0x0000:0x1000 it doesn't even work at all on bochs or on a reboot....so i really don't know...i still have a lot to learn...
Re:Boch error...
Maybe you could show your loading code! Aand before you could test this jump:
Code: Select all
jmp 0x1000:0000
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Boch error...
just a question ... is the code that issue that jump in protected or real mode ?
Re:Boch error...
Ok this is my loader...
So yea...it works on reboots...but not in bochs? ??? ???
Code: Select all
BITS 16
ORG 0
JMP short Start
NOP
osname db 'Test'
bytespersector dw 512
sectorspertrack dw 18
numberofheads dw 2
totalsectors dw 2880
bootdrive db 0
Start:
CLI
MOV AX, 0x7c0
MOV DS, AX
MOV ES, AX
MOV AX, 0x9000
MOV SS, AX
MOV SP, 0xffff
STI
CALL Clear_Screen
MOV SI, welcome
CALL Print_It
;===LOAD KERNEL===
Read_Sector:
PUSH DS
MOV AX, 0
MOV DL, 0
INT 13h
POP DS
JC Kernel_Error
PUSH ES
MOV AX, 0x1000 ;Why exactly does this have to be here? it gets changed
MOV ES, AX ;when AH and AL..so is it to set the buffer for int 0x13?
MOV BX, 0
MOV AH, 2
MOV AL, 5
MOV CH, 0
MOV CL, 2
MOV DH, 0
INT 13h
POP ES
JC Kernel_Error
MOV AX, 0x1000 ;So now the kernel is loaded from the second sector
MOV ES, AX ;So why reset ES, and why set DS at all?
MOV DS, AX
JMP 0x1000:0000
Kernel_Error:
MOV SI, error
CALL Print_It
CALL Read_Sector
;===FUNTIONS===
Print_It:
LODSB
OR AL,AL
JZ Print_Done
MOV AH,0x0E
MOV BX,0x07
INT 0x10
JMP Print_It
Print_Done:
ret
Clear_Screen:
MOV AL,3
MOV AH,0
INT 10H
RET
;======DATA===
welcome db 'Bootloader...',13,10,0
error db 'Could not read Kernel...',13,10,0
TIMES 510-($-$$) DB 0
dw 0xAA55
Re:Boch error...
Just for those who might be curious heres the bochsout.txt file with the error...
Re:Boch error...
Well after looking at the bochs output i realized that the CS base was being set at 0009:0000 instead of 0000:9000 <---where the kernel was being loaded too....so i changed the code a bit and the 'panic:RIP > CS.Limit' error has gone...but bochs still doesn't load the kernel.. and it does load fine on a reboot...ah well i guess ill keep trying...