On 16 April 2012 07:05, Stas Sergeev wrote:
> Oh, and while I was touching this part, could
> you please also explain how dpmi_setup() now works,
> I mean its mmap() looping. What is the magic here?

For x86-64 dosemu jumps to DPMI code using the "iretl" instruction
that is valid in userland and pops all of eip, cs, eflags, esp, and ss
(that's its behaviour in long mode). However, if the popped cs is a
selector to a 16-bit PM segment, the high 16 bits of esp don't change
(the famous CPU issue). So we want them to be zero. Any 47-bit value
of rsp=xxxx0000xxxx is fine. The loop tries to mmap 0x100000000 which
usually works but if this address was already mapped before it tries
higher addresses. (an alternative method is to parse /proc/self/maps).

Bart

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Dosemu-devel mailing list
Dosemu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dosemu-devel

Reply via email to