From owner-freebsd-current Tue Dec 12 01:42:59 1995 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id BAA25293 for current-outgoing; Tue, 12 Dec 1995 01:42:59 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id BAA25267 for ; Tue, 12 Dec 1995 01:42:17 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id UAA25385; Tue, 12 Dec 1995 20:40:17 +1100 Date: Tue, 12 Dec 1995 20:40:17 +1100 From: Bruce Evans Message-Id: <199512120940.UAA25385@godzilla.zeta.org.au> To: current@freebsd.org, terry@lambert.org Subject: Re: What is this thing in locore.s? Sender: owner-current@freebsd.org Precedence: bulk >The following code live in i386/i386/locore.s: >============================================================================= >/* now initialize the page dir, upages, and p0stack PT */ > movl $(1+UPAGES+1),%ecx /* number of PTEs */ > movl %esi,%eax /* phys address of PTD */ > andl $PG_FRAME,%eax /* convert to PFN, should be a NOP */ > orl $PG_V|PG_KW,%eax /* valid, kernel read/write */ > movl %esi,%ebx /* calculate pte offset to ptd */ > shrl $PGSHIFT-2,%ebx > addl %esi,%ebx /* address of page directory */ > addl $((1+UPAGES+1)*NBPG),%ebx /* offset to kernel page tables */ > fillkpt >============================================================================= >What is the purpose of: >============================================================================= > movl %esi,%ebx /* calculate pte offset to ptd */ > shrl $PGSHIFT-2,%ebx > addl %esi,%ebx /* address of page directory */ > addl $((1+UPAGES+1)*NBPG),%ebx /* offset to kernel page tables */ >============================================================================= This initializes %ebx :-). >The kernel boots and runs fine without it -- it doesn't seem to do >anything really useful?!? There are some ifdefs before it. Apparently %ebx is left with the correct value for the case that you use. I think it is left with the correct value for all cases, but this is only true now that the kernel is loaded above 1MB. Previously, in the BDE_DEBUGGER case, %ebx was left pointing to the pte for physical address 0xa0000, while the page dir was either somewhat lower (at KERNend - KERNBASE) or perhaps at 1MB. This depends on the page dir going at (KERNend - KERNBASE). Bruce