Why kernel reloads these segment registers, such as ds, es, .etc in startup_32 ?

Jacky jackyclivia at 163.com
Thu May 2 04:14:23 EDT 2013


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/03c994b5/attachment.html 


More information about the Kernelnewbies mailing list