Read APIC register

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
User avatar
pini
Member
Member
Posts: 26
Joined: Wed Oct 18, 2006 5:12 am
Location: Nancy, France

Read APIC register

Post by pini »

APIC registers are 64-bits. I'm trying to read them on a 32-bit machine.

I first tried to let gcc deal with "unsigned long long" types, but the generated code does 2 32-bits reads. Say I want to read register at addres A, the code reads 32 bits at A and 32 bits at A+4, which is invalid for reading an APIC register (misaligned read).

So I tried to read with the "movq" instruction, but bochs gives an error "read spans 32-bits boundary" (sic).

So, must I assume that only the lower 32-bits of each APIC register can be read on a 32-bits machine ?
Don't think you can. Know you can.
exkor
Member
Member
Posts: 111
Joined: Wed May 23, 2007 9:38 pm

Post by exkor »

LAPIC has 32 bit regs.

IOAPIC has 64bit regs which are accessed using 32bit read/writes.
you write dword to fec00000h (write 10h for low 32bits, or 11h for high 32bits of 1st entry) then you read/write data(low/high 32bits of the redirection entry) from fec00010h(IOWIN).

any other APIC?
User avatar
pini
Member
Member
Posts: 26
Joined: Wed Oct 18, 2006 5:12 am
Location: Nancy, France

Post by pini »

Ok, mine is a LAPIC. I must have misread that part in the Intel manual.

Thanks for the tip.
Don't think you can. Know you can.
exkor
Member
Member
Posts: 111
Joined: Wed May 23, 2007 9:38 pm

Post by exkor »

LocalAPIC: "Wider register (64bit or 128bit) should be accessed using multiple 32bit loads...", Section 8.4.1 after figure 8.4("Local APIC Structure")
I never had to deal with TMR,ISR,IRR I think they are for lapic.
Post Reply