FAR Jmp problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
ksk

FAR Jmp problem

Post by ksk »

Hi,

I am almost on the verge of completing my bootloader. These are the things that I have done

1. relocate by bootloader from 0x7C00 to 0x8000:0
2. Enable A20
3. Then jump to the relocated bootloader
4. Then I loaded my kernel at 0x1000:0
5. But when I try to do a far jmp to that address(to execute my kernel) I get
        
         rip > cs error in Bochs

I have tried the following

a) jmp 0x1000:0x0

b) krnl_load_address dw 0x1000
   jmp word far krnl_load_address:0x0

and many others............

But still I am not able to get What I want.

PS:
   I am still in real mode but I have enabled A20 (but I think both have nothing to do with my problem - except ofcourse the 64K segment limit)
St8ic

RE:FAR Jmp problem

Post by St8ic »

Hmmmm....If I'm understanding correctly I think sticking an offset and segment on the end should work:

DW 07E00h ; offset
DW 00000h ; segment

Or where ever they are. This would be jumping to <DB 0EAh>.
ksk

RE:FAR Jmp problem

Post by ksk »

hi
Could you explain in detail. How did you get <DB 0EAh>?

In INtel manual it says far jump can be done only by a memory (In real mode). Any idea how ?

Thanks
St8ic

RE:FAR Jmp problem

Post by St8ic »

I didn't understand the question. The code I gave is a little trick to jump to a location on disk (in this case the second sector, that would be DB 0EAh). If you didn't use this offset/segment crap then you'd crash and burn because the location is too close to sector 1, where this code is.

I think you're jumping in memory address, not disk sector. Sorry for the incovenience I may have caused.
Ramanan

RE:FAR Jmp problem

Post by Ramanan »

y don't u use like this instead of jmp....

mov ax, 0x1000
push ax
xor ax, ax
push ax
retf

rgds,
YogaRamanan.T
Post Reply