Writing to a Register in C

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
FunnyGuy9796
Member
Member
Posts: 61
Joined: Tue Sep 13, 2022 9:29 pm
Libera.chat IRC: FunnyGuy9796

Writing to a Register in C

Post by FunnyGuy9796 »

I am trying to set up the APIC and have come across an issue. I am having trouble to set the Spurious Interrupt Vector Register bit 8. I am not sure exactly how the 'write_reg' function works. I know I have asked this question before but I can't seem to figure out how to write to the register.

Code: Select all

write_reg(0xF0, ReadRegister(0xF0) | 0x100);
Help would be much appreciated!
Octocontrabass
Member
Member
Posts: 5562
Joined: Mon Mar 25, 2013 7:01 pm

Re: Writing to a Register in C

Post by Octocontrabass »

The wiki example code you're blindly copying uses read/write functions that automatically add the APIC base address to the given register offset.

The code in your other thread requires the full virtual address of the register.
Post Reply