Skip to contentSkip to conversation

More FreeBSD patches

Qemu-devel Bartosz Fabianowski 3 participants 3 messages May 29, 2004 – Jun 4, 2004

lore
Share & tools
lore
#0 lore raw

Hi

Looking at current CVS, it seems that the FreeBSD patches posted on this list some time ago have been committed. However, some time has gone by since those patches were written and QEMU has evolved a bit. Thus, there are a few more issues with compilation on FreeBSD not addressed by those patches.

I have made a new small patch that, when applied to current CVS, makes QEMU compile and run on FreeBSD very nicely. It would be great if somebody could commit this.

By the way, I am wondering what the correct method for submitting patches to QEMU is. I saw that there is a bug tracker on the Savannah site, but it seems to be rather deserted. Should I just keep sending patches to this mailing list? Or is there some other place for bug reports and patches?

Regards,
- Bartosz Fabianowski

configure +6 -0
diff -rud qemu/configure qemu-patched/configure
@@ -204,7 +204,11 @@
 
 if test -z "$sdl" ; then
 
+if test "$bsd" = "yes" ; then
+sdl_config="sdl11-config"
+else
 sdl_config="sdl-config"
+fi
 sdl=no
 sdl_static=no
 
@@ -419,9 +423,11 @@
 if [ "$bsd" = "yes" ] ; then
   echo "#define O_LARGEFILE 0" >> $config_h
   echo "#define lseek64 lseek" >> $config_h
+  echo "#define mkstemp64 mkstemp" >> $config_h
   echo "#define ftruncate64 ftruncate" >> $config_h
   echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
   echo "#define _BSD 1" >> $config_h
+  echo "#define off64_t off_t" >> $config_h
 fi
 
 for target in $target_list; do 
vl.c +5 -0
diff -rud qemu/vl.c qemu-patched/vl.c
@@ -828,6 +828,7 @@
            the emulated kernel requested a too high timer frequency */
         getitimer(ITIMER_REAL, &itv);
 
+#if defined(__linux__)
         if (itv.it_interval.tv_usec > 1000) {
             /* try to use /dev/rtc to have a faster timer */
             if (start_rtc_timer() < 0)
@@ -848,6 +849,10 @@
             pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec * 
                                    PIT_FREQ) / 1000000;
         }
+#else
+        pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec *
+                               PIT_FREQ) / 1000000;
+#endif /* !defined(__linux__) */
     }
 #endif
 }
#1 lore raw
Quoted 5 lines · On Sat, 29 May 2004 16:54:24 +0200 Bartosz Fabianowski…

Looking at current CVS, it seems that the FreeBSD patches posted on this list some time ago have been committed. However, some time has gone by since those patches were written and QEMU has evolved a bit. Thus, there are a few more issues with compilation on FreeBSD not addressed by those patches.

I've also made patches that make Qemu compile on FreeBSD (and probably on the other BSDs also). Some of them are actually even committed. My lastest patch I've sent to Fabrice May 21st is basically the same as yours but it also adds support for PPC-softmmu (attached here also).

Quoted 5 lines

By the way, I am wondering what the correct method for submitting patches to QEMU is. I saw that there is a bug tracker on the Savannah site, but it seems to be rather deserted. Should I just keep sending patches to this mailing list? Or is there some other place for bug reports and patches?

I've been wondering this too. It also seems that Fabrice is very busy so it can take a while before patches hit the tree.

Regards,
Markus

? config-host.h
? config-host.mak
? dyngen
? i386-softmmu
? ppc-softmmu
? qemu-doc.html
? qemu-mkcow
? qemu-tech.html
? qemu.1
? vmdk2raw
Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.39

configure +3 -1
diff -w -u -d -r1.39 configure
@@ -93,7 +93,7 @@
 
 if [ "$bsd" = "yes" ] ; then
   make="gmake"
-  target_list="i386-softmmu"
+  target_list="i386-softmmu ppc-softmmu"
 fi
 
 # find source path
@@ -418,8 +418,10 @@
 
 if [ "$bsd" = "yes" ] ; then
   echo "#define O_LARGEFILE 0" >> $config_h
+  echo "#define off64_t off_t" >> $config_h
   echo "#define lseek64 lseek" >> $config_h
   echo "#define ftruncate64 ftruncate" >> $config_h
+  echo "#define mkstemp64 mkstemp" >> $config_h
   echo "#define MAP_ANONYMOUS MAP_ANON" >> $config_h
   echo "#define _BSD 1" >> $config_h
 fi

Index: dyngen-exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/dyngen-exec.h,v
retrieving revision 1.12

