Re: BOOT_CS

Coywolf Qi Hunt
2004-02-21T12:44:19Z

H. Peter Anvin wrote:
> Anyone happen to know of any legitimate reason not to reload %cs in
> head.S? I think the following would be a lot cleaner, as well as a
> lot safer (the jump and indirect branch aren't guaranteed to have the
> proper effects, although technically neither should be required due to
> the %cr0 write):
>
> @@ -117,10 +147,7 @@
> movl %cr0,%eax
> orl $0x80000000,%eax
> movl %eax,%cr0 /* ..and set paging (PG) bit */
> - jmp 1f /* flush the prefetch-queue */
> -1:
> - movl $1f,%eax
> - jmp *%eax /* make sure eip is relocated */
> + ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip
> */
> 1:
> /* Set up the stack pointer */
> lss stack_start,%esp
>
>
> I've been doing some cleanups in head.S after making the early page
> tables dynamic.
>
> -hpa
> -

IMHO, why bother to re-reload %cs again?

In setup.S, %cs is reloaded already. The enable paging code maps the
address identically, so %cs already contains the proper selector.

Coywolf

--
Coywolf Qi Hunt
Admin of http://GreatCN.org and http://LoveCN.org