In the latest kernel, GDT is defined in at least 3 separate files.
arch/x86/include/asm/desc_defs.harch/x86/include/asm/desc.harch/x86/include/asm/segment.h
The structure of the main GDT seems to be defined in arch/x86/include/asm/segment.h around line 91 . There are comments above the line above.
The populated table is loaded into arch/x86/include/asm/desc.h using the static inline void native_load_gdt(const struct desc_ptr *dtr) function, which simply calls the assembly operation code lgdt . This is consistent with the way old kernels load the table into the processor. See line 303 here . However, I cannot find any calls to this function in the code base. Someone please help figure this out.
Also, I cannot find the equivalent of determining the constants of the actual table, as in line 479 in newer kernels.
source share