[SOLVED - UPDATED] APIC: can I just don't care?

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
etamponi
Posts: 4
Joined: Tue Apr 29, 2014 8:33 am

[SOLVED - UPDATED] APIC: can I just don't care?

Post by etamponi »

Hi forum members,

this is my very first post, and I hope not to look silly with this (probably) very trivial question, but I looked around on the internet and in the forums for some hours and I haven't found an answer.

UPDATE: I wrote the kernel as in the Bran's Kernel Development Tutorial without disabling the APIC and it worked without problems. This means that the Local APIC adds features but can be used without changing any code if ignored.

I am trying to write my own long mode os, just for fun, and I am trying to understand the exact role of the Local APIC and of the I/O APIC.

I know that in recent intel processor there is a Local APIC that can be used to do fancy things with interrupts like waking a sleeping thread and communicating between cpus. What I cannot understand is:
  • is it enabled when booting up (I think the answer to this one is yes)? If so, can I write code in the same way as not having any APIC?
  • if it is enabled when booting up but I have to know about it, do you know any tutorial or guide on how to get the same functionality of a 8259A PIC? (at least for now, until I have my OS booting up and handling IRQ properly)
  • is the I/O APIC enabled at boot? I think that the answer to this question is no, so that a standard 8259A PIC communicates with the Local APIC through one of the interrupt pins of the cpu.
As far as I understand, the Local APIC can be seen as a layer between the cpu and the interrupt pins (plus other things), so that as far I am not interested in the advanced functionality of the Local APIC, I can just ignore its existence. But in this case, what I do not understand is why in the Intel manual (Chapter 10, Part 3) it says: "Note that the local APIC can be disabled (see Section 10.4.3, “Enabling or Disabling the Local APIC”). This allows an associated processor core to receive interrupts directly from an 8259A interrupt controller.".

Thank you in advance,

Emanuele T.
Last edited by etamponi on Tue Apr 29, 2014 1:55 pm, edited 1 time in total.
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: APIC: if I don't want to use it, can I just don't care?

Post by TylerH »

I may be underestimating the complexity of what you're asking, but try the first 2 sentences here: http://wiki.osdev.org/APIC#Local_APIC_configuration.
etamponi
Posts: 4
Joined: Tue Apr 29, 2014 8:33 am

Re: APIC: if I don't want to use it, can I just don't care?

Post by etamponi »

TylerH wrote:I may be underestimating the complexity of what you're asking, but try the first 2 sentences here: http://wiki.osdev.org/APIC#Local_APIC_configuration.
Thank you for your answer, but I really still don't understand the point. Once you "enabled" the Local APIC, what does actually changes in the standard ISR+IRQs pairing found in almost every tutorial out there about writing a basic kernel?
TylerH
Member
Member
Posts: 285
Joined: Tue Apr 13, 2010 8:00 pm
Contact:

Re: APIC: if I don't want to use it, can I just don't care?

Post by TylerH »

To answer your first question directly, yes it's enabled at boot. To answer the second, just disable it, then you get interrupts directly from an 8259A. This would mean everything you read in tutorials about the old PIC will work and you can ignore the LAPIC until you're ready to use the extra features it provides.
etamponi
Posts: 4
Joined: Tue Apr 29, 2014 8:33 am

Re: APIC: if I don't want to use it, can I just don't care?

Post by etamponi »

TylerH wrote:To answer your first question directly, yes it's enabled at boot. To answer the second, just disable it, then you get interrupts directly from an 8259A. This would mean everything you read in tutorials about the old PIC will work and you can ignore the LAPIC until you're ready to use the extra features it provides.
Thank you very much! I hope to find out some resources on how to use it later :) If you have any link please let me know :)

Emanuele
etamponi
Posts: 4
Joined: Tue Apr 29, 2014 8:33 am

Re: APIC: if I don't want to use it, can I just don't care?

Post by etamponi »

TylerH wrote:To answer your first question directly, yes it's enabled at boot. To answer the second, just disable it, then you get interrupts directly from an 8259A. This would mean everything you read in tutorials about the old PIC will work and you can ignore the LAPIC until you're ready to use the extra features it provides.
Actually, everything works without flaws even if I don't disable the Local APIC. Probably it is set as "legacy mode" until we start changing its settings somehow.

Emanuele
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: [SOLVED - UPDATED] APIC: can I just don't care?

Post by SpyderTL »

Yes, you can ignore the APIC until you need to support multiple processors.
Post Reply