Questions tagged [gdt]

The Global Descriptor Table or GDT is a data structure used by Intel x86-family processors

Starting with the 80286 in order to define the characteristics of the various memory areas used during program execution, including the base address, the size and access privileges like executability and writability. These memory areas are called segments in Intel terminology.

The GDT can hold things other than segment descriptors as well. Every 8-byte entry in the GDT is a descriptor, but these can be Task State Segment (or TSS) descriptors, Local Descriptor Table (LDT) descriptors, or Call Gate descriptors. The last one, Call Gates, are particularly important for transferring control between x86 privilege levels although this mechanism is not used on most modern operating systems.

Loading a selector into a segment register automatically reads the GDT or the LDT and stores the properties of the segment inside the processor itself. Subsequent modifications to the GDT or LDT will not be effective unless the segment register is reloaded.

enter image description here

GDT in 64-bit

The GDT is still present in 64-bit mode; a GDT must be defined, but is generally never changed or used for segmentation. The size of the register has been extended from 48 to 80 bits, and 64-bit selectors are always "flat"

102 questions
0
votes
1 answer

why real mode applications cannot be run in a protected mode?

I was studying this real to protected mode transition. I had a doubt whether real to protected mode can happen without loading ldt and idt but by loading gdt. With that on one side, a second doubt arised such that why real mode programs cannot be…
Panther Coder
  • 1,058
  • 1
  • 16
  • 43
0
votes
1 answer

NASM how to set label address relative the load address without org

I'm trying to write a bootloader for a kernel. At the moment i'm loading the GDT with assembly but I want to write some C code to generate the GDT(and the IDT) The problem is that the boot sector is always loaded at address 0x7c00 so I need a way to…
Ziamor
  • 493
  • 1
  • 7
  • 11
0
votes
1 answer

Set a breakpoint on GDT/LDT/IDT entery

I'm working on x86 architecture , I would like to set a breakpoint on global descriptor table entry or the interpret descriptor table entry or ldt- it means that, for example, every time a specific entry being read from idt/gdt/ldt a breakpoint will…
IceCube
  • 405
  • 1
  • 5
  • 12
0
votes
1 answer

x86 How to change gdt after it has been already loaded?

I have my idtr addressing defined as gdt_pointer: DW 0;size_of_gdt DD 0;start_of_gdt and I can load it with LGDT [gdt_pointer]. But how can I change the contents of gdt later if I have to? Can I use the LGDT instruction again after setting…
The amateur programmer
  • 1,238
  • 3
  • 18
  • 38
0
votes
1 answer

Are gdt segment are ignored by the CPU?

I am studying Kernel development. Using a book I have come to a point. However, I cannot realy understand the affect of global descriptor table. My GDT is as follows: gdt_star: gdt_null: dd 0x0 dd 0x0 gdt_code: dw 0xffff dw 0x0000 db 0x00…
user2972185
  • 231
  • 3
  • 12
0
votes
0 answers

Understanding boot loader code to set the A20 gate

Okay guys , I just tried to understand the code that helps in accessing the memory above 1Mb . I am writing the required snippet below . I will write what I understood , I just need the confirmation that what I understood is right or not ( I am…
abkds
  • 1,764
  • 7
  • 27
  • 43
0
votes
2 answers

The A20 Line with JOS

The snippet code as following is enable A20 for JOS. It has a problem which confuse for me. The "$0xdf" is a command, not data. It should be out to port 0x64, which is command port. In fact, It port to 0x60, which is data port. Here, exist two…
Gapry
  • 253
  • 1
  • 7
  • 20
0
votes
2 answers

The xv6-rev7 (JOS) GDT

It's very difficult for me to understand GDT (Global Descriptor Table) in JOS (xv6-rev7) For example .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); Why shift right 12? Why AND 0xffff? What do these number mean? What does the formula mean? Can…
Gapry
  • 253
  • 1
  • 7
  • 20
0
votes
1 answer

What is the role of DC bit in GDT?

this is my code : ... data_seg equ os_data-gdt_start code_seg equ os_code-gdt_start ... jmp code_seg:pm_start [BITS 32] pm_start: mov ax,data_seg mov ds,ax mov word [ds:0xb8000],0xC341 it work correctly when dc bit (Third bit of Access…
HamidReza
  • 717
  • 7
  • 17
0
votes
2 answers

GDT Segmented Memory

I am trying to build my own kernel and am now setting up the GDT. I use an assembly file for the loader and calling the kernel that is written in C and am trying to get a GDT working. The kernel boots from GRUB and flushes the GDT setup by GRUB.…
plaknas
  • 274
  • 4
  • 15
0
votes
1 answer

how to create two separate segments in Global Descriptor Table

I have gone through the basics of Global Descriptor Table (GDT) and i have successfully written a "GDT.inc" using asm , so that we can easily include it in our bootloader. As a baby step i have configured the Code Descriptor and Data Descriptor to…
Knight Rider
  • 123
  • 1
  • 6
0
votes
1 answer

What's the meaning of this?(size and offset)

Loading/Storing The IDT is loaded using the LIDT assembly instruction. It expects the location of a IDT description structure: The offset is the virtual address of the table itself. The size is the size of the table subtracted by 1. This structure…
Jimmy
  • 353
  • 3
  • 10
1 2 3 4 5 6
7