Page 1 of 1
Read/Write x86 Registers
Posted: Sat Oct 29, 2022 1:24 pm
by FunnyGuy9796
I am currently implementing APIC but have come across a minor issue where I cannot quite figure out how to read or write to registers. I know this is a basic question but I just can't figure it out.
Re: Read/Write x86 Registers
Posted: Sat Oct 29, 2022 1:57 pm
by devc1
this is how you setup the apic :
https://wiki.osdev.org/APIC
after that, you will have the physical lapic address that you can just read/write to like normal RAM.
Re: Read/Write x86 Registers
Posted: Sat Oct 29, 2022 2:00 pm
by Octocontrabass
FunnyGuy9796 wrote:I am currently implementing APIC but have come across a minor issue where I cannot quite figure out how to read or write to registers.
Which registers are you talking about? There are a lot of those!
If you mean the APIC registers, by default they're ordinary MMIO. The ACPI MADT will tell you the address. If you enable x2APIC mode, they're MSRs instead, and you can access them using RDMSR and WRMSR.