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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxx> 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






_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux