first of all I am new to OSDev started a few weeks ago just for fun and because I think it is a very interesting subject. the things I tried so far worked.
I did build a very simple kernel that printed some information on the screen. then I looked up on how to read a FAT table and that is where it did go wrong.
From what I understand is that the first 512bytes form a floppy get loaded to RAM 0x0000:7C00.
But when I read that part some bytes are not as expected.
To read the first FAT I should read 36 bytes form the 4 byte. (0x0000:7C03 - 0x0000:7C27).
This is what i would expect (hex editor on floppy image):
6D 6B 66 73 2E 66 61 74 00 02 01 01 00 02 E0 00 40 0B F0 09 00 12 00 02
This is what i got form RAM:
6D 00 12 00 00 00 02 00 00 00 50 00 00 00 06 00 40 0B F0 09 00 12 00 02
Something definitely messes them um but I can't why (Am guess I missing something ).
My floppy image contains GRUB 0.97 without my kernel, so I don't boot any code I have written.
I tried to boot it in Virtualbox and Bochs both the same outcome.
Reading FAT bs from RAM
-
- Member
- Posts: 5604
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Reading FAT bs from RAM
The problem is that your expectations are wrong: you expect the BIOS, but you're using GRUB.
GRUB will only give you what the Multiboot specification says it will. The fact that part of the BPB is present in memory is just a coincidence.
If you want to parse the FAT structures, you will need to read them from the disk first.
GRUB will only give you what the Multiboot specification says it will. The fact that part of the BPB is present in memory is just a coincidence.
If you want to parse the FAT structures, you will need to read them from the disk first.
Re: Reading FAT bs from RAM
Aah Thank you.
Stupid mistake of me should have been able to figure that out my self
Stupid mistake of me should have been able to figure that out my self