Why kernel reloads these segment registers, such as ds, es, .etc in startup_32 ?
Jacky
jackyclivia at 163.com
Thu May 2 04:25:39 EDT 2013
And another confusing:
In uncompressed code,
================
arch/x86/boot/compressed/head_32.S:
ENTRY(startup_32)
...
testb $(1<<6), BP_loadflags(%esi)
jnz 1f
cli
movl $__BOOT_DS, %eax
movl %eax, %ds
movl %eax, %es
...
===============
Kernel already set these segment resisters.
At 2013-05-02 16:14:23,Jacky <jackyclivia at 163.com> wrote:
Hi, All,
Why kernel reloads these segment registers in startup_32 again ? Just liking the following:
=======================
ENTRY(startup_32)
movl pa(stack_start),%ecx
/* test KEEP_SEGMENTS flag to see if the bootloader is asking
us to not reload segments */
testb $(1<<6), BP_loadflags(%esi)
jnz 2f
/*
* Set segments to known values.
*/
lgdt pa(boot_gdt_descr)
movl $(__BOOT_DS),%eax
movl %eax,%ds
...
======================
Considering bootloader, such as GRUB has already load these segments, so why kernel reloads them again while wasting CPU ?
Thanks,
Jacky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130502/bd1228c8/attachment.html
More information about the Kernelnewbies
mailing list