What is GDT (Global Descriptor Table) ?

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
fandomas
Posts: 3
Joined: Mon Dec 05, 2016 3:54 pm
Libera.chat IRC: fandomas

What is GDT (Global Descriptor Table) ?

Post by fandomas »

What does the GDT do?
I know that IVT is and for what is used for. But GDT is needed for Protected Mode. What is it and where is useful?
Any nice and practical link would be also useful

Thanks in advance
Fandomas
Last edited by fandomas on Mon Dec 05, 2016 4:42 pm, edited 1 time in total.
User avatar
Ch4ozz
Member
Member
Posts: 170
Joined: Mon Jul 18, 2016 2:46 pm
Libera.chat IRC: esi

Re: What is GDT (Global Descriptor Table) ?

Post by Ch4ozz »

fandomas
Posts: 3
Joined: Mon Dec 05, 2016 3:54 pm
Libera.chat IRC: fandomas

Re: What is GDT (Global Descriptor Table) ?

Post by fandomas »

any more practical ones? (ASM)
StudlyCaps
Member
Member
Posts: 232
Joined: Mon Jul 25, 2016 6:54 pm
Location: Adelaide, Australia

Re: What is GDT (Global Descriptor Table) ?

Post by StudlyCaps »

This what you're after?
http://wiki.osdev.org/GDT_Tutorial

I only just implemented a GDT myself (like 2 weeks back), so I recommend you read the wiki article but I can give you a quick answer to your questions.
Primarily the GDT is an array of elements describing segments, each one identifies a range of memory and a set of permissions for that memory. In protected mode, the segment registers - CS, DS, et al, don't store memory offsets, but offsets into the GDT.
You need to setup a GDT with at least one code segment and one r/w data segment for ring 0 and one code and one data segment for ring 3. If you attempt a switch to protected mode without a valid GDT the processor will attempt to access the code segment, find that there is no valid code segment, and fault.
Beyond that, the GDT can also store Task State Segments, which are used in hardware multitasking, Local Descriptor Tables (legacy memory protection feature) and Call Gate descriptors, used to implement calls across protection rings.
fandomas
Posts: 3
Joined: Mon Dec 05, 2016 3:54 pm
Libera.chat IRC: fandomas

Re: What is GDT (Global Descriptor Table) ?

Post by fandomas »

Thank you very much. Very appreciated. I needed a short answer.
Again thanks.
rgmf
Posts: 17
Joined: Wed Sep 28, 2016 1:45 pm

Re: What is GDT (Global Descriptor Table) ?

Post by rgmf »

fandomas wrote:What does the GDT do?
I know that IVT is and for what is used for. But GDT is needed for Protected Mode. What is it and where is useful?
Any nice and practical link would be also useful

Thanks in advance
Fandomas
I was fighting with GDT several weeks ago and I recommend you reading this blog entry: http://duartes.org/gustavo/blog/post/me ... mentation/

Also, wiki entries like http://wiki.osdev.org/GDT_Tutorial help me a lot, too.

Good lucky.
Post Reply