开发者

How to enable IRQ8 in my OS kernel? [closed]

开发者 https://www.devze.com 2023-03-31 14:07 出处:网络
开发者_开发技巧 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
开发者_开发技巧 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I want to know that, how to enable IRQ8 (RTC) in my own Kernel written in C++. I already have the module for installing interrupt handlers. But after installing IRQ8 interrupt handlers it doesn't generate any interrupt. So how can i enable IRQ8 ? and after enabling it what interrupt it will generate ? I know that RTC generates INT 70h interrupt, but i am installing RTC interrupt handler on int 29h in IDT. So that it's not working.

Please help.

Thank you.


I'm assuming you're working with an x86-based architecture, and if that's so, then you're also working with a 8259A programmable interrupt controller. If that's the case, IRQ8 is located on the second slave PIC, which is typically wired through IRQ2 on the master PIC. You are basically going to have to program IRQ2 on the master PIC to receive the cascaded INT signals from the slave PIC. Next, you are going to have to unmask any masked interrupts on the second slave PIC, which in this case would be IRQ8 where the RTC interrupts are typically wired.

The ports for controlling these two PICs can be found at 0x020 and 0x21 for the master PIC, and 0xA0 and 0xA1 for the slave PIC. There are four different ICWs, or initialization command words that can be used to program these two PIC's. In order to setup cascading, you will need to send a ICW1 to the master PIC at port 0x20, and set the second bit to 1 in order to tell the PIC that it is in cascade mode. You will then need to write the ICW3 value 0x02 to port 0x21 to tell the master pic that it will be receiving the slave INT signals on the second pin from the slave PIC. Finally you will need to program the proper ICW's to the second slave PIC at 0xA0 and 0xA1 in order to unmask and enable the RTC on IRQ8 (i.e., the slave PIC's first interrupt pin). You can also at that time program the slave PIC to request the appropriate interrupt value offset into the IDT where you interrupt handler is located.

There's quite a bit of documentation out there on how to correctly send ICW's (initialization command words) as well as OCW's (operational command words) to each of the PIC's at their respective ports. A lot of these commands are sequential, meaning you will need to follow a couple steps in a specific ordering, since there are 4 ICW's, and 3 OCW's, but you are writing them to only two 8-bit ports for each PIC. For a quick reference on the bit masks for each type, you can refer to http://stanislavs.org/helppc/8259.html, but I would suggest also looking for some additional documentation if you are unfamiliar with programming ports, etc. For example, programming ports requires some assembly ... if you want, you can make some wrappers, but you will need the x86 IN and OUT assembly commands, as well as control of specific registers such as AX, AL, and DX to read and write to a port.

Finally, if none of the above works, you may need to actually parse the Intel MP table in order to figure out how your platform is wired up ...

0

精彩评论

暂无评论...
验证码 换一张
取 消