[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] linux-user/mmap.c query

From: cb-qemu
Subject: [Qemu-devel] linux-user/mmap.c query
Date: Wed, 22 Sep 2004 23:16:48 +0100
User-agent: Mutt/1.5.6+20040523i

Hi Fabrice and everyone

I'm trying to use qemu-arm to run some statically linked linux binaries, and
I've come across an issue with the target_mmap function. The test at line 185:
    if (offset & ~TARGET_PAGE_MASK)
        return -EINVAL;
seems to be unnecessary as there is code to handle a non-aligned offset later
on in the function which is introduced by the comment
    /* worst case: we cannot map the file because the offset is not
       aligned, so we read it */

In addition, there seems to be an inconsistency in the way errors are reported
from target_mmap and what is expected by linux-user/elfload.c. target_mmap()
returns -EINVAL, but elfload.c expects errors to be reported with -1 and errno
to be set.

The following (totally minimal) patch enables me to run a few simple statically
linked ARM binaries. (This is just to make it clear the change I am talking

Once this is addressed I run into problems with binaries which execute code
from writable pages - the code pages are marked non-writable by tb_link_phys()
but segfaults arising from writes are not handled. I haven't fully investigated
this problem yet. Is this supposed to work? I'll try and create a test case if
I don't make any progress on this.

BTW, is it possible to run qemu-arm under gdb and get breakpoints working? When
I try, gdb complains because the qemu binary is remapped somewhere else in the
addres space.


--- linux-user/mmap.c   5 Jul 2004 21:25:16 -0000       1.7
+++ linux-user/mmap.c   22 Sep 2004 20:18:53 -0000
@@ -182,7 +182,7 @@
-    if (offset & ~TARGET_PAGE_MASK)
+    if (offset & ~TARGET_PAGE_MASK && 0)
         return -EINVAL;
     len = TARGET_PAGE_ALIGN(len);

reply via email to

[Prev in Thread] Current Thread [Next in Thread]