From: Christoph Egger <Christoph.Egger@amd.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>
Subject: [Qemu-devel] [PATCH 1/6] qemu fixes
Date: Fri, 28 Nov 2008 12:28:35 +0200 [thread overview]
Message-ID: <200811281128.36627.Christoph.Egger@amd.com> (raw)
[-- 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;
}
}
next reply other threads:[~2008-11-28 10:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-28 10:28 Christoph Egger [this message]
2008-11-28 11:30 ` [Qemu-devel] Re: [PATCH 1/6] qemu fixes Jan Kiszka
2008-11-28 18:09 ` Blue Swirl
2008-12-05 18:03 ` Blue Swirl
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=200811281128.36627.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=blauwirbel@gmail.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 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).