Question

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 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-- )

Was it helpful?

Solution

DC bit is name by osdev.org, by Intel´s manual it's expansion-direction. Number can go only in two directions: it can increase or decrease. DC bit is the thing that plays with it.

If the size of a stack segment needs to be dynamically, the stack segment can be an expand-down data segment (expansion-direction flag is set). Dynamically changing segment limit causes stack space to be added to the bottom of the stack.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top