Well, I tried to read from floppy using bios' int 13h using these functions and Bochs just stuck on a loop in ROM BIOS:
Code: Select all
f000:05f4 (unk. ctxt): push bp
f000:05f5 (unk. ctxt): mov bp, sp
f000:05f7 (unk. ctxt): push bx
f000:05f8 (unk. ctxt): push ds
f000:05f9 (unk. ctxt): mov ax, word ptr ss:[bp+0x4]
f000:05fc (unk. ctxt): mov ds, ax
f000:05fe (unk. ctxt): mov bx, word ptr ss:[bp+0x6]
f000:0601 (unk. ctxt): mov al, byte ptr ds:[bx]
f000:0603 (unk. ctxt): pop ds
f000:0604 (unk. ctxt): pop bx
f000:0605 (unk. ctxt): pop bp
f000:0606 (unk. ctxt): ret
f000:94b4 (unk. ctxt): add sp, 0x0004
f000:94b7 (unk. ctxt): and al, 0x80
f000:94b9 (unk. ctxt): mov byte ptr ss:[bp+0xfff1], al
f000:94bc (unk. ctxt): mov al, byte ptr ss:[bp+0xfff1]
f000:94bf (unk. ctxt): test al, al
f000:94c1 (unk. ctxt): jz .+0xffa1 (0x000f9464)
f000:9464 (unk. ctxt): mov ax, 0x0040
f000:9467 (unk. ctxt): push ax
f000:9468 (unk. ctxt): mov ax, 0x0040
f000:946b (unk. ctxt): push ax
f000:946c (unk. ctxt): call .+0x7185 (0x000f05f4) - it calls f000:05f4 again
I think it wants to read from something. Judging from "mov ax,0040", "push ax", "mov ax,word ptr ss[bp]" it wants to access the rom bios reserved RAM but its stuck in a infinite loop because some value is not as expected. It waits for a interrupt to fire I think...
What was weird, on real machine (3.2GHz) it starts after 10 seconds, but the floppy motor was still on (and aftermath floppy reading resulted in failure). On Bochs it just got stuck.
Are there pending interrupts coming up at times when you can't use them?
Shouldn't be, but is it just enough loading the previously loaded GDT and IDT from real mode and then remaping the PIC? I think the PIC is remapped bad, or there must be something else to be done.
BTW the whole procedure runs in a OS interrupt ISR. It does mask all irqs when switching to rmode and then unmasks it by remapping the PIC, of course with STI after. Then it saves all registers from pmode, and loads it to the BIOS int. After bios int finishes, it masks all irqs, returns to pmode and remaps the PIC for pmode.
But it haves the same result if I replace the calling for this ISR, by a FASM macro to switch to rmode and back. It haves exactly the same result - ints not firing I presume.
This routine works when a interrupt is not requested (for example, bios video services, FDD drive reset etc), but it does hang on even "wait for key" bios function, INT 16h with AX=0.
So the thing doesn't receive interrupts. Any more advices?
//EDIT: In the asm file there are both macros to switch to pmode and back... I think they shouldn't be incorrect. "InitializePmode" is called only once, and on the beginning in my kernel.