Why kernel reloads these segment registers, such as ds, es, .etc in startup_32 ?
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
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@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
participants (1)
-
Jacky