Page 1 of 1

apic base

Posted: Sun Feb 15, 2009 9:03 am
by itisiuk
while im busy implelmenting threading ive decided to work on multiprocessing too.
so far everything has worked apart from accessing the apic base adress which is at 0xfee00000

i found that need to map this address in my pgdir for it to work.

however i carnt find the physical address which this is mapped to.

the only thing i can think of is to map 0xfee00000 to a random physical address in the pgdir
so that i can access it.

ive tryed reading the intel docs and the information on msrs and apic on osdev but i dont really
understand how the base address is mapped still.
can anyone help me on this??

Re: apic base

Posted: Sun Feb 15, 2009 9:44 am
by Combuster
Moved from theory since it doesn't belong there.

The APIC is virtually located between the CPU and the system bus - that means that it reacts as a normal device at a certain physical address (segmentation and paging are thus applied beforehand!). On the other hand, it is in front of the FSB so it is not accessible for other CPUs. That also means, 0xfee00000 IS the physical address. What virtual address maps to that is your call.

So, if you access 0xfee00000 from one (logical) CPU, you get the APIC that belongs to that CPU. If some other device happens to exist at the same address, you will not be able to access it.

While the APIC has a default location, there is a MSR that you can use to set the physical address the attached APIC will be responding to. You shouldn't normally move that address since you can render other devices inacessible, and you'd need to be aware of the caching consequences. Not to mention, moving the APIC is not supported on older CPUs.

Hope that makes things a bit clearer. It might help if you are more specific in your question (what are you trying to do and in what way?)

Re: apic base

Posted: Sun Feb 15, 2009 10:24 am
by itisiuk
basically im just trying to access the 0xfee00000 address and i keep getting a page fault.

it is so that i can identify which cpu is causing an interupt. like in the xv6 code
from http://pdos.csail.mit.edu/6.828/2007/


anyway, ive just mapped some mem from physicall address of 8mb to 12mb
to the location of 0xfee00000 and now im not getting the page fault when
trying to access it.
but i dunno if it works yet cos i havent written the boot up code for the
other processors yet.

Re: apic base

Posted: Mon Feb 16, 2009 8:48 am
by jal
itisiuk wrote:basically im just trying to access the 0xfee00000 address and i keep getting a page fault.
You do understand what causes a page fault, or?


JAL

Re: apic base

Posted: Mon Feb 16, 2009 9:39 am
by AJ
Hi,

The misunderstanding here is that the APIC is at 0xFEE00000 physical. You can map this to anywhere you like in your virtual address space. You are attempting to do this the other way around.

Cheers,
Adam

Re: apic base

Posted: Mon Feb 16, 2009 12:05 pm
by itisiuk
oh ****
well, that was another obvious mistake.
my bad. :oops:

is this the APIC mapped at that base even if you only have 128Mb then??

cheers

Re: apic base

Posted: Mon Feb 16, 2009 12:33 pm
by stlw
itisiuk wrote:oh ****
well, that was another obvious mistake.
is this the APIC mapped at that base even if you only have 128Mb then??
cheers
Even if you have 8M !

Re: apic base

Posted: Mon Feb 16, 2009 12:36 pm
by JohnnyTheDon
itisiuk wrote: is this the APIC mapped at that base even if you only have 128Mb then??
The processor doesn't know how much RAM you have. And in the end, it makes it easier because you can use the APIC without knowing the ammount of ram.

Re: apic base

Posted: Mon Feb 16, 2009 1:32 pm
by itisiuk
great, well i just got that fixed and working

thanks guys` :D

now onto finishing threading