Page 1 of 1

allocate ring3 pages

Posted: Wed May 20, 2009 6:39 am
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.

Re: allocate ring3 pages

Posted: Wed May 20, 2009 8:20 pm
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....

Re: allocate ring3 pages

Posted: Thu May 21, 2009 2:18 am
by blackoil
yes, separated PD is good for multi-task, I am experimenting single task now.

Re: allocate ring3 pages

Posted: Thu May 21, 2009 2:53 am
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?

Re: allocate ring3 pages

Posted: Thu May 21, 2009 3:26 am
by kop99
JamesM,
you can learn about the accessing kernel on a ring switch from book "Understanding The Linux Kernel"....

Re: allocate ring3 pages

Posted: Thu May 21, 2009 3:43 am
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