mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cesar Suga <sartre@linuxbr.com>
To: Jason Yan <jasonyanjk@yahoo.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: paging question
Date: Wed, 20 Feb 2002 16:55:54 -0300 (BRT)	[thread overview]
Message-ID: <Pine.LNX.4.40.0202201644440.2737-100000@sartre.linuxbr.com> (raw)
In-Reply-To: <20020220182600.PTIU27257.tomts11-srv.bellnexxia.net@abc337>

On Wed, 20 Feb 2002, Jason Yan wrote:

> I have a question about the code to enable  to initialize page
> tables in linux/arch/i386/head.S

> I search the internet again and again but fail to find any answer
> so far, maybe you gurus can help me out, here it goes:

> 48         cld
> 49         movl $(__KERNEL_DS),%eax
> 50         movl %eax,%ds
> 51         movl %eax,%es
> 52         movl %eax,%fs
> 53         movl %eax,%gs
> 81 /*
> 82  * Initialize page tables
> 83  */
> 84         movl $pg0-__PAGE_OFFSET,%edi /* initialize page tables */
> 85         movl $007,%eax  /* "007" doesn't mean with right to kill, but
> 86                                    PRESENT+RW+USER */
> 87 2:      stosl
> 88         add $0x1000,%eax
> 89         cmp $empty_zero_page-__PAGE_OFFSET,%edi
> 90         jne 2b
>
> I remove the SMP code.  According the setup.S, gdt_table is setup as
> gdt_table:
> 			#.quad 0x0000000000000000;	// null
> 			#.quad 0x0000000000000000;	// not used
> 			#.quad 0x00cf9a000000ffff;	// 0x10 kernel 4GB code at 0x00000000
> 			#.quad 0x00cf92000000ffff;	// 0x18 kernel 4GB data at 0x00000000
>
> 1) So, what's in %eax after line 49 ?  0x0 ?

	As in asm/segment.h (included on arch/i386/kernel/head.S): (i386)

#ifndef _ASM_SEGMENT_H
#define _ASM_SEGMENT_H

#define __KERNEL_CS     0x10
#define __KERNEL_DS     0x18

	uaccess.h specifies another value, but that's KERNEL_DS for user
space memory.

> 2) Isn't __PAGE_OFFSET 0xC0000000 ? what's the result of $pg0-__PAGE_OFFSET ?

	Yes, __PAGE_OFFSET is 0xC0000000. I am not sure, but I think it
initializes the page tables to 8MB here, and the final page tables depend
on the memory size (better seeing pgtable.h)...

	Regards,
	Cesar Suga <sartre@linuxbr.com>



  parent reply	other threads:[~2002-02-20 19:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-20 21:26 Jason Yan
2002-02-20 19:16 ` Richard B. Johnson
2002-02-20 19:55 ` Cesar Suga [this message]
2002-02-21 17:20 ` Gianni Tedesco
  -- strict thread matches above, loose matches on Subject: below --
2001-02-09  5:14 Daniel Stodden
2001-02-09 13:35 ` Rik van Riel
2001-02-09 15:32 ` Jeff Hartmann

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=Pine.LNX.4.40.0202201644440.2737-100000@sartre.linuxbr.com \
    --to=sartre@linuxbr.com \
    --cc=jasonyanjk@yahoo.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®