Skip to contentSkip to conversation

port update; ppc system emulation on FreeBSD?

Qemu-devel Juergen Lock 2 participants 2 messages Jun 22, 2004 – Jun 23, 2004

lore
Share & tools
lore
#1 lore raw
Quoted 2 lines · On Wed, 23 Jun 2004 01:27:45 +0200 Juergen Lock <[email protected]>…

Btw is anyone working on getting the ppc system emulation running on FreeBSD?

It compiles cleanly and it's able to boot the ppc-bios with my old patch (attached). I downloaded Gentoo for PPC yesterday and can test it after I get home from work. I haven't tested it earlier becouse I didn't have ppc-bios. Now that the bios is included I don't believe there's any reason why ppc system emulation wouldn't work on FreeBSD.

Have you tried the attached patch (merge it after other FreeBSD changes)?

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 +1 -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

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: 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)
 {