Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Dec 1995 20:40:17 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        current@freebsd.org, terry@lambert.org
Subject:   Re: What is this thing in locore.s?
Message-ID:  <199512120940.UAA25385@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512120940.UAA25385>