85xx Address space query

kernel mailz kernelmailz at googlemail.com
Thu Jun 25 03:46:08 EST 2009


On Wed, Jun 24, 2009 at 6:45 PM, Kumar Gala<galak at kernel.crashing.org> wrote:
>
> On Jun 24, 2009, at 4:44 AM, kernel mailz wrote:
>
>> Hi,
>>
>> I am a newbie, trying to learn but have a few queries, nice if you could
>> respond
>> For linux on 85xx systems...
>>
>> (a) Kernel code runs in PR=0 AS=0 and PID=0, which user space application
>> run in PR=1 AS=0 and PID 1-255.
>> Is this correct.
>
> correct.
>
>> (b) I am writing a small program where the application code opens invokes
>> a ioctl call and passes a buffer pointer ( say 0x10000 in user space)
>> Now the driver code is using copy_from_user.
>> How this works internally ?
>>
>> 1. User code executes ioctl
>> 2. interrupt goes to the kernel
>
> On the interrupt the PR changes from 0 -> 1
>
>> 3. ioctl handler in driver gets invoked
>> The buffer pointer still contains 0x10000.
>>
>> How kernel code running in PR=0 accesses it and does the copy. I am not
>> able to see a address space switch in the asm code of copy_tofrom_user.
>
> There isn't a address space switch.  But address spaces exist at the same
> time.  The user app is given 0..0xc000_0000 and the kernel uses
> 0xc000_0000..0xffff_ffff.
>
Ah Ok, I get it Thanks Kumar

But If the app was running with PID=1, interrupt occurs, kernel code
gets executed in PID=1, how does the kernel handle this ? and goes
back to PID=0, since its translations are all in PID=0

> - k
>


More information about the Linuxppc-dev mailing list