Reading the kernel from floppy in RM

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.
User avatar
~
Member
Member
Posts: 1228
Joined: Tue Mar 06, 2007 11:17 am
Libera.chat IRC: ArcheFire

Post by ~ »

What about reading always at 0000:0500 (the start of free memory in Real Mode) and then transfer the read sectors to the final address? In this way, the temporary memory would be located at the same place and it would help to make it more dynamic for when the kernel image gets bigger, and no major changes will be needed.

Also, if your kernel is already too big for real mode, maybe you should read sector by sector to simplify it. At least I don't find it much slower than reading full tracks.

Why you don't also try to execute something like this to flush CS:EIP (NASM syntax):

Code: Select all

a32 jmp dword 8:KernelEntryPoint
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post by XCHG »

Alright I'm sick of this already. I have attached my boot loader to this post. I know that the problem is in my mixing of 32 and 16bits code. Line 226 in the boot loader is a short jump. If I pus JMP $ before it, no errors occur but if I don't, you will see a very strange error from Bochs.

I'd really appreciate it if somebody could give me a hand with this. Thanks in advance.
Attachments
boot.asm
My Boot Loader, coded in NASM; Commented.
(9.71 KiB) Downloaded 58 times
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Post by Combuster »

My main concern is that your bootloader isn't truly FAT-capable. It makes numerous assumptions that may or may not work.

One instruction you should be aware of:
REP MOVSD
in 16 bit mode, this will move 32 bits from SI to DI, not from ESI to EDI. You will have to manually add the prefix to fix that.

Also, i noticed your documentation says that you are putting a .o file on the disk. This is not a binary file type and can not be executed...
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply