virtual memory problems with Linux 2.4.5

Alexandre Julliard julliard at
Tue Jun 12 23:21:36 CDT 2001

Mike McCormack  <mike_mccormack at> writes:

> your patch produced a yes, BUT when i changed the offset value to
> 0x400, and it failed ... see new patch below.

That's a bug in glibc 2.1.3. This is from the mmap64 source:

        [offset is in ecx:edx]
	testl $0x3ff, %edx
	jne L(einval)
	shrdl $12, %ecx, %edx		/* mmap2 takes the offset in pages.  */
	shrl $12, %ecx

But of course 0x3ff only tests 10 bits, not 12, so if bits 10 or 11
are set they will be silently dropped. This has been fixed in

Another related problem is that even without this bug, mmap64 will
always refuse to do an unaligned mmap, even if the kernel might have
accepted it (with kernel 2.2.x for instance). Maybe the best solution
would be to directly call the mmap syscall instead of mmap2 when
mapping executables, this would fix both problems.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list