On 08/03/2010 01:30 AM, Hans-Peter Diettrich wrote:

We are doing "flat" software all the time. The last use of segmented pointers dates back to Win3.1, with near and far pointers.
It was you who introduced the flat vs segmented paradigm in this discussion. :)

Nonetheless, we _always_ do use segment registers (sometimes explicitly, mostly implicitly CS: DS, SS as appropriate, as the hardware and the OS forces this. For data access DS: and SS; are used, which contain the same value ($0023 with Windows, $007B with Linux, no idea what the these values mean). Only using threadvars asks for using another segment register (FS: with Windows 32 Bit, GS with Linux, details see above) - even if the user software does not ever modify the segment registers.

Of course pointers (doing something like "mov EAX,[EAX]") implicitly use DS:, as well. This does work for variables allocated on the stack, because SS and DS always contain the same value. The user software just sees the address relative to the value in the selector table denoted by as well DS: as SS:. So it simply does not need to care about segments (only not true with threadvars in X86/32-Linux, see above).

I don't care if this is called "segmented" or "flat software" :).

-Michael
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to