Re: X86: Question about GDT loading

Brian Gerst <[email protected]>
Newsgroups gmane.linux.kernel
Message-ID <CAMzpN2iSvB4jRhbzpmRuuOt1rZAr8+V9u-5j0pyPYxfLx8kzzg@mail.gmail.com>
On Sun, Aug 16, 2026 at 4:58 PM Alexandre <[email protected]> wrote:
>
> I was tracing the execution of the file
> "arch/x86/boot/compressed/head_32.S" with gdb when I noticed that the
> address used for the GDT in the GDTR structure pointed to the GDTR
> itself.
>
> This is weird because it would make the GDTR an entry in the GDT.

The first slot of the GDT is unused, as it corresponds to the null
selector.  So it's a common trick to use that space for the GDT
descriptor, at least on 32-bit.  There isn't enough space for a 64-bit
base address.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.