Page 1 of 1

ATA PIO: on 0x1F7 command General Protection Fault

Posted: Fri May 04, 2007 5:56 pm
by raistlinthewiz
Hi, it seems i do have a very strange problem here.
For a time i've been trying to code a basic ata driver.

I did read many documentation and example source codes.

I'm working on qemu.
The strange problem is that when i write to command register 0x1F7 of primary controller, - any value - i just get a General Protection Fault.

I do have a basicly working kernel. Do have gdt, idt, keyboard, console, timer etc stuff. Everything seems to work very well except this.

Tried many different things but no success.
outportb(0x1f7, 0x20);
outportb(0x1f7, 0xec);
etc... whenever i do try to put a byte on port 0x1f7 i do get the GPF.

Anyone did already meet this situation before?

In my last try i did ported this code;
http://www.osdev.org/phpBB2/viewtopic.p ... hlight=lba

Before did try many other example codes too but doesn't change..

I can provide specific code details if requested.

Thanks, Hüseyin

Posted: Fri May 04, 2007 6:21 pm
by raistlinthewiz
checked with bochs and vmware too.. same GPF. i can't understand why it's a general protection fault. if a had faulty setup anywhere in the kernel, GPF would fire in many other locations but now just - PIO outporb(1F7,0x??)

:? :? :?

Posted: Fri May 04, 2007 6:27 pm
by frank
Are you sure that you have proper IDT entries for IRQs 15 and 16? Those two are the IRQs for the hard drive.

Posted: Sat May 05, 2007 5:02 am
by raistlinthewiz
yes i do have entries enabled for irq14 & irq15.

but i'll check once more for any errors when i return home