Questions tagged [memory-segmentation]

Memory segmentation refers to the practice of dividing a computer's memory in segments or sections.

Segmentation is an alternative to

Memory segmentation is the division of a computer memory into segments or sections. Those segments are used on compiled programs when they are loaded into memory.

Programs are broken up logically according to their functional parts, unlike segments do not have a fixed size

In a system that uses segmentation each memory location is referred by a segment identifier and an offset within that segment.

296 questions
135
votes
6 answers

What is the "FS"/"GS" register intended for?

So I know what the following registers and their uses are supposed to be: CS = Code Segment (used for IP) DS = Data Segment (used for MOV) ES = Destination Segment (used for MOVS, etc.) SS = Stack Segment (used for SP) But what are the following…
user541686
  • 205,094
  • 128
  • 528
  • 886
42
votes
2 answers

Do modern OS's use paging and segmentation?

I was reading about memory architecture and I got a bit confused with the paging and segmentation. I read that modern OS systems use only paging to manage memory access but looking at a disassembled codes I can see segments like "ds" and "fs". Does…
Dan
  • 1,059
  • 1
  • 9
  • 11
34
votes
2 answers

What does "DS:[40207A]" mean in assembly?

0040103A CALL DWORD PTR DS:[40207A] USER32.MessageBoxA What does DS: mean?
wamp
  • 5,789
  • 17
  • 52
  • 82
32
votes
3 answers

Differences or similarities between Segmented paging and Paged segmentation?

I was studying combined paging/segmentation systems and in my book there were two approaches to this : 1.paged segmentation 2.segmented paging I could not make out the difference between the two. I think in paged segmentation the segment is divided…
31
votes
2 answers

Why 64 bit mode ( Long mode ) doesn't use segment registers?

I'm a beginner level of student :) I'm studying about intel architecture, and I'm studying a memory management such as a segmentation and paging. I'm reading Intel's manual and it's pretty nice to understand intel's architectures. However I'm still…
Henrik
  • 421
  • 1
  • 4
  • 12
27
votes
4 answers

Does C have an equivalent of std::less from C++?

I was recently answering a question on the undefined behaviour of doing p < q in C when p and q are pointers into different objects/arrays. That got me thinking: C++ has the same (undefined) behaviour of < in this case, but also offers the standard…
26
votes
3 answers

8086- why can't we move an immediate data into segment register?

In 8086 assembly programming, we can only load a data into a segment register by, first loading it into a general purpose register and then we have to move it from this general register to the segment register. Why can't we load it directly? Is…
Rijo Joseph
  • 1,375
  • 3
  • 17
  • 33
23
votes
3 answers

What is %gs in Assembly

void return_input (void) { char array[30]; gets (array); printf("%s\n", array); } After compiling it in gcc, this function is converted to the following Assembly code: push %ebp mov %esp,%ebp sub $0x28,%esp mov …
Alex F
  • 42,307
  • 41
  • 144
  • 212
22
votes
1 answer

Difference between DPL and RPL in x86

Reading intel x86 Manual and other sources, i did not understand the difference between DPL (Descriptor privilege level) and RPL (Requested privilege level). Why is there necessity to have both? Thank you so much
dlbp
  • 227
  • 1
  • 2
  • 5
19
votes
4 answers

Why does Linux on x86 use different segments for user processes and the kernel?

So, I know that Linux uses four default segments for an x86 processor (kernel code, kernel data, user code, user data), but they all have the same base and limit (0x00000000 and 0xfffff), meaning each segment maps to the same set of linear…
user220878
16
votes
2 answers

Linux memory segmentation

Looking into the internals of Linux and memory management, I just stumbled upon the segmented paging model that Linux uses. Correct me if I am wrong, but Linux (protected mode) does use paging for mapping a linear virtual address space to the…
explogx
  • 1,159
  • 13
  • 28
16
votes
3 answers

How to use a logical address with an FS or GS base in gdb?

gdb provides functionality to read or write to a specific linear address, for example: (gdb) x/1wx 0x080483e4 0x80483e4
: 0x83e58955 (gdb) but how do you specify a logical address ? I came accross the following instruction: …
user368507
  • 1,388
  • 1
  • 13
  • 25
15
votes
2 answers

What do ds:si and es:di mean in assembly?

The movsb (move string, bytes) instruction fetches the byte at address ds:si, stores it at address es:di, and then increments or decrements the si and di registers by one. I know esi,si and edi,di registers, but not ds:si and es:di , what do…
new_perl
  • 7,345
  • 11
  • 42
  • 72
14
votes
1 answer

What is a paragraph (when referring to memory)

I feel silly for asking something that seems like it should be so easy to look up, but as you might guess, searching for paragraph gets a lot results that have nothing to do with what I want to know. I've been learning assembly these past few days…
cost
  • 4,420
  • 8
  • 48
  • 80
14
votes
2 answers

Linear address and physical address

What is linear address? How is it different from physical address?
1
2 3
19 20