Linux GDT

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
HSJ
Posts: 1
Joined: Tue Jul 26, 2016 1:35 am

Linux GDT

Post by HSJ »

I am reading through Linux Kernel code.
I have one doubt regarding Linux GDT. Why linux setup GDT two times.
In file http://lxr.free-electrons.com/source/arch/x86/include/asm/segment.h#L17
Linux specify one GDT
/* Simple and small GDT entries for booting only: */

#define GDT_ENTRY_BOOT_CS 2
#define GDT_ENTRY_BOOT_DS 3
#define GDT_ENTRY_BOOT_TSS 4
#define __BOOT_CS (GDT_ENTRY_BOOT_CS*8)
#define __BOOT_DS (GDT_ENTRY_BOOT_DS*8)
#define __BOOT_TSS (GDT_ENTRY_BOOT_TSS*8)

It setup the above GDT in http://lxr.free-electrons.com/source/arch/x86/boot/pm.c#L123

Again after some time it set up another GDT with 32 entries?

Or if I am wrong then, where Kernel set up the 32 entry GDT (one specified in Understanding Linux Kerenel 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
Post Reply