From: jlight@srcit.stevens.edu (James Light)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Regarding enable paging code and swapper_pg_dir.
Date: Sat, 2 Apr 2011 12:25:35 -0400 [thread overview]
Message-ID: <20110402162534.GB7686@stevens.edu> (raw)
In-Reply-To: <201104021333.21661.mindentropy@gmail.com>
On Sat, Apr 02, 2011 at 01:33:21PM +0530, mindentropy wrote:
> On Saturday 02 Apr 2011 2:49:21 am you wrote:
> > On Sat, Apr 02, 2011 at 01:37:12AM +0530, mindentropy wrote:
> > > Hi All,
> > >
> > > In the code
> > > http://lxr.linux.no/#linux+v2.6.12/arch/i386/kernel/head.S#L186
> > >
> > > I am not able to understand what's the reason for subtracting
> > > swapper_pg_dir with __PAGE_OFFSET(0xc0000000). i.e. movl
> > > $swapper_pg_dir-__PAGE_OFFSET Shouldn't it be movl $swapper_pg_dir,
> > > %eax?
> > >
> > > Thanks.
> > >
> > > _______________________________________________
> > > Kernelnewbies mailing list
> >
> > I'm no expert here, but I think the reason that it is coded that way has to
> > do with the fact that the swapper_pg_dir is defined to be the value that
> > will be used once the CPU has switched to Protected Mode, but this asm
> > code in head.S is executing while the processes is in Real Mode.
> >
> > The instruction that enables paging and protected mode addressing is on
> > line 190, I believe.
> >
> > -James
>
> Yes but why the subtraction with __PAGE_OFFSET?
To put the physical address into cr3 later.
$swapper_pg_dir is not the PHYSICAL address of the PGD.
So they have to subtract 0xc0000000 (kernel code segment base linear address)
from that the get the physical address as the logical address can not be used
yet because the paging unit isn't enabled yet.
Again, my understanding may be wrong. As I said before, I'm just learning this
as well.
-James
next prev parent reply other threads:[~2011-04-02 16:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 20:07 Regarding enable paging code and swapper_pg_dir mindentropy
[not found] ` <20110401211921.GH23673@stevens.edu>
[not found] ` <201104021333.21661.mindentropy@gmail.com>
2011-04-02 16:25 ` James Light [this message]
2011-04-02 16:31 ` James Light
2011-04-02 17:48 ` mindentropy
2011-04-02 20:52 ` James Light
2011-04-03 20:54 ` mindentropy
2011-04-04 21:07 ` mindentropy
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=20110402162534.GB7686@stevens.edu \
--to=jlight@srcit.stevens.edu \
--cc=kernelnewbies@lists.kernelnewbies.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).