qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/6] qemu fixes
@ 2008-11-28 10:28 Christoph Egger
  2008-11-28 11:30 ` [Qemu-devel] " Jan Kiszka
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Christoph Egger @ 2008-11-28 10:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl

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


Hi,

This is a series of four patches which improve support
for qemu on NetBSD.

Attached patch contains warning fixes + make cpu-exec.c
compile on NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

-- 
AMD Saxony, Dresden, Germany
Operating System Research Center

Legal Information:
AMD Saxony Limited Liability Company & Co. KG
Sitz (Geschäftsanschrift):
   Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland
Registergericht Dresden: HRA 4896
vertretungsberechtigter Komplementär:
   AMD Saxony LLC (Sitz Wilmington, Delaware, USA)
Geschäftsführer der AMD Saxony LLC:
   Dr. Hans-R. Deppe, Thomas McCoy

[-- Attachment #2: qemu.diff --]
[-- Type: text/x-diff, Size: 3669 bytes --]

Index: block-vvfat.c
===================================================================
--- block-vvfat.c	(revision 5805)
+++ block-vvfat.c	(working copy)
@@ -1780,7 +1780,7 @@
 	}
 
 	for (i = 0; i < 0x10 * s->sectors_per_cluster; i++) {
-	    int cluster_count;
+	    int cluster_count = 0;
 
 DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + i));
 	    if (is_volume_label(direntries + i) || is_dot(direntries + i) ||
Index: usb-bsd.c
===================================================================
--- usb-bsd.c	(revision 5805)
+++ usb-bsd.c	(working copy)
@@ -68,7 +68,7 @@
     ep = UE_GET_ADDR(ep);
 
     if (dev->ep_fd[ep] < 0) {
-#if __FreeBSD__
+#ifdef __FreeBSD__
         snprintf(buf, sizeof(buf) - 1, "%s.%d", dev->devpath, ep);
 #else
         snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->devpath, ep);
@@ -321,7 +321,7 @@
         return NULL;
     }
 
-#if __FreeBSD__
+#ifdef __FreeBSD__
     snprintf(ctlpath, PATH_MAX, "/dev/%s", bus_info.udi_devnames[0]);
 #else
     snprintf(ctlpath, PATH_MAX, "/dev/%s.00", bus_info.udi_devnames[0]);
@@ -413,7 +413,7 @@
             if (strncmp(bus_info.udi_devnames[0], "ugen", 4) != 0)
                 continue;
 
-#if __FreeBSD__
+#ifdef __FreeBSD__
             snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s", bus_info.udi_devnames[0]);
 #else
             snprintf(devbuf, sizeof(devbuf) - 1, "/dev/%s.00", bus_info.udi_devnames[0]);
Index: cpu-exec.c
===================================================================
--- cpu-exec.c	(revision 5805)
+++ cpu-exec.c	(working copy)
@@ -1188,17 +1188,32 @@
 
 #elif defined(__x86_64__)
 
+#ifdef __NetBSD__
+#define REG_ERR _REG_ERR
+#define REG_TRAPNO _REG_TRAPNO
+
+#define QEMU_UC_MCONTEXT_GREGS(uc, reg)	(uc)->uc_mcontext.__gregs[(reg)]
+#define QEMU_UC_MACHINE_PC(uc)		_UC_MACHINE_PC(uc)
+#else
+#define QEMU_UC_MCONTEXT_GREGS(uc, reg)	(uc)->uc_mcontext.gregs[(reg)]
+#define QEMU_UC_MACHINE_PC(uc)		QEMU_UC_MCONTEXT_GREGS(uc, REG_RIP)
+#endif
+
 int cpu_signal_handler(int host_signum, void *pinfo,
                        void *puc)
 {
     siginfo_t *info = pinfo;
+    unsigned long pc;
+#ifdef __NetBSD__
+    ucontext_t *uc = puc;
+#else
     struct ucontext *uc = puc;
-    unsigned long pc;
+#endif
 
-    pc = uc->uc_mcontext.gregs[REG_RIP];
+    pc = QEMU_UC_MACHINE_PC(uc);
     return handle_cpu_signal(pc, (unsigned long)info->si_addr,
-                             uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe ?
-                             (uc->uc_mcontext.gregs[REG_ERR] >> 1) & 1 : 0,
+                             QEMU_UC_MCONTEXT_GREGS(uc, REG_TRAPNO) == 0xe ?
+                             (QEMU_UC_MCONTEXT_GREGS(uc, REG_ERR) >> 1) & 1 : 0,
                              &uc->uc_sigmask, puc);
 }
 
Index: block.c
===================================================================
--- block.c	(revision 5805)
+++ block.c	(working copy)
@@ -760,7 +764,7 @@
     int ret, i, heads, sectors, cylinders;
     struct partition *p;
     uint32_t nr_sects;
-    int64_t nb_sectors;
+    uint64_t nb_sectors;
 
     bdrv_get_geometry(bs, &nb_sectors);
 
@@ -800,7 +804,7 @@
 {
     int translation, lba_detected = 0;
     int cylinders, heads, secs;
-    int64_t nb_sectors;
+    uint64_t nb_sectors;
 
     /* if a geometry hint is available, use it */
     bdrv_get_geometry(bs, &nb_sectors);
Index: hw/mpcore.c
===================================================================
--- hw/mpcore.c	(revision 5805)
+++ hw/mpcore.c	(working copy)
@@ -105,6 +105,8 @@
         return s->control;
     case 12: /* Interrupt status.  */
         return s->status;
+    default:
+        return 0;
     }
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-05 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-28 10:28 [Qemu-devel] [PATCH 1/6] qemu fixes Christoph Egger
2008-11-28 11:30 ` [Qemu-devel] " Jan Kiszka
2008-11-28 18:09 ` Blue Swirl
2008-12-05 18:03 ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).