From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Mon, 20 Jan 2014 20:29:32 -0500 To: 9fans@9fans.net Message-ID: <16573812b745d9101800e21915615766@mikro.quanstro.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] about KTZERO mismatch in mkfile and mem.h Topicbox-Message-UUID: b4198594-ead8-11e9-9d60-3106f5b1d025 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