Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 they mean?

like image 809
new_perl Avatar asked Nov 01 '11 01:11

new_perl


1 Answers

ds:si and es:di mean the segment:offset referred to by the registers in question. This is primarily important when you're working in real mode (where offsets are a maximum of 64K apiece).

In real mode, the segment are offset are combined as segment * 16 + offset.

In protected mode, a segment register holds a "selector". The base address of the memory referred to by the selector isn't directly related to the value of the selector itself -- rather, the selector just acts as an index to look up data in a table. In the usual case, however, this means very little -- most (current) protected mode environments are set up with CS, DS, ES and SS all set up with base addresses of 0 and maximum offsets of 4 Gigabytes, so addressing via DS vs. ES makes no difference.

like image 93
Jerry Coffin Avatar answered Oct 15 '22 21:10

Jerry Coffin