9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] about KTZERO mismatch in mkfile and mem.h
@ 2014-01-21  1:20 Yoann Padioleau
  2014-01-21  1:29 ` erik quanstrom
  2014-01-21  1:36 ` Steven Stallion
  0 siblings, 2 replies; 3+ messages in thread
From: Yoann Padioleau @ 2014-01-21  1:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hi,

in 9/pc/mem.h it says:
/*
 *  Address spaces
 */
#define	KZERO		0xF0000000		/* base of kernel address space */
#define	KTZERO		(KZERO+0x100000)	/* first address in kernel text - 9load sits below */


and in 9/pc/mkfile:
# must match mem.h
APBOOTSTRAP=0xF0003000
KTZERO=0xF0100020


so why the difference? what is this additional 20 for KTZERO?




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] about KTZERO mismatch in mkfile and mem.h
  2014-01-21  1:20 [9fans] about KTZERO mismatch in mkfile and mem.h Yoann Padioleau
@ 2014-01-21  1:29 ` erik quanstrom
  2014-01-21  1:36 ` Steven Stallion
  1 sibling, 0 replies; 3+ messages in thread
From: erik quanstrom @ 2014-01-21  1:29 UTC (permalink / raw)
  To: 9fans

On Mon Jan 20 20:21:28 EST 2014, pad@fb.com wrote:
> Hi,
>
> in 9/pc/mem.h it says:
> /*
>  *  Address spaces
>  */
> #define	KZERO		0xF0000000		/* base of kernel address space */
> #define	KTZERO		(KZERO+0x100000)	/* first address in kernel text - 9load sits below */
>
>
> and in 9/pc/mkfile:
> # must match mem.h
> APBOOTSTRAP=0xF0003000
> KTZERO=0xF0100020
>
>
> so why the difference? what is this additional 20 for KTZERO?

ah, good question.

KZERO is the lowest virtual address that's part of the kernel proper.
in the mkfile, the address of the first instruction is wanted to pass to
the linker.  this is KTZERO in the mkfile.  in mem.h, the page containing
the first instruction is wanted for mmu mapping, etc., and that's a little
different.  it's a bit fast-and-loose, and perhaps incorrect  to use the
same name for both.  perhaps
	#define KTPZERO	ROUNDDN(KTZERO, BY2PG)
would have been less confusing.

- erik



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] about KTZERO mismatch in mkfile and mem.h
  2014-01-21  1:20 [9fans] about KTZERO mismatch in mkfile and mem.h Yoann Padioleau
  2014-01-21  1:29 ` erik quanstrom
@ 2014-01-21  1:36 ` Steven Stallion
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Stallion @ 2014-01-21  1:36 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Mon, Jan 20, 2014 at 7:20 PM, Yoann Padioleau <pad@fb.com> wrote:
> Hi,
>
> in 9/pc/mem.h it says:
> /*
>  *  Address spaces
>  */
> #define KZERO           0xF0000000              /* base of kernel address space */
> #define KTZERO          (KZERO+0x100000)        /* first address in kernel text - 9load sits below */
>
>
> and in 9/pc/mkfile:
> # must match mem.h
> APBOOTSTRAP=0xF0003000
> KTZERO=0xF0100020
>
>
> so why the difference? what is this additional 20 for KTZERO?

pc kernels are a.out boot images. The extra 32 bytes are for the image
header. The difference varies by kernel - raw and uImage kernels don't
suffer from this; ELF as well depending on how smart the boot loader
is.

Steve



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-21  1:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-21  1:20 [9fans] about KTZERO mismatch in mkfile and mem.h Yoann Padioleau
2014-01-21  1:29 ` erik quanstrom
2014-01-21  1:36 ` Steven Stallion

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).