qemu head and NetBSD/amd64 and signal 11 and debugging
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:7202This is from running trunk/x86_64-softmmu/qemu-system-x86_64
This GDB was configured as "x86_64--netbsd"... Core was generated by `qemu'.
Program terminated with signal 11, Segmentation fault. #0 0x00007f8000a3458e in ?? ()
(gdb) bt
#0 0x00007f8000a3458e in ?? ()
#1 0x00007f7fedadd000 in ?? ()
#2 0x0000000000000022 in ?? ()
#3 0x00007f7fedb00000 in ?? ()
#4 0x0000000000487c75 in cpu_set_log (log_flags=<value optimized out>)
at /home/reed/tmp/qemu/trunk/exec.c:1366
#5 0x00007f7fedb00000 in ?? ()
#6 0x00000000fffff000 in ?? ()
#7 0x00007f7fedadd000 in ?? ()
#8 0x00000000ffff0000 in ?? ()
#9 0x0000000000488322 in tb_flush (env1=0xe05b)
at /home/reed/tmp/qemu/trunk/exec.c:506
#10 0x0000000000489115 in __ldw_cmmu (addr=15, mmu_idx=-95289344)
at /home/reed/tmp/qemu/trunk/softmmu_template.h:100
#11 0x000000000048b640 in cpu_x86_exec (env1=<value optimized out>)
at /home/reed/tmp/qemu/trunk/cpu-exec.c:299
#12 0x000000000040e66b in main (argc=<value optimized out>,
argv=0x7f7fffffd7c0) at /home/reed/tmp/qemu/trunk/vl.c:7202vl.c +1 -1
@@ -61,7 +61,7 @@#include <arpa/inet.h> #ifdef _BSD#include <sys/stat.h> -#ifndef __APPLE__ +#if defined(__FreeBSD__) || defined(__DragonFly__)#include <libutil.h> #endif #elif defined (__GLIBC__) && defined (__FreeBSD_kernel__)
ossaudio.c +1 -1
@@ -237,7 +237,7 @@ goto err; } -if (ioctl (fd,SNDCTL_DSP_NONBLOCK )) { +if (ioctl (fd,SNDCTL_DSP_NONBLOCK ,NULL )) {oss_logerr2 (errno, typ,"Failed to set non-blocking mode\n" ); goto err; }
mixeng.c +56 -48
164 lines not on this page · raw message
bswap.h +8 -0
@@ -5,6 +5,12 @@#include <inttypes.h> +#ifdef HAVE_MACHINE_BSWAP_H +#include <sys/endian.h> +#include <sys/types.h> +#include <machine/bswap.h> +#else +#ifdef HAVE_BYTESWAP_H #include <byteswap.h> #else
@@ -58,6 +64,8 @@ return bswap_64(x); } +#endif /* ! HAVE_MACHINE_BSWAP_H */ +static inline void bswap16s (uint16_t *s) { *s =bswap16 (*s);
dyngen.c +1 -0
@@ -1642,6 +1642,7 @@if (!sym_name)continue ;if (*sym_name && + !strstart (sym_name,"bswap64" ,NULL ) && !strstart (sym_name,"__op_param" ,NULL ) && !strstart (sym_name,"__op_jmp" ,NULL ) && !strstart (sym_name,"__op_gen_label" ,NULL )) {
configure +27 -4
@@ -31,7 +31,7 @@ make="make" install="install" strip="strip" -cpu=`uname -m` +cpu=`uname -p` target_list="" case "$cpu" in i386|i486|i586|i686|i86pc|BePC)
@@ -67,7 +67,7 @@ mips64) cpu="mips64" ;; - "Power Macintosh"|ppc|ppc64) + "Power Macintosh"|ppc|ppc64|powerpc) cpu="powerpc" ;; s390*)
@@ -141,10 +141,17 @@ kqemu="yes" fi ;; +DragonFly) +bsd="yes" +oss="yes" +dragonfly="yes" +;; + NetBSD) bsd="yes" audio_drv_list="oss" audio_possible_drivers="oss sdl esd" +AIOLIBS="-lrt" ;; OpenBSD) bsd="yes"
@@ -337,7 +344,7 @@ done if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then - AIOLIBS= +# AIOLIBS= else # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. AIOLIBS="-lrt -lpthread"
@@ -493,6 +500,16 @@ fi fi +# Check for stack protector +cat > $TMPC <<EOF +extern int foo; +EOF +if "$cc" -o $TMPE $TMPC -fno-stack-protector 2> /dev/null ; then + stack_protector_present="yes" +else + stack_protector_present="no" +fi + # # Solaris specific configure tool chain decisions #
@@ -995,6 +1012,8 @@ EOF if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then echo "#define HAVE_BYTESWAP_H 1" >> $config_h + elif test -f "/usr/include/machine/bswap.h" ; then + echo "#define HAVE_MACHINE_BSWAP_H 1" >> $config_h fi fi if test "$darwin" = "yes" ; then
@@ -1042,7 +1061,7 @@ echo " &${drv}_audio_driver, \\" >>$config_h def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'` echo "$def=yes" >> $config_mak - if test "$drv" == "fmod"; then + if test "$drv" = "fmod"; then echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak fi
@@ -1111,6 +1130,10 @@ echo "#define _BSD 1" >> $config_h fi +if [ "$stack_protector_present" = "yes" ] ; then + echo "STACK_PROTECTOR_PRESENT=yes" >> $config_mak +fi + echo "#define CONFIG_UNAME_RELEASE \"$uname_release\"" >> $config_h tools=
In article <[email protected]> you write:
Quoted 24 lines
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. #00x00007f8000a3458ein ?? ()
(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
#50x0000000000488322intb_gen_code(env=0x7f7ffaad0000, pc=68,
cs_base=4294901760, flags=68, cflags=<value optimized out>) at/home/reed/tmp/qemu/trunk/exec.c:794
#60x000000000048b640incpu_x86_exec(env1=<value optimized out>)
at/home/reed/tmp/qemu/trunk/cpu-exec.c:620
#70x000000000040e66bin main (argc=<value optimized out>,
argv=0x7f7fffffd7d8) at/home/reed/tmp/qemu/trunk/vl.c:7202
Quoted 1 line
[...]
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