qemu-devel
[Top][All Lists]
Advanced

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

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


From: Jeremy C. Reed
Subject: [Qemu-devel] qemu head and NetBSD/amd64 and signal 11 and debugging
Date: Tue, 1 Jul 2008 14:39:34 -0500 (CDT)

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


This 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:7202


Index: vl.c
===================================================================
--- vl.c        (revision 4815)
+++ vl.c        (working copy)
@@ -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__)
Index: audio/ossaudio.c
===================================================================
--- audio/ossaudio.c    (revision 4815)
+++ audio/ossaudio.c    (working copy)
@@ -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;
     }
Index: audio/mixeng.c
===================================================================
--- audio/mixeng.c      (revision 4815)
+++ audio/mixeng.c      (working copy)
@@ -143,56 +143,64 @@
 #undef IN_T
 #undef SHIFT
 
+/*
+ * Work around ugly XX_t #defines in NetBSD 2.x,
+ * fixed as typedefs in NetBSD 3.x. Two macros needed to
+ * get CPP defines expanded properly. - HF
+ */
+#define _NBglue(x,y,z) x ## y ## z
+#define NBglue(x,y,z) _NBglue(x,y,z)
+
 t_sample *mixeng_conv[2][2][2][3] = {
     {
         {
             {
-                conv_natural_uint8_t_to_mono,
-                conv_natural_uint16_t_to_mono,
-                conv_natural_uint32_t_to_mono
+                NBglue(conv_natural_, uint8_t, _to_mono), 
+                NBglue(conv_natural_, uint16_t, _to_mono),
+                NBglue(conv_natural_, uint32_t, _to_mono)
             },
             {
-                conv_natural_uint8_t_to_mono,
-                conv_swap_uint16_t_to_mono,
-                conv_swap_uint32_t_to_mono,
+                NBglue(conv_natural_, uint8_t, _to_mono),
+                NBglue(conv_swap_, uint16_t, _to_mono),
+                NBglue(conv_swap_, uint32_t, _to_mono)
             }
         },
         {
             {
-                conv_natural_int8_t_to_mono,
-                conv_natural_int16_t_to_mono,
-                conv_natural_int32_t_to_mono
+                NBglue(conv_natural_, int8_t, _to_mono),
+                NBglue(conv_natural_, int16_t, _to_mono),
+                NBglue(conv_natural_, int32_t, _to_mono)
             },
             {
-                conv_natural_int8_t_to_mono,
-                conv_swap_int16_t_to_mono,
-                conv_swap_int32_t_to_mono
+                NBglue(conv_natural_, int8_t, _to_mono),
+                NBglue(conv_swap_, int16_t, _to_mono),
+                NBglue(conv_swap_, int32_t, _to_mono)
             }
         }
     },
     {
         {
             {
-                conv_natural_uint8_t_to_stereo,
-                conv_natural_uint16_t_to_stereo,
-                conv_natural_uint32_t_to_stereo
+                NBglue(conv_natural_, uint8_t, _to_stereo),
+                NBglue(conv_natural_, uint16_t, _to_stereo),
+                NBglue(conv_natural_, uint32_t, _to_stereo)
             },
             {
-                conv_natural_uint8_t_to_stereo,
-                conv_swap_uint16_t_to_stereo,
-                conv_swap_uint32_t_to_stereo
+                NBglue(conv_natural_, uint8_t, _to_stereo),
+                NBglue(conv_swap_, uint16_t, _to_stereo),
+                NBglue(conv_swap_, uint32_t, _to_stereo)
             }
         },
         {
             {
-                conv_natural_int8_t_to_stereo,
-                conv_natural_int16_t_to_stereo,
-                conv_natural_int32_t_to_stereo
+                NBglue(conv_natural_, int8_t, _to_stereo),
+                NBglue(conv_natural_, int16_t, _to_stereo),
+                NBglue(conv_natural_, int32_t, _to_stereo)
             },
             {
-                conv_natural_int8_t_to_stereo,
-                conv_swap_int16_t_to_stereo,
-                conv_swap_int32_t_to_stereo,
+                NBglue(conv_natural_, int8_t, _to_stereo),
+                NBglue(conv_swap_, int16_t, _to_stereo),
+                NBglue(conv_swap_, int32_t, _to_stereo)
             }
         }
     }
@@ -202,52 +210,52 @@
     {
         {
             {
-                clip_natural_uint8_t_from_mono,
-                clip_natural_uint16_t_from_mono,
-                clip_natural_uint32_t_from_mono
+                NBglue(clip_natural_, uint8_t, _from_mono),
+                NBglue(clip_natural_, uint16_t, _from_mono),
+                NBglue(clip_natural_, uint32_t, _from_mono)
             },
             {
-                clip_natural_uint8_t_from_mono,
-                clip_swap_uint16_t_from_mono,
-                clip_swap_uint32_t_from_mono
+                NBglue(clip_natural_, uint8_t, _from_mono),
+                NBglue(clip_swap_, uint16_t, _from_mono),
+                NBglue(clip_swap_, uint32_t, _from_mono)
             }
         },
         {
             {
-                clip_natural_int8_t_from_mono,
-                clip_natural_int16_t_from_mono,
-                clip_natural_int32_t_from_mono
+                NBglue(clip_natural_, int8_t, _from_mono),
+                NBglue(clip_natural_, int16_t, _from_mono),
+                NBglue(clip_natural_, int32_t, _from_mono)
             },
             {
-                clip_natural_int8_t_from_mono,
-                clip_swap_int16_t_from_mono,
-                clip_swap_int32_t_from_mono
+                NBglue(clip_natural_, int8_t, _from_mono),
+                NBglue(clip_swap_, int16_t, _from_mono),
+                NBglue(clip_swap_, int32_t, _from_mono)
             }
         }
     },
     {
         {
             {
-                clip_natural_uint8_t_from_stereo,
-                clip_natural_uint16_t_from_stereo,
-                clip_natural_uint32_t_from_stereo
+                NBglue(clip_natural_, uint8_t, _from_stereo),
+                NBglue(clip_natural_, uint16_t, _from_stereo),
+                NBglue(clip_natural_, uint32_t, _from_stereo)
             },
             {
-                clip_natural_uint8_t_from_stereo,
-                clip_swap_uint16_t_from_stereo,
-                clip_swap_uint32_t_from_stereo
+                NBglue(clip_natural_, uint8_t, _from_stereo),
+                NBglue(clip_swap_, uint16_t, _from_stereo),
+                NBglue(clip_swap_, uint32_t, _from_stereo)
             }
         },
         {
             {
-                clip_natural_int8_t_from_stereo,
-                clip_natural_int16_t_from_stereo,
-                clip_natural_int32_t_from_stereo
+                NBglue(clip_natural_, int8_t, _from_stereo),
+                NBglue(clip_natural_, int16_t, _from_stereo),
+                NBglue(clip_natural_, int32_t, _from_stereo)
             },
             {
-                clip_natural_int8_t_from_stereo,
-                clip_swap_int16_t_from_stereo,
-                clip_swap_int32_t_from_stereo
+                NBglue(clip_natural_, int8_t, _from_stereo),
+                NBglue(clip_swap_, int16_t, _from_stereo),
+                NBglue(clip_swap_, int32_t, _from_stereo)
             }
         }
     }
Index: bswap.h
===================================================================
--- bswap.h     (revision 4815)
+++ bswap.h     (working copy)
@@ -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);
Index: dyngen.c
===================================================================
--- dyngen.c    (revision 4815)
+++ dyngen.c    (working copy)
@@ -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)) {
Index: configure
===================================================================
--- configure   (revision 4815)
+++ configure   (working copy)
@@ -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=




reply via email to

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