qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] qemu head and NetBSD/amd64 and signal 11 and debugging


From: Juergen Lock
Subject: Re: [Qemu-devel] qemu head and NetBSD/amd64 and signal 11 and debugging
Date: Wed, 2 Jul 2008 19:03:24 +0200 (CEST)

In article <address@hidden> you write:
>I am trying to get latest qemu from subversion to run on NetBSD/amd64.
>
>Some of the patches are bottom of this email.
>
>This is from running the installed bin/qemu
>
>Core was generated by `qemu'.
>Program terminated with signal 11, Segmentation fault.
>#0  0x00007f8000a3458e in ?? ()
>(gdb) bt
>#0  0x00007f8000a3458e in ?? ()
>#1  0x00007f7ffaad0000 in ?? ()
>#2  0x0000000000000022 in ?? ()
>#3  0x00007f7fedb00000 in ?? ()
>#4  0x0000000000487c75 in tb_link_phys (tb=0x7fff, phys_pc=4096, 
>    phys_page2=4205641728) at /home/reed/tmp/qemu/trunk/exec.c:1059
>#5  0x0000000000488322 in tb_gen_code (env=0x7f7ffaad0000, pc=68, 
>    cs_base=4294901760, flags=68, cflags=<value optimized out>)
>    at /home/reed/tmp/qemu/trunk/exec.c:794
>#6  0x000000000048b640 in cpu_x86_exec (env1=<value optimized out>)
>    at /home/reed/tmp/qemu/trunk/cpu-exec.c:620
>#7  0x000000000040e66b in main (argc=<value optimized out>, 
>    argv=0x7f7fffffd7d8) at /home/reed/tmp/qemu/trunk/vl.c:7202

>[...]

You probably need a similar mmap hack in exec.c:code_gen_alloc() as I posted
for FreeBSD/amd64 in:
        http://lists.gnu.org/archive/html/qemu-devel/2008-06/msg00562.html
(you might need to adjust the (void *)0x40000000 for NetBSD.)

Index: qemu/exec.c
@@ -405,6 +405,28 @@
             exit(1);
         }
     }
+#elif defined(__FreeBSD__)
+    {
+        int flags;
+        void *addr = NULL;
+        flags = MAP_PRIVATE | MAP_ANONYMOUS;
+#if defined(__x86_64__)
+        /* FreeBSD doesn't have MAP_32BIT, use MAP_FIXED and assume
+         * 0x40000000 is free */
+        flags |= MAP_FIXED;
+        addr = (void *)0x40000000;
+        /* Cannot map more than that */
+        if (code_gen_buffer_size > (800 * 1024 * 1024))
+            code_gen_buffer_size = (800 * 1024 * 1024);
+#endif
+        code_gen_buffer = mmap(addr, code_gen_buffer_size,
+                               PROT_WRITE | PROT_READ | PROT_EXEC, 
+                               flags, -1, 0);
+        if (code_gen_buffer == MAP_FAILED) {
+            fprintf(stderr, "Could not allocate dynamic translator buffer\n");
+            exit(1);
+        }
+    }
 #else
     code_gen_buffer = qemu_malloc(code_gen_buffer_size);
     if (!code_gen_buffer) {

 The failure I got was tcg generating relative jump insns (0xe9) where the
32 bit offset overflowed...

 HTH,
        Juergen




reply via email to

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