calculate logical address from physical address (x86)

As far as i know, the physical address is calculated by shifting the segment address (16-bit) left 4 times and adding it with the 16-bit offset address. My question is, what if 2 different sets of segment:offset address values give the same result eg. for 200A:B608 and 2138:A328

200A0

+B608


2B6A8


And

21380

+A328


2B6A8


Both give the same result!!

Now, does that mean, that they point to the same physical address(if so, how?),

or whether physical addresses are not meant to be calculated in the above manner?

or, if its valid, then how can i get the segment:offset address back from the physical address(is that possible?)


Solution 1:

In real-address mode segment register values are, indeed, shifted left 4 bits and then added to the offset to form a 20 bit linear address (which in this mode is the same as the physical address).

Obviously, this means than different segment:offset pairs may be translated to the same physical address (just as different linear addresses in protected mode with paging enabled may be translated to the same physical address). Since there is no 1:1 mapping between logical and linear addresses the only thing you can get from a linear address is a set of segment:offset pairs that are translated to it.

You can find more detailed description in the Intel Manuals, volume 3B, section 20.1.1.