【发布时间】:2017-01-25 22:16:16
【问题描述】:
由于某种原因,IRQ 6 从未在我的 Qemu、Bochs、VMWare 或 VirtualBox 仿真器中运行。我需要某种类型的虚拟软盘驱动器或其他东西吗?这是我的 IRq6 处理程序:
void i86_flpy_irq (struct regs *r) {
//! irq fired
_FloppyDiskIRQ = 1;
printf("IRQ 6 HIT");
}
它从不说“IRQ 6 HIT”,不仅如此,在我调用内核的 irq6 的安装函数中:
void flpydsk_install (int irq) {
//! install irq handler
install_handler_irq (irq, i86_flpy_irq);
//! initialize the DMA for FDC
flpydsk_initialize_dma ();
//! reset the fdc
flpydsk_reset ();
//! set drive information
//flpydsk_drive_data (13, 1, 0xf, true);
}
如您所见,我调用了一个重置软盘驱动器控制器的函数。让我们看看那个函数:
void flpydsk_reset () {
uint32_t st0, cyl;
_FloppyDiskIRQ = 0;
//! reset the controller
flpydsk_disable_controller ();
flpydsk_enable_controller ();
//flpydsk_wait_irq ();
printf("STARTED WAITING");
while(_FloppyDiskIRQ == 0);
_FloppyDiskIRQ = 0;
printf("ENDED WAITING FOR IRQ");
//! send CHECK_INT/SENSE INTERRUPT command to all drives
for (int i=0; i<4; i++)
flpydsk_check_int (&st0,&cyl);
//! transfer speed 500kb/s
flpydsk_write_ccr (0);
//! pass mechanical drive info. steprate=3ms, unload time=240ms, load time=16ms
flpydsk_drive_data (3,16,240,true);
//! calibrate the disk
flpydsk_calibrate ( _CurrentDrive );
}
您可以在上面看到,我通过检查 _FloppyDiskIRQ 是否为 1 来等待 IRQ 完成,这是我在它命中时设置的。我还注意到this 常见错误。代码永远不会通过 while() 循环,因为 IRQ6 永远不会触发。是否有一个原因?如何修复它以便 IRQ 6 可以触发?我想我必须在我的模拟器中添加一些东西(比如我为我的 ATA 控制器添加了一个虚拟硬盘)。
我还通过打印截至目前只有 0、1、12 的 IRQ 进行测试(第 6 次)...
extern "C" void irq_handler(struct regs *r)
{
/* This is a blank function pointer */
regs_func handler;
/* Find out if we have a custom handler to run for this
* IRQ, and then finally, run it */
handler = irq_routines[r->int_no];
if (handler)
{
handler(r);
}
printf("%d,",r->int_no);
//irq_taskmanager->Schedule((CPUState*)r);
/* If the IDT entry that was invoked was greater than 40
* (meaning IRQ8 - 15), then we need to send an EOI to
* the slave controller */
if (r->int_no >= 8)
{
p8b_irq.out(0x20,0xA0);
}
/* In either case, we need to send an EOI to the master
* interrupt controller too */
p8b_irq.out(0x20, 0x20);
}
【问题讨论】:
-
对于否定这个问题并将其关闭为不清楚的人?这怎么不清楚?我显然在问为什么
IRQ6 Never Fire , and How can i fix?怎么能比这更清楚? -
Stackoverflow 不是我之前试图指出的调试服务。
-
@MichaelPetch 我从来没有要求调试..我只是问我需要在我的 VM 中启用什么才能触发 IRQ 6..如果这不是一个有效的问题,为什么还要有 osdev先贴标签?对我来说,这是一个 100% 的好问题。
-
@MichaelPetch 我已经看了一百万次了
-
@MichaelPetch 哦,是的,我忘了接受 anwser .. 我做了谢谢。我现在正在做文件管理..完全是我自己的计划。大部分时间我都在chat.stackoverflow.com/rooms/85048/teenage-territory聊天室,如果你想在那里聊天,请随意;)