Hi everyone, I am learning OS development and come across a questsion.
When handling interrupts the book I choose tells me to use 8295A and IDT. I wrote some code according to the book, init 8295A and IDT. The code runs well. (The interrupt can be triggered and the handler is calleld) But the point is I think the code should report error.
The environment is bochs 2.6.7 with Pentium 4 cpu. The cpu uses xAPIC instead of 8295A. So I think the code I wrote for 8295A should not work on the platform, but it does work. I have searched a lot and it seems that they are not compatible.
So why my code for 8295A can run on the xAPIC platform? Does this mean Pentium 4 cpu still have 8295A inside, and how about the newer cpus?
Note: From the Intel manual I know APIC can be disabled but in my code I don't do this and I don't even know what will happen if APIC is disabled. And the code I wrote is compiled into a com file running on freedos since I have not written a complete boot loader. The book tells me right now it is OK to treat it as a com file on freedos.
Sorry if the question is stupid and thanks everyone in advance.
Code for 8295A runs well on xAPIC
Re: Code for 8295A runs well on xAPIC
Hi,
Cheers,
Brendan
It doesn't support xAPIC instead of 8295A - it supports xAPIC/IO APIC in addition to 8295A/PIC chips. When you first boot, the system is using PIC chips (for backward compatibility). To use IO APIC you need to disable the PIC chips and enable/configure the IO APIC.angwer wrote:The environment is bochs 2.6.7 with Pentium 4 cpu. The cpu uses xAPIC instead of 8295A. So I think the code I wrote for 8295A should not work on the platform, but it does work. I have searched a lot and it seems that they are not compatible.
The IO APIC and/or PIC chip is in the chipset, not in the CPU. Almost all newer chipsets still provide the PIC chips; however there are some (designed for UEFI only with none of the old stuff needed for backward compatibility) which do not have PIC chips.angwer wrote:Does this mean Pentium 4 cpu still have 8295A inside, and how about the newer cpus?
Don't forget that there's 2 separate pieces - the IO APIC (which mostly does what the PIC chip did, but has more IRQ lines and supports multi-CPU properly) in the chipset; plus the local APIC in the CPU (which receives interrupts from the IO APIC, and allows you to send "inter-processor interrupts" from one CPU to another, and has other "miscellaneous" stuff built into it like the local APIC timer).angwer wrote:Note: From the Intel manual I know APIC can be disabled but in my code I don't do this and I don't even know what will happen if APIC is disabled. And the code I wrote is compiled into a com file running on freedos since I have not written a complete boot loader. The book tells me right now it is OK to treat it as a com file on freedos.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Code for 8295A runs well on xAPIC
Thanks to Brendan. You do solve my problem. Thanks!!!!!!!!!!!!!!!
By the way, it is the first time to use osdev forum. When I want to reply I treat the report this post as reply this post. Shamed!!! And sorry to Brendan, I report the answer that helps me....
By the way, it is the first time to use osdev forum. When I want to reply I treat the report this post as reply this post. Shamed!!! And sorry to Brendan, I report the answer that helps me....