It seems your question has been
answered a year ago, albeit in the context of 8086.
arjob wrote:It really limits what a generation of developers can think and do.
That surely has to be an exaggeration. Is segmented memory model, compared to the flatmem model, such an incredible game-changer?
arjob wrote:Having a separate stack segment is really a natural thought, but I am forced to implement virtual memory for the same protection.
Having a separate stack segment means juggling multiple ways of dealing with the same address locations. The compiler must track how a single address location is accessed, and emit instructions to adjust the offsets if the accessor-segment changes, or ensure that it doesn't change at all.
The data stored on the stack of one thread/CPU can be accessed by another thread/CPU as part of any concurrent programming paradigm. Here, a single memory location is forced to be accessed through different segments.
If the compiler chooses to or is forced to adjust the offsets, it must know how the descriptor tables are configured inside the kernel! Compiling and running of any software, now needs access to the info stored inside the descriptor tables. All usermode apps now need that info; if someone managed to corrupt the copy of that info stored in the user-space, the accesses can over/under-shoot the actual stack, thus bringing about the very situation this setup is supposed to prevent.
Edit: The info could be placed in vDSO as read-only; but the instructions to read it and adjust the offsets will be found to be sprinkled quite generously within any compiled code, resulting in noise.
Moreover, the disassembler engines, the debuggers and similar tools that work with binaries will themselves have to keep track of such memory locations if they are to be useful.