int 13h appears to succeed but doesn't actually work
Posted: Tue Sep 20, 2011 9:47 pm
Hello folks!
I'm trying to write a simple bootloader that loads a small (50k) kernel. The currently currently does nothing more than just print a few messages.
The bootloader is (obviously) on sector #1 of the disk and the kernel is stored on sectors #2 and onwards.
My bootloader iteraters through each sector (starting with #2) until the last sector of the kernel, and loads these to memory. I read from disk using the int 13h, function 02h.
What I'm seeing is that the kernel is loaded correctly for the first 30 or so sectors. But the remaining sectors aren't being read into memory. I am checking for errors after the call to int 13h by looking at the CF as well as by examining AL (should be 1, and is in fact 1) for every call. Neither of these are showing anything wrong (i.e., CF is not set and AL=1).
I see this behavior in BOCHS, but the same code works correctly in QEMU. I am seeing some weird mixture of the two on real hardware - BOCHS fails to read anything after sector 30 or so, while real hardware seems to be able to read some of these correctly.
Do you guys have advice on what I could be doing wrong?
Any advice on how I should be debugging something like this?
I'm trying to write a simple bootloader that loads a small (50k) kernel. The currently currently does nothing more than just print a few messages.
The bootloader is (obviously) on sector #1 of the disk and the kernel is stored on sectors #2 and onwards.
My bootloader iteraters through each sector (starting with #2) until the last sector of the kernel, and loads these to memory. I read from disk using the int 13h, function 02h.
What I'm seeing is that the kernel is loaded correctly for the first 30 or so sectors. But the remaining sectors aren't being read into memory. I am checking for errors after the call to int 13h by looking at the CF as well as by examining AL (should be 1, and is in fact 1) for every call. Neither of these are showing anything wrong (i.e., CF is not set and AL=1).
I see this behavior in BOCHS, but the same code works correctly in QEMU. I am seeing some weird mixture of the two on real hardware - BOCHS fails to read anything after sector 30 or so, while real hardware seems to be able to read some of these correctly.
Do you guys have advice on what I could be doing wrong?
Any advice on how I should be debugging something like this?