Possibly crazy idea to deal with memory layout problems once and for all

Mike McCormack mike at codeweavers.com
Sat Feb 18 05:47:36 CST 2006

Dan Kegel wrote:

> You can override mmap() in wine by just changing all
> the places it's called.  (Having control over the source is
> a wonderful thing.)  But if you want mmap to behave
> truly differently, you'd probably need to change the
> kernel.

You can do that easily after glibc has loaded, but you won't know where 
glibc itself was loaded into the address space.

I discussed something like what Troy proposed with Vitaliy on IRC, but 
with the preloader looking up and overriding the mmap/munmap symbols in 
glibc.  That would hopefully give Wine control over most mmaps and 
munmaps, possible save us from having to reserve memory in the 
preloader, and allow more control of the address space.

It has a few problems though.  Firstly, we'd miss mmaps done with system 
calls.  Secondly, we'd have to make assumptions about what areas of 
memory the kernel would let us map, and what areas of memory were 
already used in the address map.

> I seem to recall somebody was working on a linux
> kernel module for wine that just dealt with
> program loading, but I can't recall who.
> Perhaps he'll surface and comment on this.

I had a go at creating a kernel based PE loader for Linux 2.6 by forward 
porting parts of David Howell's Wine kernel module.  It currently 
compiles, but that's about all.

Haven't had much time to spend on it lately, because I've been busy with 
work ... ;)


More information about the wine-devel mailing list