From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Christoph Egger" Subject: Re: [PATCH][TOOLS] ioemu: Build fixes for BSD and bug fixes from BSD Date: Fri, 28 Sep 2007 10:07:23 +0200 Message-ID: <200709281007.23409.Christoph.Egger@amd.com> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Boundary-00=_7YL/GahyJzLq8kF" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --Boundary-00=_7YL/GahyJzLq8kF Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 27 September 2007 17:39:18 Keir Fraser wrote: > On 27/9/07 12:35, "Christoph Egger" wrote: > > Hi! > > > > Attached patch makes ioemu build on *BSD. > > It also applies bug fixes from *BSD for Linux and *BSD :-) > > > > Signed-off-by: Christoph Egger > > I checked in all the bits that look like they are there just to make ioemu > build and run on *BSD (that's about 90-95% of the patch). The remainder I > rejected -- that's generic bug fixes to ioemu (belongs upstream and/or as > separate patches to xen-devel) and anything that looked like it merely > fixes a build warning (we don't build ioemu with -Werror, and we tolerate > build warnings because they should really be fixed upstream first). I agree with you, this also should go into qemu. But I don't have contact to the qemu people. That's why I asked in the first signed-off mail, if there = is someone with contact to qemu. Maybe someone from qemu is subscribed on xen-devel, so I resubmit the remainder as separate patch. Signed-off-by: Christoph Egger > You may want to check that I didn't cut too hard, and resubmit a few bits. > > -- Keir I just checked. I can live with that what you committed. But I resubmit the remainder for the case someone from qemu is on xen-devel or someone with contact to qemu people is on xen-devel, in hope the *full* patch goes into qemu the one or the other way. Christoph =2D-=20 AMD Saxony, Dresden, Germany Operating System Research Center Legal Information: AMD Saxony Limited Liability Company & Co. KG Sitz (Gesch=E4ftsanschrift): Wilschdorfer Landstr. 101, 01109 Dresden, Deutschland Registergericht Dresden: HRA 4896 vertretungsberechtigter Komplement=E4r: AMD Saxony LLC (Sitz Wilmington, Delaware, USA) Gesch=E4ftsf=FChrer der AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy --Boundary-00=_7YL/GahyJzLq8kF Content-Type: text/plain; charset=iso-8859-1; name=tools_ioemu2.diff Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=tools_ioemu2.diff diff -r 8817a53c030f tools/ioemu/aes.c --- a/tools/ioemu/aes.c Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/aes.c Fri Sep 28 09:48:44 2007 +0000 @@ -30,7 +30,9 @@ #include "vl.h" #include "aes.h" +#ifndef NDEBUG #define NDEBUG +#endif #include typedef uint32_t u32; diff -r 8817a53c030f tools/ioemu/block-qcow2.c --- a/tools/ioemu/block-qcow2.c Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/block-qcow2.c Fri Sep 28 09:48:44 2007 +0000 @@ -1884,6 +1884,8 @@ static int grow_refcount_table(BlockDriv int new_table_size, new_table_size2, refcount_table_clusters, i, ret; uint64_t *new_table; int64_t table_offset; + int old_table_size; + int64_t old_table_offset; uint64_t data64; uint32_t data32; @@ -1931,10 +1933,14 @@ static int grow_refcount_table(BlockDriv &data32, sizeof(data32)) != sizeof(data32)) goto fail; qemu_free(s->refcount_table); + old_table_offset = s->refcount_table_offset; + old_table_size = s->refcount_table_size; s->refcount_table = new_table; s->refcount_table_size = new_table_size; + s->refcount_table_offset = table_offset; update_refcount(bs, table_offset, new_table_size2, 1); + free_clusters(bs, old_table_offset, old_table_size * sizeof(uint64_t)); return 0; fail: free_clusters(bs, table_offset, new_table_size2); diff -r 8817a53c030f tools/ioemu/cpu-all.h --- a/tools/ioemu/cpu-all.h Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/cpu-all.h Fri Sep 28 09:48:44 2007 +0000 @@ -1010,13 +1010,22 @@ static inline int64_t cpu_get_real_ticks #endif } #else -/* The host CPU doesn't have an easily accessible cycle counter. - Just return a monotonically increasing vlue. This will be totally wrong, - but hopefully better than nothing. */ + +#include +#include + static inline int64_t cpu_get_real_ticks (void) { - static int64_t ticks = 0; - return ticks++; + struct timeval tv; + static int64_t i = 0; + int64_t j; + + gettimeofday(&tv, NULL); + do { + j = (tv.tv_sec * (uint64_t) 1000000) + tv.tv_usec; + } while (i == j); + i = j; + return j; } #endif diff -r 8817a53c030f tools/ioemu/dis-asm.h --- a/tools/ioemu/dis-asm.h Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/dis-asm.h Fri Sep 28 09:48:44 2007 +0000 @@ -13,6 +13,7 @@ #include #include #include +#include "config.h" #define PARAMS(x) x typedef void *PTR; diff -r 8817a53c030f tools/ioemu/hw/acpi.c --- a/tools/ioemu/hw/acpi.c Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/hw/acpi.c Fri Sep 28 09:48:44 2007 +0000 @@ -473,7 +473,7 @@ void piix4_pm_init(PCIBus *bus, int devf { PIIX4PMState *s; uint8_t *pci_conf; - uint32_t pm_io_base, smb_io_base; + uint32_t smb_io_base; s = (PIIX4PMState *)pci_register_device(bus, "PM", sizeof(PIIX4PMState), diff -r 8817a53c030f tools/ioemu/hw/fdc.c --- a/tools/ioemu/hw/fdc.c Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/hw/fdc.c Fri Sep 28 09:48:44 2007 +0000 @@ -176,7 +176,7 @@ typedef struct fd_format_t { uint8_t last_sect; uint8_t max_track; uint8_t max_head; - const unsigned char *str; + const char *str; } fd_format_t; static fd_format_t fd_formats[] = { diff -r 8817a53c030f tools/ioemu/hw/ne2000.c --- a/tools/ioemu/hw/ne2000.c Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/hw/ne2000.c Fri Sep 28 09:48:44 2007 +0000 @@ -207,7 +207,7 @@ static int ne2000_buffer_full(NE2000Stat index = s->curpag << 8; boundary = s->boundary << 8; - if (index <= boundary) + if (index < boundary) avail = boundary - index; else avail = (s->stop - s->start) - (index - boundary); diff -r 8817a53c030f tools/ioemu/hw/pc.c --- a/tools/ioemu/hw/pc.c Thu Sep 27 18:08:11 2007 +0100 +++ b/tools/ioemu/hw/pc.c Fri Sep 28 09:48:44 2007 +0000 @@ -480,7 +480,9 @@ static void pc_init1(uint64_t ram_size, int piix3_devfn = -1; CPUState *env; NICInfo *nd; +#ifdef CONFIG_PASSTHROUGH int rc; +#endif linux_boot = (kernel_filename != NULL); --Boundary-00=_7YL/GahyJzLq8kF Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --Boundary-00=_7YL/GahyJzLq8kF--