From: David Gibson <david@gibson.dropbear.id.au>
To: devel list <linuxppc-dev@lists.linuxppc.org>
Subject: Re: get_pteptr mystery
Date: Wed, 8 Jan 2003 10:05:53 +1100 [thread overview]
Message-ID: <20030107230553.GA7851@zax.zax> (raw)
In-Reply-To: <1041896173.1207.49.camel@granite.austin.ibm.com>
On Mon, Jan 06, 2003 at 05:35:58PM -0600, Hollis Blanchard wrote:
>
> On Wed, 2002-12-18 at 18:06, Hollis Blanchard wrote:
> >
> > I need to mark the first kernel code page writeable because I need to
> > write to 0xc00000fc. Can someone tell me why the following code fails?
> > get_pteptr returns 0.
> >
> > addr = 0xc00000fc;
> > if (0 != get_pteptr(&init_mm, addr, &ptep)) {
> > /* mark it writable */
> > *ptep = pte_mkwrite(*ptep);
> > /* flush this page from hw TLB */
> > flush_tlb_range(&init_mm, addr, addr+1);
> > } else {
> > printk(KERN_ERR "couldn't get PTE!\n");
> > }
>
> FYI: whoever added HIGHMEM support to mm/init.c:paging_init() already
> had this problem, and solved it by calling map_page(addr, 0, 0) first.
>
> I guess that the page is really not present in the software pagetable,
> and the map_page call forces it in:
> map_page(PKMAP_BASE, 0, 0); /* XXX gross */
> pkmap_page_table = pte_offset(pmd_offset(pgd_offset_k(PKMAP_BASE),
> PKMAP_BASE), PKMAP_BASE);
> (get_pteptr just calls pte/pmd/pgd_offset with some error checking.)
Erm.. be very careful about this in 2.5. Since we use a large-page
mapping for that address there, it won't in fact have a "normal" PTE.
So attempting to frob it could cause bad things to happen.
--
David Gibson | For every complex problem there is a
david@gibson.dropbear.id.au | solution which is simple, neat and
| wrong.
http://www.ozlabs.org/people/dgibson
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
prev parent reply other threads:[~2003-01-07 23:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-19 0:06 get_pteptr mystery Hollis Blanchard
2002-12-19 0:23 ` Paul Mackerras
2002-12-19 0:41 ` Hollis Blanchard
2003-01-06 23:35 ` Hollis Blanchard
2003-01-07 23:05 ` David Gibson [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=20030107230553.GA7851@zax.zax \
--to=david@gibson.dropbear.id.au \
--cc=linuxppc-dev@lists.linuxppc.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).