Floppy timeout [Not Solved] & GCC optimizations [Solved]
Posted: Sun May 03, 2009 4:53 am
Hey everybody,
I've got 2 problems.
First problem while resetting the floppy controller.
I know the reset isn't fully implemented yet, but that's not the problem.
It works on a real pc(!) and in VirtualPC, but not in VmWare or Bochs, so I can't do any "low-level" debugging.
In Bochs, I get timeout messages after "printk("Floppy 3\n\r");", after "printk("Floppy 5\n\r");" and then it does an infinite loop while waiting for the floppy IRQ, so my question is whether Bochs emulates the floppy drive correctly or is it just a problem with my code?
In VmWare, the timeout messages don't appear, but it also waits endlessly for the floppy IRQ.
My second problem is that my code never works, if I add "-Os" to the gcc parameters, so gcc breaks my code with "optimizations"
while doing "timer_wait(10);", instead of waiting, it does an inifnite loop like "JMP $".
If you need more code I'll post it.
Every help will be appreciated.
I've got 2 problems.
First problem while resetting the floppy controller.
I know the reset isn't fully implemented yet, but that's not the problem.
It works on a real pc(!) and in VirtualPC, but not in VmWare or Bochs, so I can't do any "low-level" debugging.
In Bochs, I get timeout messages after "printk("Floppy 3\n\r");", after "printk("Floppy 5\n\r");" and then it does an infinite loop while waiting for the floppy IRQ, so my question is whether Bochs emulates the floppy drive correctly or is it just a problem with my code?
In VmWare, the timeout messages don't appear, but it also waits endlessly for the floppy IRQ.
Code: Select all
BYTE fdc_reset()
{
printk("Floppy 1\n\r");
if(fdc_send_byte(FLOPPY_PRIMARY | FLOPPY_DOR, 0))
{
printk("Timeout! :(\n\r");
}
printk("Floppy 2\n\r");
timer_wait(10);
printk("Floppy 3\n\r");
if(fdc_send_byte(FLOPPY_PRIMARY | FLOPPY_DOR, 0x4))
{
printk("Timeout! :(\n\r");
}
printk("Floppy 4\n\r");
timer_wait(50);
printk("Floppy 5\n\r");
if(fdc_send_byte(FLOPPY_PRIMARY | FLOPPY_CCR, 0))
{
printk("Timeout! :(\n\r");
}
printk("Floppy 6\n\r");
irq_wait(FLOPPY_IRQ, 0);
}
while doing "timer_wait(10);", instead of waiting, it does an inifnite loop like "JMP $".
If you need more code I'll post it.
Every help will be appreciated.