flat assembler
Message board for the users of flat assembler.

Index > OS Construction > GDTR and GDT

Author
Thread Post new topic Reply to topic
system error



Joined: 01 Sep 2013
Posts: 670
system error 26 Jul 2017, 18:40
I don't know where to ask this question. This has nothing to do with OS construction btw. Just out of curiosity.

I was told that GDTR is 10 bytes for 64-bit CPU and 6 bytes for 32-bit. I got some informative returns when I used it from 64-bit, but zeros from 32-bit. Any particular reason why? I tested this on Win64.

Code:
mov rax,gdt_val
sgdt [rax]

gdt_val rb 16

Returns: BASE=0xFFFFxxxxxxxxxxxx, LIMIT=87    


But the same 32-bit setting returns nothing.

Code:
mov eax,gdt_val
sgdt [eax]

gdt_val rb 8

Returns: BASE=0, LIMIT=0    


Did I miss something?
Post 26 Jul 2017, 18:40
View user's profile Send private message Reply with quote
Azagaros



Joined: 18 Jan 2013
Posts: 26
Azagaros 02 Aug 2017, 22:37
The 64 bit version does not hardware task switching so the four bytes of the TSS of the GDT entry is consumed to accommodate the 64 bit address. OSdev wiki pages have a pretty good difference in the 32 bit models and the 64 bit models.
Post 02 Aug 2017, 22:37
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.