flat assembler
Message board for the users of flat assembler.

Index > Main > How many bits does the segment register has?

Author
Thread Post new topic Reply to topic
LiuJunfeng



Joined: 28 Nov 2003
Posts: 48
Location: China
LiuJunfeng 04 Apr 2004, 00:15
Someone says segment register is 16-bit in real mode and 32-bit in protected mode, is that right?
Post 04 Apr 2004, 00:15
View user's profile Send private message Reply with quote
Octavio



Joined: 21 Jun 2003
Posts: 366
Location: Spain
Octavio 04 Apr 2004, 07:11
LiuJunfeng wrote:
Someone says segment register is 16-bit in real mode and 32-bit in protected mode, is that right?


no ,is always 16 bits but 'mov eax,ds' is a valid instruction , bits 31-16 are set to 0
Post 04 Apr 2004, 07:11
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 04 Apr 2004, 09:03
16bit indeed - however, there's a "shadow cache", invisible to you, that stores base/limit meaning the CPU doesn't have to consult the LDT/GDT every time a segment is used, only when loaded.
Post 04 Apr 2004, 09:03
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 04 Apr 2004, 15:08
you can treat it as 16bit. In reality it is bigger because of speed optimization, but it beheaves like 16bit. (address of paragraph in real, index to descriptior table in protected mode)
Post 04 Apr 2004, 15:08
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 05 Apr 2004, 20:25
Since the shadow cache is 100% invisible to programmers, whether it be ring3 or ring0 programmers, it "is" 16-bit. Imo it's somewhat weird that you can move a segment register to a 32bit register, since you're never going to get more than the 16 low bits.
Post 05 Apr 2004, 20:25
View user's profile Send private message Visit poster's website 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.