0

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 read and write from the first byte to byte 0xFFFFFFFF in memory (any portion in memory)

; null descriptor 
    dd 0                ; null descriptor--just fill 8 bytes with zero
    dd 0 

; code descriptor:          ; code descriptor. Right after null descriptor
    dw 0FFFFh           ; limit low
    dw 0                ; base low
    db 0                ; base middle
    db 10011010b            ; access
    db 11001111b            ; granularity
    db 0                ; base high

; data descriptor:          ; data descriptor
    dw 0FFFFh           ; limit low (Same as code)
    dw 0                ; base low
    db 0                ; base middle
    db 10010010b            ; access
    db 11001111b            ; granularity
    db 0                ; base high

Now my purpose is to create two separate regions using GDT .For example , first 512B as one region and next 512B as another region and leaving the space left as unused.

What can i do for that ?

Knight Rider
  • 123
  • 1
  • 6

1 Answers1

1

you can just change where your base address & limit registers . so in the example you gave

for code descriptor .base = 0x0 .limit = 0x200 //512 byte

for data descriptor .base = 0x200 .limit = 0x200

then you have the rest of your memory after the 1 KB empty

you can check "http://wiki.osdev.org/GDT_Tutorial" for more explanation

d.tantawy
  • 11
  • 2