dyngen-exec.h +2 -3
diff -w -u -d -r1.12 dyngen-exec.h
@@ -21,6 +21,8 @@
 #define __DYNGEN_EXEC_H__
 
 #include <stddef.h>
+#include <stdio.h>
+#include "config.h"
 
 typedef unsigned char uint8_t;
 typedef unsigned short uint16_t;
@@ -54,9 +56,6 @@
 #define UINT32_MAX		(4294967295U)
 #define UINT64_MAX		((uint64_t)(18446744073709551615))
 
-typedef struct FILE FILE;
-extern int fprintf(FILE *, const char *, ...);
-extern int printf(const char *, ...);
 #undef NULL
 #define NULL 0
 #ifdef _BSD

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.74

vl.c +6 -1
diff -w -u -d -r1.74 vl.c
@@ -737,7 +737,7 @@
     }
 }
 
-#ifndef _WIN32
+#if !defined(_WIN32) && !defined(_BSD)
 
 #if defined(__linux__)
 
@@ -821,6 +821,10 @@
            the emulated kernel requested a too high timer frequency */
         getitimer(ITIMER_REAL, &itv);
 
+#ifdef _BSD
+        pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec * 
+                              PIT_FREQ) / 1000000;
+#else
         if (itv.it_interval.tv_usec > 1000) {
             /* try to use /dev/rtc to have a faster timer */
             if (start_rtc_timer() < 0)
@@ -841,6 +845,7 @@
             pit_min_timer_count = ((uint64_t)itv.it_interval.tv_usec * 
                                    PIT_FREQ) / 1000000;
         }
+#endif /* _BSD */
     }
 #endif
 }

Index: target-i386/exec.h
===================================================================
RCS file: /cvsroot/qemu/qemu/target-i386/exec.h,v
retrieving revision 1.12

exec.h +0 -1
diff -w -u -d -r1.12 exec.h
@@ -17,7 +17,6 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include "config.h"
 #include "dyngen-exec.h"
 
 /* at least 4 register variables are defines */

Index: target-ppc/op_helper.c
===================================================================
RCS file: /cvsroot/qemu/qemu/target-ppc/op_helper.c,v retrieving revision 1.6

op_helper.c +26 -2
diff -w -u -d -r1.6 op_helper.c
@@ -210,6 +210,22 @@
     }
     /* TODO: update FEX & VX */
     /* Set rounding mode */
+#ifdef _BSD
+    switch(env->fpscr[0] & 0x3) {
+    case 0:
+        fpsetround(FP_RN);
+        break;
+    case 1:
+        fpsetround(FP_RZ);
+        break;
+    case 2:
+        fpsetround(FP_RP);
+        break;
+    case 3:
+        fpsetround(FP_RM);
+        break;
+    }
+#else
     switch (env->fpscr[0] & 0x3) {
     case 0:
         /* Best approximation (round to nearest) */
@@ -228,6 +244,7 @@
         fesetround(FE_DOWNWARD);
         break;
     }
+#endif
 }
 
 void do_fctiw (void)
@@ -253,9 +270,13 @@
         double d;
         uint64_t i;
     } *p = (void *)&FT1;
+#ifdef _BSD
+    int cround = fpgetround();
+    fpsetround(FP_RZ);
+#else
     int cround = fegetround();
-
     fesetround(FE_TOWARDZERO);
+#endif
     if (FT0 > (double)0x7FFFFFFF)
         p->i = 0x7FFFFFFFULL << 32;
     else if (FT0 < -(double)0x80000000)
@@ -264,7 +285,11 @@
         p->i = 0;
     p->i |= (uint32_t)FT0;
     FT0 = p->d;
+#ifdef _BSD
+    fpsetround(cround);
+#else
     fesetround(cround);
+#endif
 }
 
 void do_fnmadds (void)
@@ -379,7 +404,6 @@
 
 /*****************************************************************************/
 /* Special helpers for debug */
-extern FILE *stdout;
 
 void dump_state (void)
 {
#2 lore raw
Quoted 9 lines · Markus Niemistö
Quoted 5 lines · On Sat, 29 May 2004 16:54:24 +0200 Bartosz Fabianowski…

Looking at current CVS, it seems that the FreeBSD patches posted on this list some time ago have been committed. However, some time has gone by since those patches were written and QEMU has evolved a bit. Thus, there are a few more issues with compilation on FreeBSD not addressed by those patches.

Quoted 5 lines

I've also made patches that make Qemu compile on FreeBSD (and probably on the other BSDs also). Some of them are actually even committed. My lastest patch I've sent to Fabrice May 21st is basically the same as yours but it also adds support for PPC-softmmu (attached here also).

Hmm does this patch you attached there really enable PPC-softmmu? There doesnt seem to be anything like that in there.

Wondering...
Juergen