From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Kumar Gala <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, kernel mailz <kernelmailz@googlemail.com>
Subject: Re: 85xx Address space query
Date: Thu, 25 Jun 2009 21:32:34 +1000 [thread overview]
Message-ID: <1245929554.22312.12.camel@pasglop> (raw)
In-Reply-To: <D47FC871-1535-4DBF-8617-6EEA8C180484@kernel.crashing.org>
> > 1. User code executes ioctl
> > 2. interrupt goes to the kernel
>
> On the interrupt the PR changes from 0 -> 1
The other way around actually :-)
> > 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.
You may want to add, to make things clearer, that the HW treats PID 0
specially. Translations in the TLB that have PID (we call it TID in the
TLB entry) 0 match any value of the PID register.
So kernel pages all have TID = 0, which means they are visible to all
processes, but have permissions set such that only the supervisor (ie.
PR = 0) can actually access them. MSR:PR is automatically switched to 0
by the processor when taking an interrupt, allowing the kernel thus to
access both its own pages and the pages of the current process.
Cheers,
Ben.
prev parent reply other threads:[~2009-06-25 11:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-24 9:44 85xx Address space query kernel mailz
2009-06-24 13:15 ` Kumar Gala
2009-06-24 17:46 ` kernel mailz
2009-06-24 22:52 ` Scott Wood
2009-06-25 10:51 ` kernel mailz
2009-06-25 17:32 ` Kumar Gala
2009-06-25 17:52 ` kernel mailz
2009-06-25 17:58 ` Kumar Gala
2009-06-25 19:34 ` Scott Wood
2009-06-25 11:33 ` Benjamin Herrenschmidt
2009-06-25 11:32 ` Benjamin Herrenschmidt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1245929554.22312.12.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=galak@kernel.crashing.org \
--cc=kernelmailz@googlemail.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).