Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
this patch implements x2APIC support. it changes the order of processor initialization bringing up multiprocessor and calling
mpmain
much earlier and moving some peripheral initialization intopostinit
which still runs on CPU 0. it's more of an FYI at this point. there are a couple of ancillaries changes included in the branch such as addingsudo
to the loop filesystem setup and adding-p
tomkdir
as they were required to getmake binaries
to work locally. there is also a change to make usetypedef long long uint64
otherwiselong
compiles as a 32-bit type with-m32
.irq_register_handler
andget_registered_handler
were made to subtractT_IRQ0
so that they are consistent with the use of IRQ numbers in the other interrupt APIs. it was necessary to changeget_registered_handler
as otherwise, it would not find traps, noting that dynamic IRQs were not in use. this small patch can be added on top of this branch to test IPI support by creating a dynamic IRQ function and sending some IPIs inmpmain
.identcpu
andlapicinit
have been modified to log CPU model and APIC details together during processor initialization. TSC frequency is detected on bare metal, in VMWare and KVM but it may be necessary to manually provide the TSC frequency with KVM.microdelay
has been updated to use the TSC base frequency.note
run.sh
has been changed to add a-x
flag which passes-machine pc,accel=kvm,kernel-irqchip=on -cpu host,vmware-cpuid-freq=on,tsc-frequency=2600000000
to qemu which will enable the KVM kernel module x2APIC support.here is the boot log after applying the patches in this branch (tested with and without x2APIC):