* [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013
@ 2013-01-11 9:18 Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 1/6] readline: avoid memcpy() of overlapping regions Stefan Hajnoczi
` (6 more replies)
0 siblings, 7 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, Stefan Hajnoczi
The following changes since commit 8e4a424b305e29dc0e454f52df3b35577f342975:
Revert "virtio-pci: replace byte swap hack" (2013-01-06 18:30:17 +0000)
are available in the git repository at:
git://github.com/stefanha/qemu.git trivial-patches
for you to fetch changes up to c02e1eac887b1b0aee7361b1fcf889e7d47fed9d:
hw/pc.c: Fix converting of ioport_register* to MemoryRegion (2013-01-11 09:49:44 +0100)
----------------------------------------------------------------
Julien Grall (1):
hw/pc.c: Fix converting of ioport_register* to MemoryRegion
Nickolai Zeldovich (1):
readline: avoid memcpy() of overlapping regions
Peter Maydell (1):
qga/channel-posix.c: Explicitly include string.h
Stefan Weil (3):
configure: Fix comment (copy+paste bug)
savevm: Remove MinGW specific code which is no longer needed
Replace remaining gmtime, localtime by gmtime_r, localtime_r
block.c | 10 ----------
block/vvfat.c | 4 ----
configure | 2 +-
hw/omap1.c | 2 +-
hw/pc.c | 12 ++++++++++++
qga/channel-posix.c | 1 +
readline.c | 4 ++--
savevm.c | 30 ++----------------------------
vl.c | 9 +++------
9 files changed, 22 insertions(+), 52 deletions(-)
--
1.8.0.2
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 1/6] readline: avoid memcpy() of overlapping regions
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
@ 2013-01-11 9:18 ` Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 2/6] configure: Fix comment (copy+paste bug) Stefan Hajnoczi
` (5 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori, Nickolai Zeldovich, Stefan Hajnoczi
From: Nickolai Zeldovich <nickolai@csail.mit.edu>
memcpy() for overlapping regions is undefined behavior; use memmove()
instead in readline_hist_add().
[Keep tab characters since surrounding code still uses them -- Stefan]
Signed-off-by: Nickolai Zeldovich <nickolai@csail.mit.edu>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
readline.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/readline.c b/readline.c
index 5fc9643..a0c9638 100644
--- a/readline.c
+++ b/readline.c
@@ -248,8 +248,8 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline)
if (idx == READLINE_MAX_CMDS) {
/* Need to get one free slot */
free(rs->history[0]);
- memcpy(rs->history, &rs->history[1],
- (READLINE_MAX_CMDS - 1) * sizeof(char *));
+ memmove(rs->history, &rs->history[1],
+ (READLINE_MAX_CMDS - 1) * sizeof(char *));
rs->history[READLINE_MAX_CMDS - 1] = NULL;
idx = READLINE_MAX_CMDS - 1;
}
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 2/6] configure: Fix comment (copy+paste bug)
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 1/6] readline: avoid memcpy() of overlapping regions Stefan Hajnoczi
@ 2013-01-11 9:18 ` Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 3/6] qga/channel-posix.c: Explicitly include string.h Stefan Hajnoczi
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Weil, Anthony Liguori, Stefan Hajnoczi
From: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
configure | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index fe18ed2..148d5aa 100755
--- a/configure
+++ b/configure
@@ -2705,7 +2705,7 @@ if compile_prog "" "" ; then
byteswap_h=yes
fi
-# Search for bswap_32 function
+# Search for bswap32 function
bswap_h=no
cat > $TMPC << EOF
#include <sys/endian.h>
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 3/6] qga/channel-posix.c: Explicitly include string.h
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 1/6] readline: avoid memcpy() of overlapping regions Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 2/6] configure: Fix comment (copy+paste bug) Stefan Hajnoczi
@ 2013-01-11 9:18 ` Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 4/6] savevm: Remove MinGW specific code which is no longer needed Stefan Hajnoczi
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Peter Maydell, Anthony Liguori, Stefan Hajnoczi
From: Peter Maydell <peter.maydell@linaro.org>
Explicitly include string.h to avoid warnings under MacOS X/clang
about implicit declarations of strerror() and strlen().
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
qga/channel-posix.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/qga/channel-posix.c b/qga/channel-posix.c
index d4fd628..ca9e4aa 100644
--- a/qga/channel-posix.c
+++ b/qga/channel-posix.c
@@ -4,6 +4,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <string.h>
#include "qemu/osdep.h"
#include "qemu/sockets.h"
#include "qga/channel.h"
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 4/6] savevm: Remove MinGW specific code which is no longer needed
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
` (2 preceding siblings ...)
2013-01-11 9:18 ` [Qemu-devel] [PATCH 3/6] qga/channel-posix.c: Explicitly include string.h Stefan Hajnoczi
@ 2013-01-11 9:18 ` Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 5/6] Replace remaining gmtime, localtime by gmtime_r, localtime_r Stefan Hajnoczi
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Weil, Anthony Liguori, Stefan Hajnoczi
From: Stefan Weil <sw@weilnetz.de>
QEMU provides a portable function qemu_gettimeofday instead of
gettimeofday and also an implementation of localtime_r for MinGW.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
savevm.c | 30 ++----------------------------
1 file changed, 2 insertions(+), 28 deletions(-)
diff --git a/savevm.c b/savevm.c
index 529d60e..4e970ca 100644
--- a/savevm.c
+++ b/savevm.c
@@ -23,15 +23,6 @@
*/
#include "config-host.h"
-
-#ifndef _WIN32
-#include <arpa/inet.h>
-#endif
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
#include "qemu-common.h"
#include "hw/hw.h"
#include "hw/qdev.h"
@@ -2093,13 +2084,8 @@ void do_savevm(Monitor *mon, const QDict *qdict)
QEMUFile *f;
int saved_vm_running;
uint64_t vm_state_size;
-#ifdef _WIN32
- struct _timeb tb;
- struct tm *ptm;
-#else
- struct timeval tv;
+ qemu_timeval tv;
struct tm tm;
-#endif
const char *name = qdict_get_try_str(qdict, "name");
/* Verify if there is a device that doesn't support snapshots and is writable */
@@ -2129,15 +2115,9 @@ void do_savevm(Monitor *mon, const QDict *qdict)
memset(sn, 0, sizeof(*sn));
/* fill auxiliary fields */
-#ifdef _WIN32
- _ftime(&tb);
- sn->date_sec = tb.time;
- sn->date_nsec = tb.millitm * 1000000;
-#else
- gettimeofday(&tv, NULL);
+ qemu_gettimeofday(&tv);
sn->date_sec = tv.tv_sec;
sn->date_nsec = tv.tv_usec * 1000;
-#endif
sn->vm_clock_nsec = qemu_get_clock_ns(vm_clock);
if (name) {
@@ -2149,15 +2129,9 @@ void do_savevm(Monitor *mon, const QDict *qdict)
pstrcpy(sn->name, sizeof(sn->name), name);
}
} else {
-#ifdef _WIN32
- time_t t = tb.time;
- ptm = localtime(&t);
- strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", ptm);
-#else
/* cast below needed for OpenBSD where tv_sec is still 'long' */
localtime_r((const time_t *)&tv.tv_sec, &tm);
strftime(sn->name, sizeof(sn->name), "vm-%Y%m%d%H%M%S", &tm);
-#endif
}
/* Delete old snapshots of the same name */
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 5/6] Replace remaining gmtime, localtime by gmtime_r, localtime_r
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
` (3 preceding siblings ...)
2013-01-11 9:18 ` [Qemu-devel] [PATCH 4/6] savevm: Remove MinGW specific code which is no longer needed Stefan Hajnoczi
@ 2013-01-11 9:18 ` Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion Stefan Hajnoczi
2013-01-11 16:46 ` [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Anthony Liguori
6 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Stefan Weil, Anthony Liguori, Stefan Hajnoczi
From: Stefan Weil <sw@weilnetz.de>
This allows removing of MinGW specific code and improves
reentrancy for POSIX hosts.
[Removed unused ret variable in qemu_get_timedate() to fix warning:
vl.c: In function ‘qemu_get_timedate’:
vl.c:451:16: error: variable ‘ret’ set but not used [-Werror=unused-but-set-variable]
-- Stefan Hajnoczi]
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block.c | 10 ----------
block/vvfat.c | 4 ----
hw/omap1.c | 2 +-
vl.c | 9 +++------
4 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/block.c b/block.c
index 4e28c55..60873ea 100644
--- a/block.c
+++ b/block.c
@@ -3338,11 +3338,7 @@ char *get_human_readable_size(char *buf, int buf_size, int64_t size)
char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn)
{
char buf1[128], date_buf[128], clock_buf[128];
-#ifdef _WIN32
- struct tm *ptm;
-#else
struct tm tm;
-#endif
time_t ti;
int64_t secs;
@@ -3352,15 +3348,9 @@ char *bdrv_snapshot_dump(char *buf, int buf_size, QEMUSnapshotInfo *sn)
"ID", "TAG", "VM SIZE", "DATE", "VM CLOCK");
} else {
ti = sn->date_sec;
-#ifdef _WIN32
- ptm = localtime(&ti);
- strftime(date_buf, sizeof(date_buf),
- "%Y-%m-%d %H:%M:%S", ptm);
-#else
localtime_r(&ti, &tm);
strftime(date_buf, sizeof(date_buf),
"%Y-%m-%d %H:%M:%S", &tm);
-#endif
secs = sn->vm_clock_nsec / 1000000000;
snprintf(clock_buf, sizeof(clock_buf),
"%02d:%02d:%02d.%03d",
diff --git a/block/vvfat.c b/block/vvfat.c
index 83706ce..06e6654 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -529,13 +529,9 @@ static inline uint8_t fat_chksum(const direntry_t* entry)
/* if return_time==0, this returns the fat_date, else the fat_time */
static uint16_t fat_datetime(time_t time,int return_time) {
struct tm* t;
-#ifdef _WIN32
- t=localtime(&time); /* this is not thread safe */
-#else
struct tm t1;
t = &t1;
localtime_r(&time,t);
-#endif
if(return_time)
return cpu_to_le16((t->tm_sec/2)|(t->tm_min<<5)|(t->tm_hour<<11));
return cpu_to_le16((t->tm_mday)|((t->tm_mon+1)<<5)|((t->tm_year-80)<<9));
diff --git a/hw/omap1.c b/hw/omap1.c
index 8536e96..e85f2e2 100644
--- a/hw/omap1.c
+++ b/hw/omap1.c
@@ -2830,7 +2830,7 @@ static void omap_rtc_tick(void *opaque)
s->round = 0;
}
- memcpy(&s->current_tm, localtime(&s->ti), sizeof(s->current_tm));
+ localtime_r(&s->ti, &s->current_tm);
if ((s->interrupts & 0x08) && s->ti == s->alarm_ti) {
s->status |= 0x40;
diff --git a/vl.c b/vl.c
index f056c95..aed4182 100644
--- a/vl.c
+++ b/vl.c
@@ -448,21 +448,18 @@ StatusInfo *qmp_query_status(Error **errp)
void qemu_get_timedate(struct tm *tm, int offset)
{
time_t ti;
- struct tm *ret;
time(&ti);
ti += offset;
if (rtc_date_offset == -1) {
if (rtc_utc)
- ret = gmtime(&ti);
+ gmtime_r(&ti, tm);
else
- ret = localtime(&ti);
+ localtime_r(&ti, tm);
} else {
ti -= rtc_date_offset;
- ret = gmtime(&ti);
+ gmtime_r(&ti, tm);
}
-
- memcpy(tm, ret, sizeof(struct tm));
}
int qemu_timedate_diff(struct tm *tm)
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
` (4 preceding siblings ...)
2013-01-11 9:18 ` [Qemu-devel] [PATCH 5/6] Replace remaining gmtime, localtime by gmtime_r, localtime_r Stefan Hajnoczi
@ 2013-01-11 9:18 ` Stefan Hajnoczi
2013-01-11 11:50 ` Andreas Färber
2013-01-11 15:04 ` Julien Grall
2013-01-11 16:46 ` [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Anthony Liguori
6 siblings, 2 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2013-01-11 9:18 UTC (permalink / raw)
To: qemu-devel; +Cc: Julien Grall, Anthony Liguori, Stefan Hajnoczi
From: Julien Grall <julien.grall@citrix.com>
The commit 258711 introduced MemoryRegion to replace ioport_region*
for ioport 80h and F0h.
A MemoryRegion needs to have both read and write callback otherwise a segfault
will occur when an access is made.
The previous behaviour of this both ioport is to return 0xffffffffffffffff.
So keep this behaviour.
Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/pc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/pc.c b/hw/pc.c
index df0c48e..90b1bf7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data,
{
}
+static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0xffffffffffffffff;
+}
+
/* MSDOS compatibility mode FPU exception support */
static qemu_irq ferr_irq;
@@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data,
qemu_irq_lower(ferr_irq);
}
+static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0xffffffffffffffff;
+}
+
/* TSC handling */
uint64_t cpu_get_tsc(CPUX86State *env)
{
@@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
static const MemoryRegionOps ioport80_io_ops = {
.write = ioport80_write,
+ .read = ioport80_read,
.endianness = DEVICE_NATIVE_ENDIAN,
.impl = {
.min_access_size = 1,
@@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = {
static const MemoryRegionOps ioportF0_io_ops = {
.write = ioportF0_write,
+ .read = ioportF0_read,
.endianness = DEVICE_NATIVE_ENDIAN,
.impl = {
.min_access_size = 1,
--
1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion
2013-01-11 9:18 ` [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion Stefan Hajnoczi
@ 2013-01-11 11:50 ` Andreas Färber
2013-01-11 14:53 ` Julien Grall
2013-01-11 15:04 ` Julien Grall
1 sibling, 1 reply; 12+ messages in thread
From: Andreas Färber @ 2013-01-11 11:50 UTC (permalink / raw)
To: Stefan Hajnoczi, Julien Grall; +Cc: Anthony Liguori, qemu-devel
Am 11.01.2013 10:18, schrieb Stefan Hajnoczi:
> From: Julien Grall <julien.grall@citrix.com>
>
> The commit 258711 introduced MemoryRegion to replace ioport_region*
> for ioport 80h and F0h.
> A MemoryRegion needs to have both read and write callback otherwise a segfault
> will occur when an access is made.
>
> The previous behaviour of this both ioport is to return 0xffffffffffffffff.
> So keep this behaviour.
>
> Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
> Tested-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> hw/pc.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index df0c48e..90b1bf7 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data,
> {
> }
>
> +static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size)
> +{
> + return 0xffffffffffffffff;
Might these require ULL for i386?
Andreas
> +}
> +
> /* MSDOS compatibility mode FPU exception support */
> static qemu_irq ferr_irq;
>
> @@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data,
> qemu_irq_lower(ferr_irq);
> }
>
> +static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
> +{
> + return 0xffffffffffffffff;
> +}
> +
> /* TSC handling */
> uint64_t cpu_get_tsc(CPUX86State *env)
> {
> @@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
>
> static const MemoryRegionOps ioport80_io_ops = {
> .write = ioport80_write,
> + .read = ioport80_read,
> .endianness = DEVICE_NATIVE_ENDIAN,
> .impl = {
> .min_access_size = 1,
> @@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = {
>
> static const MemoryRegionOps ioportF0_io_ops = {
> .write = ioportF0_write,
> + .read = ioportF0_read,
> .endianness = DEVICE_NATIVE_ENDIAN,
> .impl = {
> .min_access_size = 1,
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion
2013-01-11 11:50 ` Andreas Färber
@ 2013-01-11 14:53 ` Julien Grall
2013-01-11 15:17 ` Andreas Färber
0 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2013-01-11 14:53 UTC (permalink / raw)
To: Andreas Färber
Cc: Anthony Liguori, qemu-devel@nongnu.org, Stefan Hajnoczi
On 01/11/2013 11:50 AM, Andreas Färber wrote:
> Am 11.01.2013 10:18, schrieb Stefan Hajnoczi:
>> From: Julien Grall <julien.grall@citrix.com>
>>
>> The commit 258711 introduced MemoryRegion to replace ioport_region*
>> for ioport 80h and F0h.
>> A MemoryRegion needs to have both read and write callback otherwise a segfault
>> will occur when an access is made.
>>
>> The previous behaviour of this both ioport is to return 0xffffffffffffffff.
>> So keep this behaviour.
>>
>> Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
>> Signed-off-by: Julien Grall <julien.grall@citrix.com>
>> Tested-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
>> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
>> ---
>> hw/pc.c | 12 ++++++++++++
>> 1 file changed, 12 insertions(+)
>>
>> diff --git a/hw/pc.c b/hw/pc.c
>> index df0c48e..90b1bf7 100644
>> --- a/hw/pc.c
>> +++ b/hw/pc.c
>> @@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data,
>> {
>> }
>>
>> +static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size)
>> +{
>> + return 0xffffffffffffffff;
>
> Might these require ULL for i386?
Indeed. I will resend a patch with ULL for ioport80_read and ioportF0_read.
>
>> +}
>> +
>> /* MSDOS compatibility mode FPU exception support */
>> static qemu_irq ferr_irq;
>>
>> @@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data,
>> qemu_irq_lower(ferr_irq);
>> }
>>
>> +static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
>> +{
>> + return 0xffffffffffffffff;
>> +}
>> +
>> /* TSC handling */
>> uint64_t cpu_get_tsc(CPUX86State *env)
>> {
>> @@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
>>
>> static const MemoryRegionOps ioport80_io_ops = {
>> .write = ioport80_write,
>> + .read = ioport80_read,
>> .endianness = DEVICE_NATIVE_ENDIAN,
>> .impl = {
>> .min_access_size = 1,
>> @@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = {
>>
>> static const MemoryRegionOps ioportF0_io_ops = {
>> .write = ioportF0_write,
>> + .read = ioportF0_read,
>> .endianness = DEVICE_NATIVE_ENDIAN,
>> .impl = {
>> .min_access_size = 1,
>
--
Julien
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion
2013-01-11 9:18 ` [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion Stefan Hajnoczi
2013-01-11 11:50 ` Andreas Färber
@ 2013-01-11 15:04 ` Julien Grall
1 sibling, 0 replies; 12+ messages in thread
From: Julien Grall @ 2013-01-11 15:04 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: Anthony Liguori, qemu-devel@nongnu.org, Andreas Färber
From: Julien Grall <julien.grall@citrix.com>
The commit 258711 introduced MemoryRegion to replace ioport_region*
for ioport 80h and F0h.
A MemoryRegion needs to have both read and write callback otherwise a segfault
will occur when an access is made.
The previous behaviour of this both ioport is to return 0xffffffffffffffff.
So keep this behaviour.
Reported-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Julien Grall <julien.grall@citrix.com>
Tested-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/pc.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/pc.c b/hw/pc.c
index df0c48e..90b1bf7 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data,
{
}
+static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0xffffffffffffffffULL;
+}
+
/* MSDOS compatibility mode FPU exception support */
static qemu_irq ferr_irq;
@@ -123,6 +128,11 @@ static void ioportF0_write(void *opaque, hwaddr addr, uint64_t data,
qemu_irq_lower(ferr_irq);
}
+static uint64_t ioportF0_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0xffffffffffffffffULL;
+}
+
/* TSC handling */
uint64_t cpu_get_tsc(CPUX86State *env)
{
@@ -960,6 +970,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
static const MemoryRegionOps ioport80_io_ops = {
.write = ioport80_write,
+ .read = ioport80_read,
.endianness = DEVICE_NATIVE_ENDIAN,
.impl = {
.min_access_size = 1,
@@ -969,6 +980,7 @@ static const MemoryRegionOps ioport80_io_ops = {
static const MemoryRegionOps ioportF0_io_ops = {
.write = ioportF0_write,
+ .read = ioportF0_read,
.endianness = DEVICE_NATIVE_ENDIAN,
.impl = {
.min_access_size = 1,
-- 1.8.0.2
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion
2013-01-11 14:53 ` Julien Grall
@ 2013-01-11 15:17 ` Andreas Färber
0 siblings, 0 replies; 12+ messages in thread
From: Andreas Färber @ 2013-01-11 15:17 UTC (permalink / raw)
To: Julien Grall; +Cc: Anthony Liguori, qemu-devel@nongnu.org, Stefan Hajnoczi
Am 11.01.2013 15:53, schrieb Julien Grall:
> On 01/11/2013 11:50 AM, Andreas Färber wrote:
>> Am 11.01.2013 10:18, schrieb Stefan Hajnoczi:
>>> @@ -103,6 +103,11 @@ static void ioport80_write(void *opaque, hwaddr addr, uint64_t data,
>>> {
>>> }
>>>
>>> +static uint64_t ioport80_read(void *opaque, hwaddr addr, unsigned size)
>>> +{
>>> + return 0xffffffffffffffff;
>>
>> Might these require ULL for i386?
>
> Indeed. I will resend a patch with ULL for ioport80_read and ioportF0_read.
Since this patch is already in a pull and Anthony indicated it is being
processed, can you fix this as a follow-up patch instead?
Thanks,
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
` (5 preceding siblings ...)
2013-01-11 9:18 ` [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion Stefan Hajnoczi
@ 2013-01-11 16:46 ` Anthony Liguori
6 siblings, 0 replies; 12+ messages in thread
From: Anthony Liguori @ 2013-01-11 16:46 UTC (permalink / raw)
To: Stefan Hajnoczi, qemu-devel; +Cc: Anthony Liguori
Pulled, thanks.
Regards,
Anthony Liguori
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2013-01-11 16:46 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 9:18 [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 1/6] readline: avoid memcpy() of overlapping regions Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 2/6] configure: Fix comment (copy+paste bug) Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 3/6] qga/channel-posix.c: Explicitly include string.h Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 4/6] savevm: Remove MinGW specific code which is no longer needed Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 5/6] Replace remaining gmtime, localtime by gmtime_r, localtime_r Stefan Hajnoczi
2013-01-11 9:18 ` [Qemu-devel] [PATCH 6/6] hw/pc.c: Fix converting of ioport_register* to MemoryRegion Stefan Hajnoczi
2013-01-11 11:50 ` Andreas Färber
2013-01-11 14:53 ` Julien Grall
2013-01-11 15:17 ` Andreas Färber
2013-01-11 15:04 ` Julien Grall
2013-01-11 16:46 ` [Qemu-devel] [PULL 0/6] Trivial patches for 5 to 11 January 2013 Anthony Liguori
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).