allocate ring3 pages

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
blackoil
Member
Member
Posts: 146
Joined: Mon Feb 12, 2007 4:45 am

allocate ring3 pages

Post by blackoil »

Hi,

I use the following method to allocate ring3 pages. Does anyone has better solution for this?

PD resides in the first 4k physical memory. kernel & app shares it.
the first 4MB physical memory was pre-paged for kernel.
when page enabled, 0x80000000-0x80001000 is PD area.

when allocate pages for ring3 app, I need to fill its PTEs with pages' physical address.
Assume a ring3 app is 4096 bytes, as PD is unique, only one PT & only one PTE are needed.
In order to access app's PT, I have to map it into kernel space.
User avatar
kop99
Member
Member
Posts: 120
Joined: Fri May 15, 2009 2:58 am

Re: allocate ring3 pages

Post by kop99 »

I think it's better good to use one page directory for one application...
The sharing PD between the kernel and application isn't good idea....
blackoil
Member
Member
Posts: 146
Joined: Mon Feb 12, 2007 4:45 am

Re: allocate ring3 pages

Post by blackoil »

yes, separated PD is good for multi-task, I am experimenting single task now.
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Re: allocate ring3 pages

Post by JamesM »

kop99 wrote:I think it's better good to use one page directory for one application...
The sharing PD between the kernel and application isn't good idea....
How, then, do you access the kernel on a ring switch?
User avatar
kop99
Member
Member
Posts: 120
Joined: Fri May 15, 2009 2:58 am

Re: allocate ring3 pages

Post by kop99 »

JamesM,
you can learn about the accessing kernel on a ring switch from book "Understanding The Linux Kernel"....
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: allocate ring3 pages

Post by AJ »

kop99 wrote:I think it's better good to use one page directory for one application...
The sharing PD between the kernel and application isn't good idea....

you can learn about the accessing kernel on a ring switch from book "Understanding The Linux Kernel"....
Erm - last time I looked, the IA32 linux kernel mapped itself in to the higher gig of memory in each page directory. By your definition, this is "Sharing the PD between the application and kernel". It's also how Windows (IIRC) and most other sensible monolithic kernels do it.

Cheers,
Adam
Post Reply