Page 2 of 2
Re: Int13h AH=42h Boot From Hard Drive just fails
Posted: Tue Jun 09, 2009 7:00 pm
by pcmattman
Well, yeah, but right now with Qemu, I can just go: qemu -hdb d: -L <whatever>
and it boots my D: partiton. The problem is: how to do the same with Bochs?
IIRC, Bochs can access partitions in a similar way:
Code: Select all
ata0-slave: type=disk, path="\\.\D:", mode=flat, translation=auto
Note that I'm going purely from memory here, I may be wrong.
Re: Int13h AH=42h Boot From Hard Drive just fails
Posted: Wed Jun 10, 2009 11:02 am
by CmpXchg
Bad news: INT13 preserves BP and the structure doesn't need to be aligned.
I've figured this out under FreeDOS with the aid of AFDPro debugger...
@pcmattman: Thanx, I'm gonna try it out. Bochs for Windows is still alpha, though.
@Love4Boobies: Nah, the origin is alright. If the origin were 7C00h, the code would erase the BPB and Extended BPB structures in the bootsector.
Re: Int13h AH=42h Boot From Hard Drive just fails
Posted: Wed Jun 10, 2009 11:37 am
by Love4Boobies
CmpXchg wrote:@Love4Boobies: Nah, the origin is alright. If the origin were 7C00h, the code would erase the BPB and Extended BPB structures in the bootsector.
Think about if for a bit. The MBR will load the boot sector into memory and pass control to it. You need to have an instruction that jumps over the BPB and whatever other data structures NTFS uses. In case you did that (to the right offset) outside of the assembly file (which is sort of weird) then nevermind.
Re: Int13h AH=42h Boot From Hard Drive just fails
Posted: Wed Jun 10, 2009 1:01 pm
by CmpXchg
Guys? I got it working!
The issue was that I pushed Hidden Sectors value without incrementing it first, so that would load the bootsector all over again... And I've triple-checked all the values there, so it's working allright now. On my real machine.
The curious thing is that it still didn't work under QEMU when I go:
So I made an image file of the starting sectors of the harddisk (the NTFS partition is the first, so that image spans MBR and the first 2 sectors of NTFS partition).
Ran with
Code: Select all
qemu -L <whatever> -hdb <imagefile>
and it worked!
Love4Boobies wrote:In case you did that (to the right offset) outside of the assembly file (which is sort of weird) then nevermind.
Yep, I did that outside of the assembly file. The JMP instruction was down there all the time, actually. On NTFS, it always jumps to the offset 0x54.
Well, how could I change this so it wouldn't look weird to you? If I made the file from the origin 7C00h and replaced the whole partition bootsector with it, it would erase all the whatever structures it had. So I wrote an installer that uses Win32 API to paste the bootloader binary file at the exact offset (and it also checks the 55h, 0AAh signature to make sure the length is allright).
btw, I love your nickname
Don't get too angry with me.
Re: Int13h AH=42h Boot From Hard Drive just fails
Posted: Wed Jun 10, 2009 1:40 pm
by CmpXchg
OK, solved completely.
Works in qemu when invoked like this:
Code: Select all
qemu -L <whatever> -hda \\\\.\\PhysicalDrive1
I use my second hard drive to test the OS.