Ds, es register

I parsed a specific binary (Linux elf). And I found this code:

movsl %ds:(%esi),%es:(%edi) 

There are two registers 'ds' and 'es'. I know that they are called "Segment Register". But there are no lines like "mov addr",% es (or% ds). "Where do these registers indicate?

+4
source share
1 answer

Segment registers are initialized by the OS. For most modern operating systems, they point to the same segment that applies to the entire address space, since most operating systems use a model with flat memory (i.e., without segmentation).

The reason for not using only ds (by default for almost all memory accesses) is that the operands for movs implicit and make sense in DOS times.

During DOS (Real Mode), their actual use was because the registers where they are limited to 16 bits and therefore limited to 64 KB of address space. Address space (1M) was divided into overlapping 64K segments.

+1
source

Source: https://habr.com/ru/post/1402470/


All Articles