All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin <qemumail@olifantasia.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Here is a patch to build qemu with powerpc (system) support on win32
Date: Mon, 10 May 2004 01:57:08 +0200	[thread overview]
Message-ID: <409EC554.9060103@olifantasia.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1184 bytes --]

I mad a little patch to be able to enable powerpc system emulation on 
windows
The patch is against qemu 0.5.5.
Just run configure with
./configure --target-list=i386-softmmu ppc-softmmu
(Which is the default with this patch)
and it builds both qemu.exe (which is i386 system emulation) and 
qemu-system-ppc.exe (which is ppc system emulation)

I tested it with the VGA framebuffer enabled linux kernel zIamge and the 
debian install disk on  Jocelyns page
http://jocelyn.mayer.free.fr/qemu-ppc/

It seems to work for me.
I used the commandline:
qemu-system-ppc.exe --kernel zImage_vgafb.prep --fda 
debian_install_root.bin --boot a
and it just boots.

If anyone is interested I can make my binary qemu-system-ppc.exe 
available but I think it would be better to place one on the Fabrices 
qemu homepage or on Jocelyns qemu-ppc homepage if it is ready for primetime

Strange thing about the patch is I had to manually set the env struct to 
zero in cpu_ppc_init (in translate.c)
for(i=0;i<sizeof(CPUPPCState);i++)
{
    ((char*) env)[i]=0;
}

With the standard
memset(env, 0, sizeof(CPUPPCState));
The compiler complained about not being able to free a register.
 
Greetings,
Martin


[-- Attachment #2: qemu-0.5.5-powerpc-win32.patch --]
[-- Type: text/plain, Size: 2495 bytes --]

diff -urbN qemu-0.5.5/configure qemu-0.5.5-win32/configure
--- qemu-0.5.5/configure	2004-05-08 16:51:18.000000000 +0200
+++ qemu-0.5.5-win32/configure	2004-05-10 00:48:46.000000000 +0200
@@ -140,7 +140,7 @@
 strip="${cross_prefix}${strip}"
 
 if test "$mingw32" = "yes" ; then
-    target_list="i386-softmmu"
+    target_list="i386-softmmu ppc-softmmu"
     EXESUF=".exe"
     gdbstub="no"
 fi
diff -urbN qemu-0.5.5/hw/m48t59.c qemu-0.5.5-win32/hw/m48t59.c
--- qemu-0.5.5/hw/m48t59.c	2004-05-08 16:51:18.000000000 +0200
+++ qemu-0.5.5-win32/hw/m48t59.c	2004-05-10 00:20:44.000000000 +0200
@@ -67,7 +67,11 @@
     time_t t;
 
     t = time(NULL) + NVRAM->time_offset;
-    localtime_r(&t, tm);
+    #ifdef WIN32
+	  memcpy(tm,localtime(&t),sizeof(*tm));
+	#else
+	  localtime_r (&t, &local) ;
+	#endif
 }
 
 static void set_time (m48t59_t *NVRAM, struct tm *tm)
@@ -129,7 +133,11 @@
 
 static void get_alarm (m48t59_t *NVRAM, struct tm *tm)
 {
-    localtime_r(&NVRAM->alarm, tm);
+	#ifdef WIN32
+	  memcpy(tm,localtime(&NVRAM->alarm),sizeof(*tm));
+	#else
+	   localtime_r (&NVRAM->alarm, tm);
+	#endif
 }
 
 static void set_alarm (m48t59_t *NVRAM, struct tm *tm)
diff -urbN qemu-0.5.5/target-ppc/helper.c qemu-0.5.5-win32/target-ppc/helper.c
--- qemu-0.5.5/target-ppc/helper.c	2004-05-08 16:51:18.000000000 +0200
+++ qemu-0.5.5-win32/target-ppc/helper.c	2004-05-10 00:02:46.000000000 +0200
@@ -17,7 +17,13 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
+#ifdef _WIN32
+#define PROT_READ  1
+#define PROT_WRITE 2
+#else
 #include <sys/mman.h>
+#endif
 
 #include "exec.h"
 #if defined (USE_OPEN_FIRMWARE)
diff -urbN qemu-0.5.5/target-ppc/translate.c qemu-0.5.5-win32/target-ppc/translate.c
--- qemu-0.5.5/target-ppc/translate.c	2004-05-08 16:51:18.000000000 +0200
+++ qemu-0.5.5-win32/target-ppc/translate.c	2004-05-10 01:30:06.000000000 +0200
@@ -2933,13 +2933,21 @@
 CPUPPCState *cpu_ppc_init(void)
 {
     CPUPPCState *env;
+    int i;
 
     cpu_exec_init();
 
     env = malloc(sizeof(CPUPPCState));
     if (!env)
         return NULL;
+#ifdef WIN32
+for(i=0;i<sizeof(CPUPPCState);i++)
+{
+	((char*) env)[i]=0;
+}
+#else
     memset(env, 0, sizeof(CPUPPCState));
+#endif
 #if !defined(CONFIG_USER_ONLY) && defined (USE_OPEN_FIRMWARE)
     setup_machine(env, 0);
 #else
@@ -2961,7 +2969,6 @@
     msr_pr = 1;
 #endif
     env->access_type = ACCESS_INT;
-
     return env;
 }
 

             reply	other threads:[~2004-05-09 23:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-09 23:57 Martin [this message]
2004-05-10  1:57 ` [Qemu-devel] Here is a patch to build qemu with powerpc (system) support on win32 Satadru Pramanik
2004-05-10  3:42   ` Herbert Poetzl
2004-05-10 11:35     ` [Qemu-devel] " Gabriel Ebner
2004-05-10 13:45       ` [Qemu-devel] Mac OS X installer working Jamie Burns
2004-05-10 17:28   ` [Qemu-devel] Here is a patch to build qemu with powerpc (system) support on win32 Satadru Pramanik
2004-05-10 17:29     ` Satadru Pramanik
2004-05-10  8:04 ` [Qemu-devel] Here is a patch to build qemu with powerpc (system)support " kazu
2004-05-10 12:45 ` [Qemu-devel] pearpc (PPC) anyone? Johannes Schindelin
2004-05-10 15:10   ` Karel Gardas
2004-05-10 18:56   ` Fabrice Bellard
2004-05-10 21:40     ` Herbert Poetzl
2004-05-10 23:42       ` Satadru Pramanik
2004-05-10 23:54       ` Stefano Marinelli
2004-05-11  2:56       ` David Holm <dholm@gentoo.org>

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=409EC554.9060103@olifantasia.com \
    --to=qemumail@olifantasia.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.