Hi,
JulienDarc wrote:
1) if we are on a uniproc, that is fine, lapic/ioapic won't be enabled
Local APIC is awesome (e.g. the timer alone surpasses everything that's existed before or since, for both precision and overhead). IO APICs are also awesome (e.g. more IRQs and less "PCI IRQ sharing", more flexible IRQ priorities, lower overhead due to being memory mapped, etc). This applies to single CPU systems.
Intel started including a local APIC in Pentium Pro, and all later CPUs include one. Originally it was disabled on desktop systems due to silly compatibility concerns (but left enabled on single CPU servers). In the same way single CPU servers included an IO APIC; and eventually (about 15 years ago if I remember correctly) Microsoft started requiring that the IO APIC and local APIC exist on all computers (including single CPU systems) as part of their "Windows Logo Program".
Basically; for single CPU systems both local APIC and IO APIC should be used if they exist; and for a lot of single CPU systems they do exist (especially if the OS already supports them, for SMP).
JulienDarc wrote:
Those two lines :
// Disable logical interrupt lines.
lapicw( LINT0 , MASKED );
lapicw( LINT1 , MASKED );
Disable the two interrupts lines used by PIC.
That's a very bad hack (local APIC inputs should either be left "as is" or programmed according to what ACPI tells the OS to program them; and you should not diddle with them based on random/idiotic assumptions).
At this point I'd have to ask why you're looking at the XV6 source code. I'm not convinced that it should be trusted for educational use.
Cheers,
Brendan