apic base

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
itisiuk
Member
Member
Posts: 98
Joined: Mon Mar 24, 2008 1:46 pm

apic base

Post 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??
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: apic base

Post 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?)
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
itisiuk
Member
Member
Posts: 98
Joined: Mon Mar 24, 2008 1:46 pm

Re: apic base

Post 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.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: apic base

Post 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
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: apic base

Post 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
itisiuk
Member
Member
Posts: 98
Joined: Mon Mar 24, 2008 1:46 pm

Re: apic base

Post 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
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: apic base

Post 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 !
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: apic base

Post 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.
itisiuk
Member
Member
Posts: 98
Joined: Mon Mar 24, 2008 1:46 pm

Re: apic base

Post by itisiuk »

great, well i just got that fixed and working

thanks guys` :D

now onto finishing threading
Post Reply