I have been staring blind into a small bug. Cannot seem to really understand what is wrong..
Bochs says:
The function that causes this message is my apicWaitReady that checks for ICR_BUSY in the ICR1 register.. Basically a while loop.00105619653i[APIC0] warning: misaligned APIC access. addr=0x00000000fee00301
Code: Select all
void apicWaitReady() {
kprintf(": Waiting for APIC ready\n");
kprintf("%.8x\n",apicaddr);
kprintf("%.8x\n",APIC_REG_ICR1);
memReadFrom(apicaddr + APIC_REG_ICR1);
while(memReadFrom(apicaddr + APIC_REG_ICR1) & APIC_ICR_BUSY) {
// Wait for apic to become ready
}
kprintf("%.8x\n",apicaddr);
kprintf("%.8x\n",APIC_REG_ICR1);
}
apicaddr is defined globaly and the helper function memReadFrom looks like this; I also made apicaddr volatile..
GCC optimizations are -O0 so they are disabled. Same issue goes for -O1 to -O3 so basically its a common problem.
^- This was not correct. I had defined -02.. When setting to -O0 it works without issue.. Hmm..
Code: Select all
volatile dword apicaddr;
dword memReadFrom(dword addr) {
return *((dword *) addr);
}
Next step now is singlestepping the while-loop and checking what is going on..
regards
Thomas