Linux内核设置GDT的地方

HSJ*_*HSJ 9 operating-system kernel memory-management linux-kernel gdt

我正在阅读 Linux 内核代码。我对 Linux 中的 GDT(全局描述符表)有一些疑问。

我的问题是:

Where Linux Kernel Setup Large GDT?
I know that in pm.c [http://lxr.free-electrons.com/source/arch/x86/boot/pm.c#L123] 
kernel call function setup_gdt() and it set up a small GDT with only three entries. 

Then jumps to protected mode code.
Then where is the code to setup large GDT with 32 entries 

( One specified in Understanding Linux Kernel  https://books.google.co.in/books?id=h0lltXyJ8aIC&pg=PT59&lpg=PT59&dq=linux+kernel+file+gdt&source=bl&ots=gO0lH05fHX&sig=h4X1I6TP_P7JlEwzoCkQk3uztjw&hl=en&sa=X&ei=XFwPVM-WBbOBsQTtiIDIDw&redir_esc=y#v=onepage&q=linux%20kernel%20file%20gdt&f=false  )

Kernel also defined constants for Large GDT set up in segment.h http://lxr.free-electrons.com/source/arch/x86/include/asm/segment.h#L46.
Run Code Online (Sandbox Code Playgroud)

为什么内核使用两步来设置 GDT?

如果我们使用 GRUB 作为引导加载程序,那么 GRUB 还会在 grub-core/kern/i386/realmode.S 中设置一个 GDT。为什么 Linux 会重置这个 GDT?

Jus*_*Man 2

主GDT的布局似乎是在arch/x86/include/asm/segment.h的第91行中定义的。

初始化似乎在 arch/x86/kernel/cpu/common.c 的第 123 行。

但我可能错了。并且不知道为什么内核使用两个步骤来设置GDT。