Code for 8295A runs well on xAPIC

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
angwer
Posts: 15
Joined: Tue Dec 16, 2014 8:02 pm
Location: China

Code for 8295A runs well on xAPIC

Post by angwer »

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.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: Code for 8295A runs well on xAPIC

Post by Brendan »

Hi,
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.
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:Does this mean Pentium 4 cpu still have 8295A inside, and how about the newer cpus?
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: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.
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).


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.
angwer
Posts: 15
Joined: Tue Dec 16, 2014 8:02 pm
Location: China

Re: Code for 8295A runs well on xAPIC

Post by angwer »

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!!! :oops: And sorry to Brendan, I report the answer that helps me....
Post Reply