What is the role of DC bit in GDT?

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
hrm
Posts: 7
Joined: Tue Feb 19, 2013 4:14 am

What is the role of DC bit in GDT?

Post by hrm »

this is my code :

Code: Select all

...
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 byte) in the gdt is zero. I want to know why not work when it is 1?

I know that dc bit is Direction bit of data selectors , and when it's 0 , the segment grows up and when it's 1 the segment grows down. but not know what is the meaning of grows up and grows down exactly. grows up and grows down means to me when I want to use the stack.( ESP++ and ESP-- )
User avatar
trinopoty
Member
Member
Posts: 87
Joined: Wed Feb 09, 2011 2:21 am
Location: Raipur, India

Re: What is the role of DC bit in GDT?

Post by trinopoty »

When memory grows up; it starts at "Base" and ends at "Base + Limit"
When memory grows down; it starts at "Base" and ends at "Base - Limit"
Always give a difficult task to a lazy person. He will find an easy way to do it.
Post Reply