SHA256
1
0
forked from pool/qemu

Accepting request 1038 from GNOME:Factory

Copy from IBS home:uli_suse:branches:SUSE:Factory:Head/qemu based on submit request 1038 from user uli_suse

OBS-URL: https://build.opensuse.org/request/show/1038
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/qemu?expand=0&rev=31
This commit is contained in:
OBS User autobuild 2009-08-11 15:37:13 +00:00 committed by Git OBS Bridge
parent 5a52972728
commit ae572d8970
51 changed files with 8437 additions and 3172 deletions

View File

@ -1,6 +1,18 @@
--- x86_64.ld From 736ba7792e27aa443af4a3737a7372ff774dc394 Mon Sep 17 00:00:00 2001
+++ x86_64.ld From: Ulrich Hecht <uli@suse.de>
@@ -59,8 +59,6 @@ Date: Tue, 14 Apr 2009 16:17:39 +0200
Subject: [PATCH 01/33] qemu-0.7.0-amd64
No clue why this is necessary or useful, nothing found in any changelogs.
---
x86_64.ld | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/x86_64.ld b/x86_64.ld
index 878dafb..142e641 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -59,8 +59,6 @@ SECTIONS
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) } .rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) } .eh_frame_hdr : { *(.eh_frame_hdr) }
@ -9,7 +21,7 @@
/* Adjust the address for the data segment. We want to adjust up to /* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */ the same address within the page on the next page up. */
. = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000); . = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
@@ -86,8 +84,8 @@ @@ -86,8 +84,8 @@ SECTIONS
.data1 : { *(.data1) } .data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
@ -20,3 +32,6 @@
.dynamic : { *(.dynamic) } .dynamic : { *(.dynamic) }
.ctors : .ctors :
{ {
--
1.6.2.1

View File

@ -1,8 +1,23 @@
Index: qemu-0.9.0/qemu-binfmt-conf.sh From 993c181ec92f0e5edfcb609048a4fa288c193309 Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- qemu/qemu-binfmt-conf.sh Date: Tue, 14 Apr 2009 16:18:44 +0200
+++ qemu/qemu-binfmt-conf.sh Subject: [PATCH 02/33] qemu-0.9.0.cvs-binfmt
@@ -12,7 +12,7 @@
Fixes binfmt_misc setup script:
- x86_64 is i386-compatible
- m68k signature fixed
- path to QEMU
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
qemu-binfmt-conf.sh | 33 ++++++++++++++++++---------------
1 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/qemu-binfmt-conf.sh b/qemu-binfmt-conf.sh
index 941f0cf..67d6728 100644
--- a/qemu-binfmt-conf.sh
+++ b/qemu-binfmt-conf.sh
@@ -12,7 +12,7 @@ fi
# probe cpu type # probe cpu type
cpu=`uname -m` cpu=`uname -m`
case "$cpu" in case "$cpu" in
@ -11,7 +26,7 @@ Index: qemu-0.9.0/qemu-binfmt-conf.sh
cpu="i386" cpu="i386"
;; ;;
m68k) m68k)
@@ -24,36 +24,39 @@ @@ -24,36 +24,39 @@ case "$cpu" in
"Power Macintosh"|ppc|ppc64) "Power Macintosh"|ppc|ppc64)
cpu="ppc" cpu="ppc"
;; ;;
@ -65,3 +80,6 @@ Index: qemu-0.9.0/qemu-binfmt-conf.sh
+ echo ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register + echo ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register
+ echo ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register + echo ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
fi fi
--
1.6.2.1

View File

@ -1,8 +1,21 @@
Index: qemu/thunk.h From 6a9b13749aa2889fee2d6dc2fc4ae80a3df24a49 Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- qemu/thunk.c Date: Tue, 14 Apr 2009 16:20:50 +0200
+++ qemu/thunk.c Subject: [PATCH 03/33] qemu-cvs-alsa_bitfield
@@ -40,6 +40,7 @@
Implements TYPE_INTBITFIELD partially. (required for ALSA support)
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
thunk.c | 21 +++++++++++++++++++++
thunk.h | 3 +++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/thunk.c b/thunk.c
index 0657188..5638b2c 100644
--- a/thunk.c
+++ b/thunk.c
@@ -41,6 +41,7 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
case TYPE_CHAR: case TYPE_CHAR:
case TYPE_SHORT: case TYPE_SHORT:
case TYPE_INT: case TYPE_INT:
@ -10,7 +23,7 @@ Index: qemu/thunk.h
case TYPE_LONGLONG: case TYPE_LONGLONG:
case TYPE_ULONGLONG: case TYPE_ULONGLONG:
case TYPE_LONG: case TYPE_LONG:
@@ -132,6 +133,26 @@ @@ -139,6 +140,26 @@ const argtype *thunk_convert(void *dst, const void *src,
case TYPE_INT: case TYPE_INT:
*(uint32_t *)dst = tswap32(*(uint32_t *)src); *(uint32_t *)dst = tswap32(*(uint32_t *)src);
break; break;
@ -37,9 +50,11 @@ Index: qemu/thunk.h
case TYPE_LONGLONG: case TYPE_LONGLONG:
case TYPE_ULONGLONG: case TYPE_ULONGLONG:
*(uint64_t *)dst = tswap64(*(uint64_t *)src); *(uint64_t *)dst = tswap64(*(uint64_t *)src);
--- qemu/thunk.h diff --git a/thunk.h b/thunk.h
+++ qemu/thunk.h index 109c541..55890f3 100644
@@ -38,6 +38,7 @@ --- a/thunk.h
+++ b/thunk.h
@@ -37,6 +37,7 @@ typedef enum argtype {
TYPE_PTR, TYPE_PTR,
TYPE_ARRAY, TYPE_ARRAY,
TYPE_STRUCT, TYPE_STRUCT,
@ -47,7 +62,7 @@ Index: qemu/thunk.h
} argtype; } argtype;
#define MK_PTR(type) TYPE_PTR, type #define MK_PTR(type) TYPE_PTR, type
@@ -87,6 +88,7 @@ @@ -90,6 +91,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
case TYPE_SHORT: case TYPE_SHORT:
return 2; return 2;
case TYPE_INT: case TYPE_INT:
@ -55,7 +70,7 @@ Index: qemu/thunk.h
return 4; return 4;
case TYPE_LONGLONG: case TYPE_LONGLONG:
case TYPE_ULONGLONG: case TYPE_ULONGLONG:
@@ -124,6 +126,7 @@ @@ -127,6 +129,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
case TYPE_SHORT: case TYPE_SHORT:
return 2; return 2;
case TYPE_INT: case TYPE_INT:
@ -63,3 +78,6 @@ Index: qemu/thunk.h
return 4; return 4;
case TYPE_LONGLONG: case TYPE_LONGLONG:
case TYPE_ULONGLONG: case TYPE_ULONGLONG:
--
1.6.2.1

View File

@ -1,19 +1,44 @@
Index: qemu/linux-user/ioctls.h From d14e67385b88cf274b9c9a5969880bd7f1d292a0 Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- qemu-0.10.1/linux-user/ioctls.h Date: Tue, 14 Apr 2009 16:23:27 +0200
+++ qemu-0.10.1/linux-user/ioctls.h Subject: [PATCH 04/33] qemu-cvs-alsa_ioctl
@@ -314,3 +314,9 @@
IOCTL(MTIOCTOP, IOC_W, MK_PTR(MK_STRUCT(STRUCT_mtop))) Implements ALSA ioctls on PPC hosts.
IOCTL(MTIOCGET, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtget)))
IOCTL(MTIOCPOS, IOC_R, MK_PTR(MK_STRUCT(STRUCT_mtpos))) Signed-off-by: Ulrich Hecht <uli@suse.de>
+ ---
linux-user/ioctls.h | 5 +
linux-user/ioctls_alsa.h | 467 ++++++++++
linux-user/ioctls_alsa_structs.h | 1740 ++++++++++++++++++++++++++++++++++++++
linux-user/syscall_defs.h | 1 +
linux-user/syscall_types.h | 5 +
linux-user/syscall_types_alsa.h | 1337 +++++++++++++++++++++++++++++
6 files changed, 3555 insertions(+), 0 deletions(-)
create mode 100644 linux-user/ioctls_alsa.h
create mode 100644 linux-user/ioctls_alsa_structs.h
create mode 100644 linux-user/syscall_types_alsa.h
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 685cc71..aee5a88 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -301,6 +301,11 @@
IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
+/* FIXME: including these on x86 / x86_64 breaks qemu-i386 */ +/* FIXME: including these on x86 / x86_64 breaks qemu-i386 */
+#ifdef __powerpc__ +#ifdef __powerpc__
+#include "ioctls_alsa.h" +#include "ioctls_alsa.h"
+#endif +#endif
+ +
--- qemu-0.10.1/linux-user/ioctls_alsa.h IOCTL(LOOP_SET_FD, 0, TYPE_INT)
+++ qemu-0.10.1/linux-user/ioctls_alsa.h IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
diff --git a/linux-user/ioctls_alsa.h b/linux-user/ioctls_alsa.h
new file mode 100644
index 0000000..c2aa542
--- /dev/null
+++ b/linux-user/ioctls_alsa.h
@@ -0,0 +1,467 @@ @@ -0,0 +1,467 @@
+#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int) +#define SNDRV_SEQ_IOCTL_PVERSION _IOR ('S', 0x00, int)
+#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int) +#define SNDRV_SEQ_IOCTL_CLIENT_ID _IOR ('S', 0x01, int)
@ -482,8 +507,11 @@ Index: qemu/linux-user/ioctls.h
+IOCTL( SNDRV_SB_CSP_IOCTL_RESTART , 0, TYPE_NULL ) +IOCTL( SNDRV_SB_CSP_IOCTL_RESTART , 0, TYPE_NULL )
+IOCTL( SND_SSCAPE_LOAD_BOOTB , IOC_RW, MK_PTR(MK_STRUCT(STRUCT_sscape_bootblock)) ) +IOCTL( SND_SSCAPE_LOAD_BOOTB , IOC_RW, MK_PTR(MK_STRUCT(STRUCT_sscape_bootblock)) )
+IOCTL( SND_SSCAPE_LOAD_MCODE , IOC_W, MK_PTR(MK_STRUCT(STRUCT_sscape_microcode)) ) +IOCTL( SND_SSCAPE_LOAD_MCODE , IOC_W, MK_PTR(MK_STRUCT(STRUCT_sscape_microcode)) )
--- qemu-0.10.1/linux-user/ioctls_alsa_structs.h diff --git a/linux-user/ioctls_alsa_structs.h b/linux-user/ioctls_alsa_structs.h
+++ qemu-0.10.1/linux-user/ioctls_alsa_structs.h new file mode 100644
index 0000000..3de8614
--- /dev/null
+++ b/linux-user/ioctls_alsa_structs.h
@@ -0,0 +1,1740 @@ @@ -0,0 +1,1740 @@
+/* +/*
+ * Advanced Linux Sound Architecture + * Advanced Linux Sound Architecture
@ -2225,30 +2253,36 @@ Index: qemu/linux-user/ioctls.h
+{ +{
+ unsigned char *code; + unsigned char *code;
+}; +};
--- qemu-0.10.1/linux-user/syscall_defs.h diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
+++ qemu-0.10.1/linux-user/syscall_defs.h index ac5dbc5..78c6488 100644
@@ -2001,6 +2001,7 @@ --- a/linux-user/syscall_defs.h
#include "socket.h" +++ b/linux-user/syscall_defs.h
@@ -2138,3 +2138,4 @@ struct target_mq_attr {
#define FUTEX_CLOCK_REALTIME 256
#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
#include "errno_defs.h"
+#include "ioctls_alsa_structs.h" +#include "ioctls_alsa_structs.h"
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index d3f3df9..1fa48d0 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -80,6 +80,11 @@ STRUCT(count_info,
STRUCT(mixer_info,
MK_ARRAY(TYPE_CHAR, 16), MK_ARRAY(TYPE_CHAR, 32), TYPE_INT, MK_ARRAY(TYPE_INT, 10))
struct target_ipc64_perm
{
--- qemu-0.10.1/linux-user/syscall_types.h
+++ qemu-0.10.1/linux-user/syscall_types.h
@@ -114,3 +114,9 @@
STRUCT(mtget, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG, TYPE_LONG,
TYPE_INT, TYPE_INT)
STRUCT(mtpos, TYPE_LONG)
+
+/* FIXME: including these on x86 / x86_64 breaks qemu-i386 */ +/* FIXME: including these on x86 / x86_64 breaks qemu-i386 */
+#ifdef __powerpc__ +#ifdef __powerpc__
+#include "syscall_types_alsa.h" +#include "syscall_types_alsa.h"
+#endif +#endif
+ +
--- qemu-0.10.1/linux-user/syscall_types_alsa.h /* loop device ioctls */
+++ qemu-0.10.1/linux-user/syscall_types_alsa.h STRUCT(loop_info,
TYPE_INT, /* lo_number */
diff --git a/linux-user/syscall_types_alsa.h b/linux-user/syscall_types_alsa.h
new file mode 100644
index 0000000..6dbc964
--- /dev/null
+++ b/linux-user/syscall_types_alsa.h
@@ -0,0 +1,1337 @@ @@ -0,0 +1,1337 @@
+/* +/*
+ * Advanced Linux Sound Architecture + * Advanced Linux Sound Architecture
@ -3587,3 +3621,6 @@ Index: qemu/linux-user/ioctls.h
+ TYPE_PTRVOID + TYPE_PTRVOID
+) +)
+ +
--
1.6.2.1

View File

@ -1,9 +1,21 @@
Index: qemu/linux-user/mmap.c From 3c312c26b8dd16c170720160677c0cd72ad71655 Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- qemu/linux-user/mmap.c Date: Tue, 14 Apr 2009 16:24:15 +0200
+++ qemu/linux-user/mmap.c Subject: [PATCH 05/33] qemu-cvs-alsa_mmap
@@ -153,6 +153,9 @@
return 0; Hack to prevent ALSA from using mmap() interface to simplify emulation.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/mmap.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index e05caa0..c33e5fe 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -321,6 +321,9 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
return addr;
} }
+#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000 +#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000
@ -12,7 +24,7 @@ Index: qemu/linux-user/mmap.c
/* NOTE: all the constants are the HOST ones */ /* NOTE: all the constants are the HOST ones */
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot, abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
int flags, int fd, abi_ulong offset) int flags, int fd, abi_ulong offset)
@@ -194,6 +197,17 @@ @@ -356,6 +359,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
} }
#endif #endif
@ -29,4 +41,7 @@ Index: qemu/linux-user/mmap.c
+ +
if (offset & ~TARGET_PAGE_MASK) { if (offset & ~TARGET_PAGE_MASK) {
errno = EINVAL; errno = EINVAL;
return -1; goto fail;
--
1.6.2.1

View File

@ -0,0 +1,26 @@
From 3baf3b46ba7a653bdfdca59edb64f87d7b9a0671 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:25:41 +0200
Subject: [PATCH 06/33] qemu-cvs-gettimeofday
No clue what this is for.
---
linux-user/syscall.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7b57323..70d3b2d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5063,6 +5063,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_gettimeofday:
{
struct timeval tv;
+ if(copy_from_user_timeval(&tv, arg1))
+ goto efault;
ret = get_errno(gettimeofday(&tv, NULL));
if (!is_error(ret)) {
if (copy_to_user_timeval(arg1, &tv))
--
1.6.2.1

View File

@ -0,0 +1,33 @@
From dfc0f3252a5333ec9c70122c2ca9bb25578e0f2e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:26:33 +0200
Subject: [PATCH 07/33] qemu-cvs-ioctl_debug
Extends unsupported ioctl debug output.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 70d3b2d..ce5283c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2890,7 +2890,12 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {
- gemu_log("Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
+ int i;
+ gemu_log("Unsupported ioctl: cmd=0x%04lx (%x)\n", (unsigned long)cmd, (unsigned int)(cmd & (TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) >> TARGET_IOC_SIZESHIFT);
+ for(i=0;ioctl_entries[i].target_cmd;i++) {
+ if((ioctl_entries[i].target_cmd & ~(TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) == (cmd & ~(TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)))
+ gemu_log("%p\t->\t%s (%x)\n", (void *)(unsigned long)ioctl_entries[i].host_cmd, ioctl_entries[i].name, (ioctl_entries[i].target_cmd & (TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) >> TARGET_IOC_SIZESHIFT);
+ }
return -TARGET_ENOSYS;
}
if (ie->target_cmd == cmd)
--
1.6.2.1

View File

@ -0,0 +1,42 @@
From 0ae47f212081dde6ff4cbc44864003132b8a59ef Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:27:36 +0200
Subject: [PATCH 08/33] qemu-cvs-ioctl_nodirection
the direction given in the ioctl should be correct so we can assume the
communication is uni-directional. The alsa developers did not like this
concept though and declared ioctls IOC_R and IOC_W even though they were
IOC_RW.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ce5283c..b7230c7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -2920,6 +2920,11 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
arg_type++;
target_size = thunk_type_size(arg_type, 0);
switch(ie->access) {
+ /* FIXME: actually the direction given in the ioctl should be
+ * correct so we can assume the communication is uni-directional.
+ * The alsa developers did not like this concept though and
+ * declared ioctls IOC_R and IOC_W even though they were IOC_RW.*/
+/*
case IOC_R:
ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
if (!is_error(ret)) {
@@ -2938,6 +2943,7 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
unlock_user(argptr, arg, 0);
ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
break;
+*/
default:
case IOC_RW:
argptr = lock_user(VERIFY_READ, arg, target_size, 1);
--
1.6.2.1

View File

@ -1,7 +1,19 @@
Index: qemu.bkp/linux-user/path.c From 447a7055bbff636821fb9a559e9b8d30b1ab9391 Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- qemu-0.10.1/linux-user/path.c Date: Tue, 14 Apr 2009 16:28:45 +0200
+++ qemu-0.10.1/linux-user/path.c Subject: [PATCH 09/33] qemu-cvs-newpath
fast path mangling patch by Kirill A. Shutemov
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/path.c | 190 ++++++++++++++++-------------------------------------
1 files changed, 56 insertions(+), 134 deletions(-)
diff --git a/linux-user/path.c b/linux-user/path.c
index 06b1f5f..aedff50 100644
--- a/linux-user/path.c
+++ b/linux-user/path.c
@@ -1,159 +1,81 @@ @@ -1,159 +1,81 @@
/* Code to mangle pathnames into those matching a given prefix. /* Code to mangle pathnames into those matching a given prefix.
eg. open("/lib/foo.so") => open("/usr/gnemul/i386-linux/lib/foo.so"); eg. open("/lib/foo.so") => open("/usr/gnemul/i386-linux/lib/foo.so");
@ -149,7 +161,8 @@ Index: qemu.bkp/linux-user/path.c
- free(cwd); - free(cwd);
- } else - } else
- strcpy(pref_buf,prefix + 1); - strcpy(pref_buf,prefix + 1);
- + list_head = malloc(sizeof(struct path_list_head));
- base = new_entry("", NULL, pref_buf); - base = new_entry("", NULL, pref_buf);
- base = add_dir_maybe(base); - base = add_dir_maybe(base);
- if (base->num_entries == 0) { - if (base->num_entries == 0) {
@ -158,8 +171,6 @@ Index: qemu.bkp/linux-user/path.c
- } else { - } else {
- set_parents(base, base); - set_parents(base, base);
- } - }
+ list_head = malloc(sizeof(struct path_list_head));
+
+ /* first element of list is prefix */ + /* first element of list is prefix */
+ list_head->path = strdup(prefix); + list_head->path = strdup(prefix);
+ list_head->next = NULL; + list_head->next = NULL;
@ -178,13 +189,14 @@ Index: qemu.bkp/linux-user/path.c
Could do relative by tracking cwd. */ Could do relative by tracking cwd. */
- if (!base || !name || name[0] != '/') - if (!base || !name || name[0] != '/')
- return name; - return name;
-
- return follow_path(base, name) ?: name;
+ if (!list_head || result[0] != '/') + if (!list_head || result[0] != '/')
+ goto exit; + goto exit;
+ +
+ strncpy(newname, list_head->path, path_length); + strncpy(newname, list_head->path, path_length);
+ strncat(newname, name, path_length); + strncat(newname, name, path_length);
+
- return follow_path(base, name) ?: name;
+ /* look for place where path should be present */ + /* look for place where path should be present */
+ while ( list->next && (strcmp(list->next->path, newname) < 0) ) + while ( list->next && (strcmp(list->next->path, newname) < 0) )
+ list = list->next; + list = list->next;
@ -218,3 +230,6 @@ Index: qemu.bkp/linux-user/path.c
+ free(newname); + free(newname);
+ return result; + return result;
} }
--
1.6.2.1

View File

@ -1,16 +1,28 @@
Index: qemu.bkp/linux-user/syscall.c From 2c9c1dd32c9abf3ae72101782eada5a11c4334a5 Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- qemu-0.10.1/linux-user/syscall.c Date: Tue, 14 Apr 2009 16:30:16 +0200
+++ qemu-0.10.1/linux-user/syscall.c Subject: [PATCH 10/33] qemu-cvs-sched_getaffinity
@@ -157,6 +157,7 @@
Implements sched_getaffinity syscall.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b7230c7..faf41b1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -152,6 +152,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
}
#define __NR_sys_exit __NR_exit
+#define __NR_sys_sched_getaffinity __NR_sched_getaffinity +#define __NR_sys_sched_getaffinity __NR_sched_getaffinity
#define __NR_sys_uname __NR_uname #define __NR_sys_uname __NR_uname
#define __NR_sys_faccessat __NR_faccessat #define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat #define __NR_sys_fchmodat __NR_fchmodat
@@ -265,6 +266,9 @@ @@ -213,6 +214,9 @@ _syscall3(int,sys_tgkill,int,tgid,int,pid,int,sig)
#if defined(TARGET_NR_tkill) && defined(__NR_tkill) #if defined(TARGET_NR_tkill) && defined(__NR_tkill)
_syscall2(int,sys_tkill,int,tid,int,sig) _syscall2(int,sys_tkill,int,tid,int,sig)
#endif #endif
@ -20,10 +32,11 @@ Index: qemu.bkp/linux-user/syscall.c
#ifdef __NR_exit_group #ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code) _syscall1(int,exit_group,int,error_code)
#endif #endif
@@ -6090,6 +6094,17 @@ @@ -6979,6 +6983,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break; break;
#endif #endif
#endif /* CONFIG_SPLICE */
+
+#ifdef TARGET_NR_sched_getaffinity +#ifdef TARGET_NR_sched_getaffinity
+ case TARGET_NR_sched_getaffinity: + case TARGET_NR_sched_getaffinity:
+ { + {
@ -38,3 +51,6 @@ Index: qemu.bkp/linux-user/syscall.c
default: default:
unimplemented: unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num); gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.6.2.1

View File

@ -0,0 +1,41 @@
From b8637036b678276513dd920045016b0e8c37df4d Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:34:05 +0200
Subject: [PATCH 11/33] qemu-cvs-mmap-amd64
Map stuff to address space < 4GB on AMD64. This patch got continually smaller
as most cases were this was an issue were dealt with in other ways. May
already be fully obsolete.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/mmap.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index c33e5fe..9ca8f6f 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -31,6 +31,10 @@
#include "qemu.h"
#include "qemu-common.h"
+#if !defined(MAP_32BIT)
+#define MAP_32BIT 0
+#endif
+
//#define DEBUG_MMAP
#if defined(USE_NPTL)
@@ -230,7 +234,7 @@ static int mmap_frag(abi_ulong real_start,
if (prot1 == 0) {
/* no page was there, so we allocate one */
void *p = mmap(host_start, qemu_host_page_size, prot,
- flags | MAP_ANONYMOUS, -1, 0);
+ flags | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (p == MAP_FAILED)
return -1;
prot1 = prot;
--
1.6.2.1

View File

@ -0,0 +1,28 @@
From 09e232e1084dd42cf233fcac97816851b9261693 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:34:36 +0200
Subject: [PATCH 12/33] qemu-cvs-pthread
Link with libpthread. Not sure if still necessary.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index dc95869..ecc30ce 100644
--- a/Makefile
+++ b/Makefile
@@ -19,7 +19,7 @@ VPATH=$(SRC_PATH):$(SRC_PATH)/hw
CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP -MT $@
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CPPFLAGS += -U_FORTIFY_SOURCE
-LIBS=
+LIBS=-lpthread
ifdef CONFIG_STATIC
LDFLAGS += -static
endif
--
1.6.2.1

View File

@ -0,0 +1,142 @@
From 8acba6ba3add1b4e463f6fce711357e3c7c70555 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:37:42 +0200
Subject: [PATCH 13/33] qemu-img-vmdk-scsi
Support creation of SCSI VMDK images in qemu-img.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
block/vmdk.c | 5 +++--
block_int.h | 1 +
qemu-img-cmds.hx | 8 ++++----
qemu-img.c | 15 +++++++++++++--
4 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/block/vmdk.c b/block/vmdk.c
index 4e48622..b7a15c7 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -710,7 +710,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
"ddb.geometry.cylinders = \"%" PRId64 "\"\n"
"ddb.geometry.heads = \"16\"\n"
"ddb.geometry.sectors = \"63\"\n"
- "ddb.adapterType = \"ide\"\n";
+ "ddb.adapterType = \"%s\"\n";
char desc[1024];
const char *real_filename, *temp_str;
int64_t total_size = 0;
@@ -800,7 +800,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL),
total_size, real_filename,
(flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
- total_size / (int64_t)(63 * 16));
+ total_size / (int64_t)(63 * 16),
+ flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide");
/* write the descriptor */
lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);
diff --git a/block_int.h b/block_int.h
index 8898d91..d482050 100644
--- a/block_int.h
+++ b/block_int.h
@@ -30,6 +30,7 @@
#define BLOCK_FLAG_ENCRYPT 1
#define BLOCK_FLAG_COMPRESS 2
#define BLOCK_FLAG_COMPAT6 4
+#define BLOCK_FLAG_SCSI 8
#define BLOCK_OPT_SIZE "size"
#define BLOCK_OPT_ENCRYPT "encryption"
diff --git a/qemu-img-cmds.hx b/qemu-img-cmds.hx
index ddb86f0..be94d22 100644
--- a/qemu-img-cmds.hx
+++ b/qemu-img-cmds.hx
@@ -16,9 +16,9 @@ STEXI
ETEXI
DEF("create", img_create,
- "create [-F fmt] [-b base_image] [-f fmt] [-o options] filename [size]")
+ "create [-s] [-F fmt] [-b base_image] [-f fmt] [-o options] filename [size]")
STEXI
-@item create [-F @var{base_fmt}] [-b @var{base_image}] [-f @var{fmt}] [-o @var{options}] @var{filename} [@var{size}]
+@item create [-s] [-F @var{base_fmt}] [-b @var{base_image}] [-f @var{fmt}] [-o @var{options}] @var{filename} [@var{size}]
ETEXI
DEF("commit", img_commit,
@@ -28,9 +28,9 @@ STEXI
ETEXI
DEF("convert", img_convert,
- "convert [-c] [-f fmt] [-O output_fmt] [-o options] [-B output_base_image] filename [filename2 [...]] output_filename")
+ "convert [-c] [-s] [-f fmt] [-O output_fmt] [-o options] [-B output_base_image] filename [filename2 [...]] output_filename")
STEXI
-@item convert [-c] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-B @var{output_base_image}] @var{filename} [@var{filename2} [...]] @var{output_filename}
+@item convert [-c] [-s] [-f @var{fmt}] [-O @var{output_fmt}] [-o @var{options}] [-B @var{output_base_image}] @var{filename} [@var{filename2} [...]] @var{output_filename}
ETEXI
DEF("info", img_info,
diff --git a/qemu-img.c b/qemu-img.c
index 070fe2e..2adeb56 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -259,7 +259,7 @@ static int img_create(int argc, char **argv)
flags = 0;
for(;;) {
- c = getopt(argc, argv, "F:b:f:he6o:");
+ c = getopt(argc, argv, "F:b:f:hes6o:");
if (c == -1)
break;
switch(c) {
@@ -278,6 +278,9 @@ static int img_create(int argc, char **argv)
case 'e':
flags |= BLOCK_FLAG_ENCRYPT;
break;
+ case 's':
+ flags |= BLOCK_FLAG_SCSI;
+ break;
case '6':
flags |= BLOCK_FLAG_COMPAT6;
break;
@@ -357,6 +360,8 @@ static int img_create(int argc, char **argv)
printf("Formatting '%s', fmt=%s ", filename, fmt);
print_option_parameters(param);
+ if (flags & BLOCK_FLAG_SCSI)
+ printf(", SCSI");
puts("");
ret = bdrv_create(drv, filename, param);
@@ -551,7 +556,7 @@ static int img_convert(int argc, char **argv)
out_baseimg = NULL;
flags = 0;
for(;;) {
- c = getopt(argc, argv, "f:O:B:hce6o:");
+ c = getopt(argc, argv, "f:O:B:hces6o:");
if (c == -1)
break;
switch(c) {
@@ -573,6 +578,9 @@ static int img_convert(int argc, char **argv)
case 'e':
flags |= BLOCK_FLAG_ENCRYPT;
break;
+ case 's':
+ flags |= BLOCK_FLAG_SCSI;
+ break;
case '6':
flags |= BLOCK_FLAG_COMPAT6;
break;
@@ -639,6 +647,9 @@ static int img_convert(int argc, char **argv)
}
}
+ if (flags & BLOCK_FLAG_SCSI && strcmp(drv->format_name, "vmdk"))
+ error("SCSI devices not supported for this file format");
+
/* Create the new image */
ret = bdrv_create(drv, out_filename, param);
free_option_parameters(param);
--
1.6.2.1

View File

@ -0,0 +1,40 @@
From e880deb6d14c779cd9ecca4a25168c162183200e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:38:20 +0200
Subject: [PATCH 14/33] qemu-nonvoid_return
Squelches GCC warnings about undefined return values.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
hw/mpcore.c | 1 +
target-m68k/translate.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hw/mpcore.c b/hw/mpcore.c
index 907bd99..a682695 100644
--- a/hw/mpcore.c
+++ b/hw/mpcore.c
@@ -108,6 +108,7 @@ static uint32_t mpcore_timer_read(mpcore_timer_state *s, int offset)
default:
return 0;
}
+ return 0;
}
static void mpcore_timer_write(mpcore_timer_state *s, int offset,
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index b37578b..feaa155 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -440,6 +440,7 @@ static inline int opsize_bytes(int opsize)
qemu_assert(0, "bad operand size");
return 0;
}
+ return 0;
}
/* Assign value to a register. If the width is less than the register width
--
1.6.2.1

View File

@ -1,8 +1,23 @@
Index: Makefile.target From 0792daad3fd53b5fb841fc6ed0e8ec6a06e8479a Mon Sep 17 00:00:00 2001
================================================================================ From: Ulrich Hecht <uli@suse.de>
--- Makefile.target Date: Tue, 14 Apr 2009 16:52:51 +0200
+++ Makefile.target Subject: [PATCH 15/33] pcap network emulation
@@ -690,6 +690,9 @@
Implements network emulation using libpcap; useful for direct Ethernet access.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
Makefile.target | 3 ++
configure | 7 ++++
net.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
qemu-options.hx | 4 ++
4 files changed, 122 insertions(+), 0 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index f9cd42a..9c9304c 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -618,6 +618,9 @@ endif
ifdef CONFIG_SLIRP ifdef CONFIG_SLIRP
CPPFLAGS+=-I$(SRC_PATH)/slirp CPPFLAGS+=-I$(SRC_PATH)/slirp
endif endif
@ -10,19 +25,21 @@ Index: Makefile.target
+LIBS+=-lpcap +LIBS+=-lpcap
+endif +endif
LIBS+=$(AIOLIBS)
# specific flags are needed for non soft mmu emulator # specific flags are needed for non soft mmu emulator
--- configure ifdef CONFIG_STATIC
+++ configure diff --git a/configure b/configure
@@ -160,6 +160,7 @@ index 2a6ae40..d104413 100755
gdbstub="yes" --- a/configure
+++ b/configure
@@ -169,6 +169,7 @@ mingw32="no"
EXESUF=""
slirp="yes" slirp="yes"
vde="yes" vde="yes"
+pcap="yes" +pcap="yes"
fmod_lib="" fmod_lib=""
fmod_inc="" fmod_inc=""
oss_lib="" oss_lib=""
@@ -392,6 +393,8 @@ @@ -432,6 +433,8 @@ for opt do
;; ;;
--disable-vde) vde="no" --disable-vde) vde="no"
;; ;;
@ -30,21 +47,23 @@ Index: Makefile.target
+ ;; + ;;
--disable-kqemu) kqemu="no" --disable-kqemu) kqemu="no"
;; ;;
--disable-brlapi) brlapi="no" --disable-xen) xen="no"
@@ -1353,6 +1356,10 @@ @@ -1598,6 +1601,10 @@ if test "$vde" = "yes" ; then
echo "#define CONFIG_VDE 1" >> $config_h echo "#define CONFIG_VDE 1" >> $config_host_h
echo "VDE_LIBS=-lvdeplug" >> $config_mak echo "VDE_LIBS=-lvdeplug" >> $config_host_mak
fi fi
+if test "$pcap" = "yes" ; then +if test "$pcap" = "yes" ; then
+ echo "CONFIG_PCAP=yes" >> $config_mak + echo "CONFIG_PCAP=yes" >> $config_host_mak
+ echo "#define CONFIG_PCAP 1" >> $config_h + echo "#define CONFIG_PCAP 1" >> $config_host_h
+fi +fi
for card in $audio_card_list; do for card in $audio_card_list; do
def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'` def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
echo "$def=yes" >> $config_mak echo "$def=y" >> $config_host_mak
--- net.c diff --git a/net.c b/net.c
+++ net.c index cf6b033..b321135 100644
@@ -689,6 +689,104 @@ --- a/net.c
+++ b/net.c
@@ -1270,6 +1270,105 @@ void do_info_usernet(Monitor *mon)
#endif /* CONFIG_SLIRP */ #endif /* CONFIG_SLIRP */
@ -55,11 +74,12 @@ Index: Makefile.target
+ pcap_t *handle; + pcap_t *handle;
+} PCAPState; +} PCAPState;
+ +
+static void pcap_receive(void *opaque, const uint8_t *buf, int size) +static ssize_t pcap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
+{ +{
+ PCAPState *s = (PCAPState *)opaque; + PCAPState *s = (PCAPState *)(vc->opaque);
+ +
+ pcap_sendpacket(s->handle, (u_char*)buf, size); + pcap_sendpacket(s->handle, (u_char*)buf, size);
+ return size;
+} +}
+ +
+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata) +static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata)
@ -125,7 +145,7 @@ Index: Makefile.target
+ } + }
+#endif /* BIOCIMMEDIATE */ +#endif /* BIOCIMMEDIATE */
+ +
+ s->vc = qemu_new_vlan_client(vlan, model, name, pcap_receive, NULL, s); + s->vc = qemu_new_vlan_client(vlan, model, name, NULL, pcap_receive, NULL, NULL, s);
+ snprintf(s->vc->info_str, sizeof(s->vc->info_str), "pcap redirector"); + snprintf(s->vc->info_str, sizeof(s->vc->info_str), "pcap redirector");
+ if ((fd = pcap_get_selectable_fd(s->handle)) < 0) { + if ((fd = pcap_get_selectable_fd(s->handle)) < 0) {
+ fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n"); + fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
@ -149,12 +169,10 @@ Index: Makefile.target
#if !defined(_WIN32) #if !defined(_WIN32)
typedef struct TAPState { typedef struct TAPState {
@@ -1656,7 +1754,17 @@ @@ -2636,6 +2735,15 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
} ret = 0;
vlan->nb_host_devs++; } else
ret = net_slirp_init(vlan, device, name); #endif
- } else if (!strcmp(device, "channel")) {
+ } else
+#ifdef CONFIG_PCAP +#ifdef CONFIG_PCAP
+ if (!strcmp(device, "pcap")) { + if (!strcmp(device, "pcap")) {
+ char ifname[64]; + char ifname[64];
@ -164,15 +182,16 @@ Index: Makefile.target
+ ret = net_pcap_init(vlan, device, name, ifname); + ret = net_pcap_init(vlan, device, name, ifname);
+ } else + } else
+#endif +#endif
+ if (!strcmp(device, "channel")) { #ifdef _WIN32
long port; if (!strcmp(device, "tap")) {
char name[20], *devname; static const char * const tap_params[] = {
struct VMChannel *vmc; diff --git a/qemu-options.hx b/qemu-options.hx
--- vl.c index a58287c..4d46d6c 100644
+++ vl.c --- a/qemu-options.hx
@@ -3990,6 +3994,10 @@ +++ b/qemu-options.hx
" use '[down]script=no' to disable script execution;\n" @@ -801,6 +801,10 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
" use 'fd=h' to connect to an already opened TAP interface\n" " default of 'sndbuf=1048576' can be disabled using 'sndbuf=0'\n"
#endif
#endif #endif
+#ifdef CONFIG_PCAP +#ifdef CONFIG_PCAP
+ "-net pcap[,vlan=n][,ifname=name]\n" + "-net pcap[,vlan=n][,ifname=name]\n"
@ -181,3 +200,6 @@ Index: Makefile.target
"-net socket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]\n" "-net socket[,vlan=n][,name=str][,fd=h][,listen=[host]:port][,connect=host:port]\n"
" connect the vlan 'n' to another VLAN using a socket connection\n" " connect the vlan 'n' to another VLAN using a socket connection\n"
"-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]\n" "-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]\n"
--
1.6.2.1

View File

@ -0,0 +1,64 @@
From d6f4cb8539685ddb6f3ecd8f043c33a3213b0d56 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 16 Apr 2009 15:14:12 +0200
Subject: [PATCH 16/33] i386-linux-user NPTL support
Makes NPTL binaries run by implementing TLS.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
configure | 1 +
linux-user/syscall.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index d104413..97ca826 100755
--- a/configure
+++ b/configure
@@ -1901,6 +1901,7 @@ TARGET_ABI_DIR=""
case "$target_arch2" in
i386)
target_phys_bits=32
+ target_nptl="yes"
;;
x86_64)
TARGET_BASE_ARCH=i386
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index faf41b1..87ceac7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3575,8 +3575,14 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
ts->child_tidptr = child_tidptr;
}
- if (nptl_flags & CLONE_SETTLS)
+ if (nptl_flags & CLONE_SETTLS) {
+#if defined(TARGET_I386) && defined(TARGET_ABI32)
+ do_set_thread_area(new_env, newtls);
+ cpu_x86_load_seg(new_env, R_GS, new_env->segs[R_GS].selector);
+#else
cpu_set_tls (new_env, newtls);
+#endif
+ }
/* Grab a mutex so that thread setup appears atomic. */
pthread_mutex_lock(&clone_lock);
@@ -3648,8 +3654,14 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
if (flags & CLONE_PARENT_SETTID)
put_user_u32(gettid(), parent_tidptr);
ts = (TaskState *)env->opaque;
- if (flags & CLONE_SETTLS)
+ if (flags & CLONE_SETTLS) {
+#if defined(TARGET_I386) && defined(TARGET_ABI32)
+ do_set_thread_area(env, newtls);
+ cpu_x86_load_seg(env, R_GS, env->segs[R_GS].selector);
+#else
cpu_set_tls (env, newtls);
+#endif
+ }
if (flags & CLONE_CHILD_CLEARTID)
ts->child_tidptr = child_tidptr;
#endif
--
1.6.2.1

View File

@ -0,0 +1,25 @@
From dc645f74998b4beeee36b37e81c3a358e75be0b1 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 17 Jun 2009 14:54:48 +0200
Subject: [PATCH 17/33] qemu-0.11-git-ioctl_mount
---
linux-user/ioctls.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index aee5a88..a0fb052 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -310,7 +310,7 @@
IOCTL(LOOP_CLR_FD, 0, TYPE_INT)
IOCTL(LOOP_SET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
IOCTL(LOOP_GET_STATUS, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info)))
-#if 0 /* These have some problems - not fully tested */
+#if 1 /* These have some problems - not fully tested */
IOCTL(LOOP_SET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
IOCTL(LOOP_GET_STATUS64, IOC_W, MK_PTR(MK_STRUCT(STRUCT_loop_info64)))
#endif
--
1.6.2.1

View File

@ -0,0 +1,116 @@
From 075e9351395b1000568b215589eb3f1f7fdcb7a1 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 17 Jun 2009 15:08:38 +0200
Subject: [PATCH 18/33] qemu-0.11-git-user-linux-ppc-uid16_fix
---
linux-user/ppc/syscall_nr.h | 30 +++++++++++++++---------------
linux-user/syscall_defs.h | 2 +-
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/linux-user/ppc/syscall_nr.h b/linux-user/ppc/syscall_nr.h
index f54276b..cc84a4c 100644
--- a/linux-user/ppc/syscall_nr.h
+++ b/linux-user/ppc/syscall_nr.h
@@ -17,15 +17,15 @@
#define TARGET_NR_time 13
#define TARGET_NR_mknod 14
#define TARGET_NR_chmod 15
-#define TARGET_NR_lchown32 16
+#define TARGET_NR_lchown 16
#define TARGET_NR_break 17
#define TARGET_NR_oldstat 18
#define TARGET_NR_lseek 19
#define TARGET_NR_getpid 20
#define TARGET_NR_mount 21
#define TARGET_NR_umount 22
-#define TARGET_NR_setuid32 23
-#define TARGET_NR_getuid32 24
+#define TARGET_NR_setuid 23
+#define TARGET_NR_getuid 24
#define TARGET_NR_stime 25
#define TARGET_NR_ptrace 26
#define TARGET_NR_alarm 27
@@ -47,11 +47,11 @@
#define TARGET_NR_times 43
#define TARGET_NR_prof 44
#define TARGET_NR_brk 45
-#define TARGET_NR_setgid32 46
-#define TARGET_NR_getgid32 47
+#define TARGET_NR_setgid 46
+#define TARGET_NR_getgid 47
#define TARGET_NR_signal 48
-#define TARGET_NR_geteuid32 49
-#define TARGET_NR_getegid32 50
+#define TARGET_NR_geteuid 49
+#define TARGET_NR_getegid 50
#define TARGET_NR_acct 51
#define TARGET_NR_umount2 52
#define TARGET_NR_lock 53
@@ -71,8 +71,8 @@
#define TARGET_NR_sigaction 67
#define TARGET_NR_sgetmask 68
#define TARGET_NR_ssetmask 69
-#define TARGET_NR_setreuid32 70
-#define TARGET_NR_setregid32 71
+#define TARGET_NR_setreuid 70
+#define TARGET_NR_setregid 71
#define TARGET_NR_sigsuspend 72
#define TARGET_NR_sigpending 73
#define TARGET_NR_sethostname 74
@@ -81,8 +81,8 @@
#define TARGET_NR_getrusage 77
#define TARGET_NR_gettimeofday 78
#define TARGET_NR_settimeofday 79
-#define TARGET_NR_getgroups32 80
-#define TARGET_NR_setgroups32 81
+#define TARGET_NR_getgroups 80
+#define TARGET_NR_setgroups 81
#define TARGET_NR_select 82
#define TARGET_NR_symlink 83
#define TARGET_NR_oldlstat 84
@@ -96,7 +96,7 @@
#define TARGET_NR_truncate 92
#define TARGET_NR_ftruncate 93
#define TARGET_NR_fchmod 94
-#define TARGET_NR_fchown32 95
+#define TARGET_NR_fchown 95
#define TARGET_NR_getpriority 96
#define TARGET_NR_setpriority 97
#define TARGET_NR_profil 98
@@ -139,8 +139,8 @@
#define TARGET_NR_sysfs 135
#define TARGET_NR_personality 136
#define TARGET_NR_afs_syscall 137 /* Syscall for Andrew File System */
-#define TARGET_NR_setfsuid32 138
-#define TARGET_NR_setfsgid32 139
+#define TARGET_NR_setfsuid 138
+#define TARGET_NR_setfsgid 139
#define TARGET_NR__llseek 140
#define TARGET_NR_getdents 141
#define TARGET_NR__newselect 142
@@ -182,7 +182,7 @@
#define TARGET_NR_rt_sigsuspend 178
#define TARGET_NR_pread64 179
#define TARGET_NR_pwrite64 180
-#define TARGET_NR_chown32 181
+#define TARGET_NR_chown 181
#define TARGET_NR_getcwd 182
#define TARGET_NR_capget 183
#define TARGET_NR_capset 184
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 78c6488..0cbe396 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -49,7 +49,7 @@
#define TARGET_IOC_TYPEBITS 8
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
- || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
+ || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) || defined(TARGET_PPC)
/* 16 bit uid wrappers emulation */
#define USE_UID16
#endif
--
1.6.2.1

View File

@ -0,0 +1,125 @@
From c77c088e30c44fc8677d7d95cb2180d8dfb43b1c Mon Sep 17 00:00:00 2001
From: Kirill A. Shutemov <kirill@shutemov.name>
Date: Wed, 17 Jun 2009 15:14:43 +0200
Subject: [PATCH 19/33] Rewrite mmap_find_vma() to work fine on 64-bit hosts with 32-bit targets
From: Kirill A. Shutemov <kirill@shutemov.name>
qemu's page table can be incomple if /proc/self/maps is unavailable or
host allocating a memory with mmap(), so we can't use it to find free
memory area.
New version mmap_find_vma() uses mmap() without MAP_FIXED to find free
memory.
From: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
linux-user/mmap.c | 79 +++++++++++++++++++++++++++++------------------------
1 files changed, 43 insertions(+), 36 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 9ca8f6f..8d94783 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -277,52 +277,59 @@ static abi_ulong mmap_next_start = 0x40000000;
unsigned long last_brk;
-/* find a free memory area of size 'size'. The search starts at
- 'start'. If 'start' == 0, then a default start address is used.
- Return -1 if error.
-*/
-/* page_init() marks pages used by the host as reserved to be sure not
- to use them. */
+/*
+ * Find and reserve a free memory area of size 'size'. The search
+ * starts at 'start'.
+ * It must be called with mmap_lock() held.
+ * Return -1 if error.
+ */
abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
{
- abi_ulong addr, addr1, addr_start;
- int prot;
- unsigned long new_brk;
-
- new_brk = (unsigned long)sbrk(0);
- if (last_brk && last_brk < new_brk && last_brk == (target_ulong)last_brk) {
- /* This is a hack to catch the host allocating memory with brk().
- If it uses mmap then we loose.
- FIXME: We really want to avoid the host allocating memory in
- the first place, and maybe leave some slack to avoid switching
- to mmap. */
- page_set_flags(last_brk & TARGET_PAGE_MASK,
- TARGET_PAGE_ALIGN(new_brk),
- PAGE_RESERVED);
- }
- last_brk = new_brk;
+ void *ptr;
+ abi_ulong addr;
size = HOST_PAGE_ALIGN(size);
- start = start & qemu_host_page_mask;
+ start &= qemu_host_page_mask;
+
+ /* If 'start' == 0, then a default start address is used. */
+ if (start == 0)
+ start = mmap_next_start;
+
addr = start;
- if (addr == 0)
- addr = mmap_next_start;
- addr_start = addr;
+
for(;;) {
- prot = 0;
- for(addr1 = addr; addr1 < (addr + size); addr1 += TARGET_PAGE_SIZE) {
- prot |= page_get_flags(addr1);
- }
- if (prot == 0)
+ /*
+ * Reserve needed memory area to avoid a race.
+ * It should be discarded using:
+ * - mmap() with MAP_FIXED flag
+ * - mremap() with MREMAP_FIXED flag
+ * - shmat() with SHM_REMAP flag
+ */
+ ptr = mmap((void *)(unsigned long)addr, size, PROT_NONE,
+ MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
+
+ /* ENOMEM, if host address space has no memory */
+ if (ptr == MAP_FAILED)
+ return (abi_ulong)-1;
+
+ /* If address fits target address space we've found what we need */
+ if ((unsigned long)ptr + size - 1 <= (abi_ulong)-1)
break;
+
+ /* Unmap and try again with new page */
+ munmap(ptr, size);
addr += qemu_host_page_size;
- /* we found nothing */
- if (addr == addr_start)
+
+ /* ENOMEM if we check whole of target address space */
+ if (addr == start)
return (abi_ulong)-1;
}
- if (start == 0)
- mmap_next_start = addr + size;
- return addr;
+
+ /* Update default start address */
+ if (start == mmap_next_start)
+ mmap_next_start = (unsigned long)ptr + size;
+
+ return h2g(ptr);
}
#define SNDRV_PCM_MMAP_OFFSET_STATUS 0x80000000
--
1.6.2.1

View File

@ -0,0 +1,82 @@
From 3d1745fd8e80e99b435b63b650b9b31202aace6c Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Fri, 24 Jul 2009 17:25:37 +0200
Subject: [PATCH 20/33] TCG "sync" op (32-bit targets fixed)
sync allows concurrent accesses to locations in memory through different TCG
variables. This comes in handy when you are emulating CPU registers that can
be used as either 32 or 64 bit, as TCG doesn't know anything about aliases.
See the s390x target for an example.
Fixed to not break 32-bit target builds.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
tcg/tcg-op.h | 12 ++++++++++++
tcg/tcg-opc.h | 2 ++
tcg/tcg.c | 6 ++++++
3 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
index f3f2f71..6bcaf5b 100644
--- a/tcg/tcg-op.h
+++ b/tcg/tcg-op.h
@@ -316,6 +316,18 @@ static inline void tcg_gen_br(int label)
tcg_gen_op1i(INDEX_op_br, label);
}
+static inline void tcg_gen_sync_i32(TCGv_i32 arg)
+{
+ tcg_gen_op1_i32(INDEX_op_sync_i32, arg);
+}
+
+#if TCG_TARGET_REG_BITS == 64
+static inline void tcg_gen_sync_i64(TCGv_i64 arg)
+{
+ tcg_gen_op1_i64(INDEX_op_sync_i64, arg);
+}
+#endif
+
static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg)
{
if (!TCGV_EQUAL_I32(ret, arg))
diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
index 3a095fc..654a45f 100644
--- a/tcg/tcg-opc.h
+++ b/tcg/tcg-opc.h
@@ -40,6 +40,7 @@ DEF2(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */
DEF2(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
DEF2(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
+DEF2(sync_i32, 0, 1, 0, 0)
DEF2(mov_i32, 1, 1, 0, 0)
DEF2(movi_i32, 1, 0, 1, 0)
/* load/store */
@@ -103,6 +104,7 @@ DEF2(neg_i32, 1, 1, 0, 0)
#endif
#if TCG_TARGET_REG_BITS == 64
+DEF2(sync_i64, 0, 1, 0, 0)
DEF2(mov_i64, 1, 1, 0, 0)
DEF2(movi_i64, 1, 0, 1, 0)
/* load/store */
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 299bff6..86e16fa 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -1927,6 +1927,12 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
// dump_regs(s);
#endif
switch(opc) {
+ case INDEX_op_sync_i32:
+#if TCG_TARGET_REG_BITS == 64
+ case INDEX_op_sync_i64:
+#endif
+ temp_save(s, args[0], s->reserved_regs);
+ break;
case INDEX_op_mov_i32:
#if TCG_TARGET_REG_BITS == 64
case INDEX_op_mov_i64:
--
1.6.2.1

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,127 @@
From 5353e78aaf5746e4d911d14df75557b1dac5166b Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Fri, 24 Jul 2009 17:03:48 +0200
Subject: [PATCH 22/33] S/390 host/target build system support
changes to configure and makefiles for S/390 host and target support,
fixed as suggested by Juan Quintela
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
Makefile.target | 9 +++++++++
configure | 19 ++++++++++++++-----
2 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/Makefile.target b/Makefile.target
index 9c9304c..1080bf0 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -84,6 +84,9 @@ CPPFLAGS+=-I$(SRC_PATH)/tcg -I$(SRC_PATH)/tcg/$(ARCH)
ifeq ($(ARCH),sparc64)
CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
endif
+ifeq ($(ARCH),s390x)
+CPPFLAGS+=-I$(SRC_PATH)/tcg/s390
+endif
ifdef CONFIG_SOFTFLOAT
libobj-y += fpu/softfloat.o
else
@@ -211,6 +214,9 @@ endif
ifeq ($(ARCH),s390)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
+ifeq ($(ARCH),s390x)
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
ifeq ($(ARCH),sparc)
# -static is used to avoid g1/g3 usage by the dynamic linker
@@ -358,6 +364,9 @@ endif
ifeq ($(ARCH),s390)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
+ifeq ($(ARCH),s390x)
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
ifeq ($(ARCH),sparc)
# -static is used to avoid g1/g3 usage by the dynamic linker
diff --git a/configure b/configure
index 97ca826..68fa1c1 100755
--- a/configure
+++ b/configure
@@ -146,9 +146,12 @@ case "$cpu" in
ppc64)
cpu="ppc64"
;;
- s390*)
+ s390)
cpu="s390"
;;
+ s390x)
+ cpu="s390x"
+ ;;
sparc|sun4[cdmuv])
cpu="sparc"
;;
@@ -745,6 +748,7 @@ sh4eb-linux-user \
sparc-linux-user \
sparc64-linux-user \
sparc32plus-linux-user \
+s390x-linux-user \
"
fi
# the following are Darwin specific
@@ -809,6 +813,7 @@ hostlongbits="32"
if test "$cpu" = "x86_64" \
-o "$cpu" = "alpha" \
-o "$cpu" = "ia64" \
+ -o "$cpu" = "s390x" \
-o "$cpu" = "sparc64" \
-o "$cpu" = "ppc64"; then
hostlongbits="64"
@@ -1499,10 +1504,10 @@ echo "EXESUF=$EXESUF" >> $config_host_mak
echo "PTHREADLIBS=$PTHREADLIBS" >> $config_host_mak
echo "CLOCKLIBS=$CLOCKLIBS" >> $config_host_mak
case "$cpu" in
- i386|x86_64|alpha|cris|hppa|ia64|m68k|microbaze|mips|mips64|ppc|ppc64|s390|sparc|sparc64)
+ i386|x86_64|alpha|cris|hppa|ia64|m68k|microblaze|mips|mips64|ppc|ppc64|s390|s390x|sparc|sparc64)
ARCH=$cpu
;;
- armv4b|arm4l)
+ armv4b|armv4l)
ARCH=arm
;;
*)
@@ -1834,7 +1839,7 @@ config_h=$target_dir/config.h
target_arch2=`echo $target | cut -d '-' -f 1`
target_bigendian="no"
case "$target_arch2" in
- armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|sh4eb|sparc|sparc64|sparc32plus)
+ armeb|m68k|microblaze|mips|mipsn32|mips64|ppc|ppcemb|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus)
target_bigendian=yes
;;
esac
@@ -1994,6 +1999,10 @@ case "$target_arch2" in
echo "TARGET_ABI32=y" >> $config_mak
target_phys_bits=64
;;
+ s390x)
+ target_nptl="yes"
+ target_phys_bits=64
+ ;;
*)
echo "Unsupported target CPU"
exit 1
@@ -2062,7 +2071,7 @@ fi
echo "TARGET_XML_FILES=$list" >> $config_mak
case "$target_arch2" in
- arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|sparc|sparc64|sparc32plus)
+ arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
echo "CONFIG_SOFTFLOAT=y" >> $config_mak
;;
esac
--
1.6.2.1

View File

@ -1,7 +1,58 @@
Index: s390x.ld From 228583bc998d19294856092dadbeec5dc7087f12 Mon Sep 17 00:00:00 2001
=================================================================== From: Ulrich Hecht <uli@suse.de>
--- s390x.ld (revision 0) Date: Fri, 24 Jul 2009 17:00:17 +0200
+++ s390x.ld (revision 0) Subject: [PATCH 23/33] S/390 host support for TCG
S/390 TCG code generator as posted before
improvements since last time:
- don't use R0 (often means "zero", not "register zero")
- optimized add_i32 immediate
- formatted for better compliance with the QEMU coding style
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
dyngen-exec.h | 2 +-
linux-user/syscall.c | 2 +-
s390x.ld | 194 +++++++++
tcg/s390/tcg-target.c | 1145 +++++++++++++++++++++++++++++++++++++++++++++++++
tcg/s390/tcg-target.h | 76 ++++
5 files changed, 1417 insertions(+), 2 deletions(-)
create mode 100644 s390x.ld
create mode 100644 tcg/s390/tcg-target.c
create mode 100644 tcg/s390/tcg-target.h
diff --git a/dyngen-exec.h b/dyngen-exec.h
index c007763..606ee11 100644
--- a/dyngen-exec.h
+++ b/dyngen-exec.h
@@ -119,7 +119,7 @@ extern int printf(const char *, ...);
/* The return address may point to the start of the next instruction.
Subtracting one gets us the call instruction itself. */
-#if defined(__s390__)
+#if defined(__s390__) && !defined(__s390x__)
# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1))
#elif defined(__arm__)
/* Thumb return addresses have the low bit set, so we need to subtract two.
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 87ceac7..548be54 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -182,7 +182,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
#define __NR_sys_inotify_add_watch __NR_inotify_add_watch
#define __NR_sys_inotify_rm_watch __NR_inotify_rm_watch
-#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
+#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) || defined(__s390x__)
#define __NR__llseek __NR_lseek
#endif
diff --git a/s390x.ld b/s390x.ld
new file mode 100644
index 0000000..7d1f2b7
--- /dev/null
+++ b/s390x.ld
@@ -0,0 +1,194 @@ @@ -0,0 +1,194 @@
+/* Default linker script, for normal executables */ +/* Default linker script, for normal executables */
+OUTPUT_FORMAT("elf64-s390", "elf64-s390", +OUTPUT_FORMAT("elf64-s390", "elf64-s390",
@ -197,88 +248,12 @@ Index: s390x.ld
+ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) } + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
+ /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) } + /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
+} +}
Index: dyngen-exec.h diff --git a/tcg/s390/tcg-target.c b/tcg/s390/tcg-target.c
=================================================================== new file mode 100644
--- dyngen-exec.h (revision 6883) index 0000000..0b285cd
+++ dyngen-exec.h (working copy) --- /dev/null
@@ -162,7 +162,7 @@ +++ b/tcg/s390/tcg-target.c
@@ -0,0 +1,1145 @@
/* The return address may point to the start of the next instruction.
Subtracting one gets us the call instruction itself. */
-#if defined(__s390__)
+#if defined(__s390__) && !defined(__s390x__)
# define GETPC() ((void*)(((unsigned long)__builtin_return_address(0) & 0x7fffffffUL) - 1))
#elif defined(__arm__)
/* Thumb return addresses have the low bit set, so we need to subtract two.
Index: Makefile.target
===================================================================
--- Makefile.target (revision 6883)
+++ Makefile.target (working copy)
@@ -145,6 +145,9 @@
ifeq ($(ARCH),sparc64)
CPPFLAGS+=-I$(SRC_PATH)/tcg/sparc
endif
+ifeq ($(ARCH),s390x)
+CPPFLAGS+=-I$(SRC_PATH)/tcg/s390
+endif
ifdef CONFIG_SOFTFLOAT
LIBOBJS+=fpu/softfloat.o
else
@@ -271,6 +274,9 @@
ifeq ($(ARCH),s390)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
+ifeq ($(ARCH),s390x)
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
ifeq ($(ARCH),sparc)
# -static is used to avoid g1/g3 usage by the dynamic linker
@@ -436,6 +442,9 @@
ifeq ($(ARCH),s390)
LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
endif
+ifeq ($(ARCH),s390x)
+LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
ifeq ($(ARCH),sparc)
# -static is used to avoid g1/g3 usage by the dynamic linker
Index: s390-dis.c
===================================================================
--- s390-dis.c (revision 6883)
+++ s390-dis.c (working copy)
@@ -195,10 +195,10 @@
// switch (info->mach)
// {
// case bfd_mach_s390_31:
- current_arch_mask = 1 << S390_OPCODE_ESA;
+// current_arch_mask = 1 << S390_OPCODE_ESA;
// break;
// case bfd_mach_s390_64:
-// current_arch_mask = 1 << S390_OPCODE_ZARCH;
+ current_arch_mask = 1 << S390_OPCODE_ZARCH;
// break;
// default:
// abort ();
Index: linux-user/syscall.c
===================================================================
--- linux-user/syscall.c (revision 6883)
+++ linux-user/syscall.c (working copy)
@@ -184,7 +184,7 @@
#define __NR_sys_inotify_add_watch __NR_inotify_add_watch
#define __NR_sys_inotify_rm_watch __NR_inotify_rm_watch
-#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__)
+#if defined(__alpha__) || defined (__ia64__) || defined(__x86_64__) || defined(__s390x__)
#define __NR__llseek __NR_lseek
#endif
Index: tcg/s390/tcg-target.c
===================================================================
--- tcg/s390/tcg-target.c (revision 0)
+++ tcg/s390/tcg-target.c (revision 0)
@@ -0,0 +1,1082 @@
+/* +/*
+ * Tiny Code Generator for QEMU + * Tiny Code Generator for QEMU
+ * + *
@ -334,8 +309,7 @@ Index: tcg/s390/tcg-target.c
+ TCG_REG_R12, + TCG_REG_R12,
+ TCG_REG_R13, + TCG_REG_R13,
+ TCG_REG_R14, + TCG_REG_R14,
+ TCG_REG_R15, + /* TCG_REG_R0, many insns can't be used with R0, so we better avoid it for now */
+ TCG_REG_R0,
+ TCG_REG_R1, + TCG_REG_R1,
+ TCG_REG_R2, + TCG_REG_R2,
+ TCG_REG_R3, + TCG_REG_R3,
@ -355,7 +329,6 @@ Index: tcg/s390/tcg-target.c
+{ +{
+ switch (type) { + switch (type) {
+ case R_390_PC32DBL: + case R_390_PC32DBL:
+ //fprintf(stderr,"patching %p to 0x%lx (0x%lx)\n", code_ptr, value, (value - ((tcg_target_long)code_ptr + addend)) >> 1);
+ *(uint32_t*)code_ptr = (value - ((tcg_target_long)code_ptr + addend)) >> 1; + *(uint32_t*)code_ptr = (value - ((tcg_target_long)code_ptr + addend)) >> 1;
+ break; + break;
+ default: + default:
@ -370,6 +343,9 @@ Index: tcg/s390/tcg-target.c
+ return 4; + return 4;
+} +}
+ +
+#define TCG_CT_CONST_S16 0x100
+#define TCG_CT_CONST_U12 0x200
+
+/* parse target specific constraints */ +/* parse target specific constraints */
+static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str) +static int target_parse_constraint(TCGArgConstraint *ct, const char **pct_str)
+{ +{
@ -395,6 +371,10 @@ Index: tcg/s390/tcg-target.c
+ case 'R': /* not R0 */ + case 'R': /* not R0 */
+ tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0); + tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0);
+ break; + break;
+ case 'I':
+ ct->ct &= ~TCG_CT_REG;
+ ct->ct |= TCG_CT_CONST_S16;
+ break;
+ default: + default:
+ break; + break;
+ } + }
@ -405,16 +385,18 @@ Index: tcg/s390/tcg-target.c
+} +}
+ +
+/* Test if a constant matches the constraint. */ +/* Test if a constant matches the constraint. */
+/* No idea what to do here, just eat everything. */
+static inline int tcg_target_const_match(tcg_target_long val, +static inline int tcg_target_const_match(tcg_target_long val,
+ const TCGArgConstraint *arg_ct) + const TCGArgConstraint *arg_ct)
+{ +{
+ int ct; + int ct;
+ //fprintf(stderr,"tcg_target_const_match %ld ct %d\n",val,arg_ct->ct);
+ ct = arg_ct->ct; + ct = arg_ct->ct;
+ if (ct & TCG_CT_CONST) + if (ct & TCG_CT_CONST)
+ return 1; + return 1;
+ else + if ((ct & TCG_CT_CONST_S16) && val == (int16_t)val)
+ return 1;
+ if ((ct & TCG_CT_CONST_U12) && val == (val & 0xfff))
+ return 1;
+
+ return 0; + return 0;
+} +}
+ +
@ -494,6 +476,8 @@ Index: tcg/s390/tcg-target.c
+#define B9_NGR 0x80 +#define B9_NGR 0x80
+#define B9_OGR 0x81 +#define B9_OGR 0x81
+#define B9_XGR 0x82 +#define B9_XGR 0x82
+#define B9_DLGR 0x87
+#define B9_DLR 0x97
+ +
+/* emit (mostly) 32-bit register/register insns */ +/* emit (mostly) 32-bit register/register insns */
+static inline void tcg_out_rr(TCGContext* s, int op, int r1, int r2) +static inline void tcg_out_rr(TCGContext* s, int op, int r1, int r2)
@ -510,6 +494,13 @@ Index: tcg/s390/tcg-target.c
+#define RR_AR 0x1a +#define RR_AR 0x1a
+#define RR_SR 0x1b +#define RR_SR 0x1b
+ +
+static inline void tcg_out_a7(TCGContext *s, int op, int r1, int16_t i2)
+{
+ tcg_out32(s, 0xa7000000UL | (r1 << 20) | (op << 16) | ((uint16_t)i2));
+}
+#define A7_AHI 0xa
+#define A7_AHGI 0xb
+
+/* emit 64-bit shifts (EB prefix) */ +/* emit 64-bit shifts (EB prefix) */
+static inline void tcg_out_sh64(TCGContext* s, int op, int r0, int r1, int r2, int imm) +static inline void tcg_out_sh64(TCGContext* s, int op, int r0, int r1, int r2, int imm)
+{ +{
@ -560,11 +551,11 @@ Index: tcg/s390/tcg-target.c
+ /* llill %rret, arg */ + /* llill %rret, arg */
+ tcg_out32(s, 0xa50f0000 | (ret << 20) | arg); + tcg_out32(s, 0xa50f0000 | (ret << 20) | arg);
+ } + }
+ else if (!(arg & 0xffffffff00000000UL)) { + else if (!(arg & 0xffffffff00000000UL) || type == TCG_TYPE_I32) {
+ /* llill %rret, arg */ + /* llill %rret, arg */
+ tcg_out32(s, 0xa50f0000 | (ret << 20) | (arg & 0xffff)); + tcg_out32(s, 0xa50f0000 | (ret << 20) | (arg & 0xffff));
+ /* iilh %rret, arg */ + /* iilh %rret, arg */
+ tcg_out32(s, 0xa5020000 | (ret << 20) | (arg >> 16)); + tcg_out32(s, 0xa5020000 | (ret << 20) | ((arg & 0xffffffff) >> 16));
+ } + }
+ else { + else {
+ /* branch over constant and store its address in R13 */ + /* branch over constant and store its address in R13 */
@ -642,7 +633,11 @@ Index: tcg/s390/tcg-target.c
+ tcg_out32(s, 0xa7840000); /* je label1 (offset will be patched in later) */ + tcg_out32(s, 0xa7840000); /* je label1 (offset will be patched in later) */
+ +
+ /* call load helper */ + /* call load helper */
+#if TARGET_LONG_BITS == 32
+ tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
+#else
+ tcg_out_b9(s, B9_LGR, arg0, addr_reg); + tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+#endif
+ tcg_out_movi(s, TCG_TYPE_I32, arg1, mem_index); + tcg_out_movi(s, TCG_TYPE_I32, arg1, mem_index);
+ tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R13, (tcg_target_ulong)qemu_ld_helpers[s_bits]); + tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R13, (tcg_target_ulong)qemu_ld_helpers[s_bits]);
+ tcg_out_rr(s, RR_BASR, TCG_REG_R14, TCG_REG_R13); + tcg_out_rr(s, RR_BASR, TCG_REG_R14, TCG_REG_R13);
@ -774,8 +769,13 @@ Index: tcg/s390/tcg-target.c
+ opc, data_reg, addr_reg, mem_index, s_bits); */ + opc, data_reg, addr_reg, mem_index, s_bits); */
+ +
+#ifdef CONFIG_SOFTMMU +#ifdef CONFIG_SOFTMMU
+#if TARGET_LONG_BITS == 32
+ tcg_out_b9(s, B9_LLGFR, arg1, addr_reg);
+ tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
+#else
+ tcg_out_b9(s, B9_LGR, arg1, addr_reg); + tcg_out_b9(s, B9_LGR, arg1, addr_reg);
+ tcg_out_b9(s, B9_LGR, arg0, addr_reg); + tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+#endif
+ +
+ tcg_out_sh64(s, SH64_SRLG, arg1, addr_reg, SH64_REG_NONE, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS); + tcg_out_sh64(s, SH64_SRLG, arg1, addr_reg, SH64_REG_NONE, TARGET_PAGE_BITS - CPU_TLB_ENTRY_BITS);
+ +
@ -792,7 +792,11 @@ Index: tcg/s390/tcg-target.c
+ +
+ tcg_out_e3(s, E3_CG, arg0, arg1, 0); + tcg_out_e3(s, E3_CG, arg0, arg1, 0);
+ +
+#if TARGET_LONG_BITS == 32
+ tcg_out_b9(s, B9_LLGFR, arg0, addr_reg);
+#else
+ tcg_out_b9(s, B9_LGR, arg0, addr_reg); + tcg_out_b9(s, B9_LGR, arg0, addr_reg);
+#endif
+ +
+ /* jump to label1 */ + /* jump to label1 */
+ label1_ptr = (uint16_t*)s->code_ptr; + label1_ptr = (uint16_t*)s->code_ptr;
@ -886,7 +890,7 @@ Index: tcg/s390/tcg-target.c
+ TCGLabel* l; + TCGLabel* l;
+ int op; + int op;
+ int op2; + int op2;
+ //fprintf(stderr,"0x%x\n", INDEX_op_qemu_ld32s); + //fprintf(stderr,"0x%x\n", INDEX_op_divu_i32);
+ switch (opc) { + switch (opc) {
+ case INDEX_op_exit_tb: + case INDEX_op_exit_tb:
+ //fprintf(stderr,"op 0x%x exit_tb 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]); + //fprintf(stderr,"op 0x%x exit_tb 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]);
@ -1016,7 +1020,14 @@ Index: tcg/s390/tcg-target.c
+ tcg_abort(); + tcg_abort();
+ break; + break;
+ case INDEX_op_add_i32: + case INDEX_op_add_i32:
+ if(args[0] == args[1]) { + if (const_args[2]) {
+ if (args[0] == args[1]) tcg_out_a7(s, A7_AHI, args[1], args[2]);
+ else {
+ tcg_out_rr(s, RR_LR, args[0], args[1]);
+ tcg_out_a7(s, A7_AHI, args[0], args[2]);
+ }
+ }
+ else if (args[0] == args[1]) {
+ tcg_out_rr(s, RR_AR, args[1], args[2]); + tcg_out_rr(s, RR_AR, args[1], args[2]);
+ } + }
+ else if (args[0] == args[2]) { + else if (args[0] == args[2]) {
@ -1075,10 +1086,12 @@ Index: tcg/s390/tcg-target.c
+ case INDEX_op_and_i32: + case INDEX_op_and_i32:
+ op = RR_NR; + op = RR_NR;
+do_logic_i32: +do_logic_i32:
+ if(args[0] == args[1]) + if (args[0] == args[1]) {
+ tcg_out_rr(s, op, args[1], args[2]); /* xr %ra0/1, %ra2 */ + tcg_out_rr(s, op, args[1], args[2]); /* xr %ra0/1, %ra2 */
+ else if(args[0] == args[2]) + }
+ else if (args[0] == args[2]) {
+ tcg_out_rr(s, op, args[0], args[1]); /* xr %ra0/2, %ra1 */ + tcg_out_rr(s, op, args[0], args[1]); /* xr %ra0/2, %ra1 */
+ }
+ else { + else {
+ tcg_out_rr(s, RR_LR, args[0], args[1]); /* lr %ra0, %ra1 */ + tcg_out_rr(s, RR_LR, args[0], args[1]); /* lr %ra0, %ra1 */
+ tcg_out_rr(s, op, args[0], args[2]); /* xr %ra0, %ra2 */ + tcg_out_rr(s, op, args[0], args[2]); /* xr %ra0, %ra2 */
@ -1091,10 +1104,12 @@ Index: tcg/s390/tcg-target.c
+ //fprintf(stderr,"op 0x%x and_i64 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]); + //fprintf(stderr,"op 0x%x and_i64 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]);
+ op = B9_NGR; + op = B9_NGR;
+do_logic_i64: +do_logic_i64:
+ if (args[0] == args[1]) + if (args[0] == args[1]) {
+ tcg_out_b9(s, op, args[0], args[2]); + tcg_out_b9(s, op, args[0], args[2]);
+ else if (args[0] == args[2]) + }
+ else if (args[0] == args[2]) {
+ tcg_out_b9(s, op, args[0], args[1]); + tcg_out_b9(s, op, args[0], args[1]);
+ }
+ else { + else {
+ tcg_out_b9(s, B9_LGR, args[0], args[1]); + tcg_out_b9(s, B9_LGR, args[0], args[1]);
+ tcg_out_b9(s, op, args[0], args[2]); + tcg_out_b9(s, op, args[0], args[2]);
@ -1124,7 +1139,10 @@ Index: tcg/s390/tcg-target.c
+ tcg_out32(s, 0xb2520000 | (args[0] << 4) | args[2]); /* msr %ra0/1, %ra2 */ + tcg_out32(s, 0xb2520000 | (args[0] << 4) | args[2]); /* msr %ra0/1, %ra2 */
+ else if (args[0] == args[2]) + else if (args[0] == args[2])
+ tcg_out32(s, 0xb2520000 | (args[0] << 4) | args[1]); /* msr %ra0/2, %ra1 */ + tcg_out32(s, 0xb2520000 | (args[0] << 4) | args[1]); /* msr %ra0/2, %ra1 */
+ else tcg_abort(); + else {
+ tcg_out_rr(s, RR_LR, args[0], args[1]);
+ tcg_out32(s, 0xb2520000 | (args[0] << 4) | args[2]); /* msr %ra0, %ra2 */
+ }
+ break; + break;
+ case INDEX_op_mul_i64: + case INDEX_op_mul_i64:
+ //fprintf(stderr,"op 0x%x mul_i64 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]); + //fprintf(stderr,"op 0x%x mul_i64 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]);
@ -1137,20 +1155,34 @@ Index: tcg/s390/tcg-target.c
+ else tcg_abort(); + else tcg_abort();
+ break; + break;
+ +
+ case INDEX_op_divu_i32:
+ case INDEX_op_remu_i32:
+ //fprintf(stderr,"op 0x%x div/remu_i32 0x%lx 0x%lx 0x%lx\n",opc,args[0],args[1],args[2]);
+ tcg_out_movi(s, TCG_TYPE_I32, TCG_REG_R12, 0);
+ tcg_out_rr(s, RR_LR, TCG_REG_R13, args[1]);
+ tcg_out_b9(s, B9_DLR, TCG_REG_R12, args[2]);
+ if (opc == INDEX_op_divu_i32)
+ tcg_out_rr(s, RR_LR, args[0], TCG_REG_R13); /* quotient */
+ else
+ tcg_out_rr(s, RR_LR, args[0], TCG_REG_R12); /* remainder */
+ break;
+
+ case INDEX_op_shl_i32: + case INDEX_op_shl_i32:
+ op = SH32_SLL; op2 = SH64_SLLG; + op = SH32_SLL; op2 = SH64_SLLG;
+do_shift32: +do_shift32:
+ if (const_args[2]) { + if (const_args[2]) {
+ if(args[0] == args[1]) + if (args[0] == args[1]) {
+ tcg_out_sh32(s, op, args[0], SH32_REG_NONE, args[2]); + tcg_out_sh32(s, op, args[0], SH32_REG_NONE, args[2]);
+ }
+ else { + else {
+ tcg_out_rr(s, RR_LR, args[0], args[1]); + tcg_out_rr(s, RR_LR, args[0], args[1]);
+ tcg_out_sh32(s, op, args[0], SH32_REG_NONE, args[2]); + tcg_out_sh32(s, op, args[0], SH32_REG_NONE, args[2]);
+ } + }
+ } + }
+ else { + else {
+ if(args[0] == args[1]) + if (args[0] == args[1]) {
+ tcg_out_sh32(s, op, args[0], args[2], 0); + tcg_out_sh32(s, op, args[0], args[2], 0);
+ }
+ else + else
+ tcg_out_sh64(s, op2, args[0], args[1], args[2], 0); + tcg_out_sh64(s, op2, args[0], args[1], args[2], 0);
+ } + }
@ -1253,10 +1285,15 @@ Index: tcg/s390/tcg-target.c
+ { INDEX_op_st16_i32, { "r", "r" } }, + { INDEX_op_st16_i32, { "r", "r" } },
+ { INDEX_op_st_i32, { "r", "r" } }, + { INDEX_op_st_i32, { "r", "r" } },
+ +
+ { INDEX_op_add_i32, { "r", "r", "r" } }, + { INDEX_op_add_i32, { "r", "r", "rI" } },
+ { INDEX_op_sub_i32, { "r", "r", "r" } }, + { INDEX_op_sub_i32, { "r", "r", "r" } },
+ { INDEX_op_mul_i32, { "r", "r", "r" } }, + { INDEX_op_mul_i32, { "r", "r", "r" } },
+ +
+ { INDEX_op_div_i32, { "r", "r", "r" } },
+ { INDEX_op_divu_i32, { "r", "r", "r" } },
+ { INDEX_op_rem_i32, { "r", "r", "r" } },
+ { INDEX_op_remu_i32, { "r", "r", "r" } },
+
+ { INDEX_op_and_i32, { "r", "r", "r" } }, + { INDEX_op_and_i32, { "r", "r", "r" } },
+ { INDEX_op_or_i32, { "r", "r", "r" } }, + { INDEX_op_or_i32, { "r", "r", "r" } },
+ { INDEX_op_xor_i32, { "r", "r", "r" } }, + { INDEX_op_xor_i32, { "r", "r", "r" } },
@ -1337,6 +1374,7 @@ Index: tcg/s390/tcg-target.c
+ +
+ tcg_regset_clear(s->reserved_regs); + tcg_regset_clear(s->reserved_regs);
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13); /* frequently used as a temporary */ + tcg_regset_set_reg(s->reserved_regs, TCG_REG_R13); /* frequently used as a temporary */
+ tcg_regset_set_reg(s->reserved_regs, TCG_REG_R12); /* another temporary */
+ +
+ tcg_add_target_add_op_defs(s390_op_defs); + tcg_add_target_add_op_defs(s390_op_defs);
+} +}
@ -1361,10 +1399,11 @@ Index: tcg/s390/tcg-target.c
+{ +{
+ tcg_abort(); + tcg_abort();
+} +}
Index: tcg/s390/tcg-target.h diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
=================================================================== new file mode 100644
--- tcg/s390/tcg-target.h (revision 0) index 0000000..fcb28d1
+++ tcg/s390/tcg-target.h (revision 0) --- /dev/null
+++ b/tcg/s390/tcg-target.h
@@ -0,0 +1,76 @@ @@ -0,0 +1,76 @@
+/* +/*
+ * Tiny Code Generator for QEMU + * Tiny Code Generator for QEMU
@ -1393,7 +1432,7 @@ Index: tcg/s390/tcg-target.h
+ +
+#define TCG_TARGET_REG_BITS 64 +#define TCG_TARGET_REG_BITS 64
+#define TCG_TARGET_WORDS_BIGENDIAN +#define TCG_TARGET_WORDS_BIGENDIAN
+#undef TCG_TARGET_HAS_div_i32 +#define TCG_TARGET_HAS_div_i32
+#undef TCG_TARGET_HAS_div_i64 +#undef TCG_TARGET_HAS_div_i64
+#undef TCG_TARGET_HAS_bswap_i32 +#undef TCG_TARGET_HAS_bswap_i32
+#define TCG_TARGET_HAS_neg_i32 +#define TCG_TARGET_HAS_neg_i32
@ -1442,40 +1481,6 @@ Index: tcg/s390/tcg-target.h
+#error not implemented +#error not implemented
+#endif +#endif
+} +}
Index: configure --
=================================================================== 1.6.2.1
--- configure (revision 6883)
+++ configure (working copy)
@@ -139,9 +139,12 @@
ppc64)
cpu="ppc64"
;;
- s390*)
+ s390)
cpu="s390"
;;
+ s390x)
+ cpu="s390x"
+ ;;
sparc|sun4[cdmuv])
cpu="sparc"
;;
@@ -727,6 +730,7 @@
if test "$cpu" = "x86_64" \
-o "$cpu" = "alpha" \
-o "$cpu" = "ia64" \
+ -o "$cpu" = "s390x" \
-o "$cpu" = "sparc64" \
-o "$cpu" = "ppc64"; then
hostlongbits="64"
@@ -1311,6 +1315,10 @@
echo "ARCH=s390" >> $config_mak
echo "#define HOST_S390 1" >> $config_h
;;
+ s390x)
+ echo "ARCH=s390x" >> $config_mak
+ echo "#define HOST_S390X 1" >> $config_h
+ ;;
sparc)
echo "ARCH=sparc" >> $config_mak
echo "#define HOST_SPARC 1" >> $config_h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,96 @@
From f06038e90fe4eb5dd8c73735356125ab0d3e899b Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 22 Jul 2009 14:03:19 +0200
Subject: [PATCH 25/33] linux-user: don't do locking in single-threaded processes
Skips setting the tb_lock if a process doesn't have more than one thread,
which is usually the case. Results in about 20% performance gain (measured
with the s390x target, but the effect should be similar with other targets).
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
cpu-defs.h | 8 ++++++++
cpu-exec.c | 14 ++++++++++++--
linux-user/syscall.c | 1 +
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/cpu-defs.h b/cpu-defs.h
index d73ec0a..27e5bb2 100644
--- a/cpu-defs.h
+++ b/cpu-defs.h
@@ -135,6 +135,13 @@ typedef struct CPUWatchpoint {
} CPUWatchpoint;
#define CPU_TEMP_BUF_NLONGS 128
+
+#ifdef CONFIG_USER_ONLY
+#define MULTITHREAD uint32_t multithreaded;
+#else
+#define MULTITHREAD
+#endif
+
#define CPU_COMMON \
struct TranslationBlock *current_tb; /* currently executing TB */ \
/* soft mmu support */ \
@@ -149,6 +156,7 @@ typedef struct CPUWatchpoint {
uint32_t stop; /* Stop request */ \
uint32_t stopped; /* Artificially stopped */ \
uint32_t interrupt_request; \
+ MULTITHREAD /* needs locking when accessing TBs */ \
volatile sig_atomic_t exit_request; \
/* The meaning of the MMU modes is defined in the target code. */ \
CPUTLBEntry tlb_table[NB_MMU_MODES][CPU_TLB_SIZE]; \
diff --git a/cpu-exec.c b/cpu-exec.c
index 855ea3e..1371ce4 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -219,6 +219,9 @@ int cpu_exec(CPUState *env1)
TranslationBlock *tb;
uint8_t *tc_ptr;
unsigned long next_tb;
+#ifdef CONFIG_USER_ONLY
+ uint32_t multithreaded;
+#endif
if (cpu_halted(env1) == EXCP_HALTED)
return EXCP_HALTED;
@@ -604,7 +607,11 @@ int cpu_exec(CPUState *env1)
#endif
}
#endif
- spin_lock(&tb_lock);
+#ifdef CONFIG_USER_ONLY
+ multithreaded = env->multithreaded;
+ if (multithreaded)
+#endif
+ spin_lock(&tb_lock);
tb = tb_find_fast();
/* Note: we do it here to avoid a gcc bug on Mac OS X when
doing it in tb_find_slow */
@@ -632,7 +639,10 @@ int cpu_exec(CPUState *env1)
tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb);
}
}
- spin_unlock(&tb_lock);
+#ifdef CONFIG_USER_ONLY
+ if (multithreaded)
+#endif
+ spin_unlock(&tb_lock);
env->current_tb = tb;
/* cpu_interrupt might be called while translating the
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e9b07df..f7a411d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3560,6 +3560,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
ts = qemu_mallocz(sizeof(TaskState) + NEW_STACK_SIZE);
init_task_state(ts);
new_stack = ts->stack;
+ env->multithreaded = 1;
/* we create a new CPU instance. */
new_env = cpu_copy(env);
/* Init regs that differ from the parent. */
--
1.6.2.1

View File

@ -0,0 +1,80 @@
From 4af40cd06ca8bf1faa436a966833df346d7dba65 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 14:33:36 +0200
Subject: [PATCH 26/33] linux-user: dup3, fallocate syscalls
implementations of dup3 and fallocate that are good enough to fool LTP
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
configure | 18 ++++++++++++++++++
linux-user/syscall.c | 10 ++++++++++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 68fa1c1..229f70b 100755
--- a/configure
+++ b/configure
@@ -1355,6 +1355,21 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
splice=yes
fi
+# check for fallocate
+fallocate=no
+cat > $TMPC << EOF
+#include <fcntl.h>
+
+int main(void)
+{
+ fallocate(0, 0, 0, 0);
+ return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ fallocate=yes
+fi
+
# Check if tools are available to build documentation.
if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
build_docs="no"
@@ -1707,6 +1722,9 @@ fi
if test "$splice" = "yes" ; then
echo "#define CONFIG_SPLICE 1" >> $config_host_h
fi
+if test "$fallocate" = "yes" ; then
+ echo "#define CONFIG_FALLOCATE 1" >> $config_host_h
+fi
if test "$inotify" = "yes" ; then
echo "#define CONFIG_INOTIFY 1" >> $config_host_h
fi
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f7a411d..4fb7998 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4750,6 +4750,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_dup2:
ret = get_errno(dup2(arg1, arg2));
break;
+#ifdef TARGET_NR_dup3
+ case TARGET_NR_dup3:
+ ret = get_errno(dup3(arg1, arg2, arg3));
+ break;
+#endif
#ifdef TARGET_NR_getppid /* not on alpha */
case TARGET_NR_getppid:
ret = get_errno(getppid());
@@ -7016,6 +7021,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
#endif
+#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
+ case TARGET_NR_fallocate:
+ ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
+ break;
+#endif
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.6.2.1

View File

@ -0,0 +1,171 @@
From b597826b87618cb1cb082e73b52354da2a62423f Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 15:10:30 +0200
Subject: [PATCH 27/33] linux-user: fcntl fixes for LTP
Fixes swaps on l_pid which were pretty much of random size. Implements
F_SETLEASE, F_GETLEASE. Now passes all LTP fcntl tests.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 34 ++++++++++++++++++++++------------
linux-user/syscall_defs.h | 7 +++++++
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4fb7998..86754f1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3705,6 +3705,14 @@ static int target_to_host_fcntl_cmd(int cmd)
case TARGET_F_SETLKW64:
return F_SETLKW64;
#endif
+ case TARGET_F_SETLEASE:
+ return F_SETLEASE;
+ case TARGET_F_GETLEASE:
+ return F_GETLEASE;
+ case TARGET_F_DUPFD_CLOEXEC:
+ return F_DUPFD_CLOEXEC;
+ case TARGET_F_NOTIFY:
+ return F_NOTIFY;
default:
return -TARGET_EINVAL;
}
@@ -3731,7 +3739,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
fl.l_whence = tswap16(target_fl->l_whence);
fl.l_start = tswapl(target_fl->l_start);
fl.l_len = tswapl(target_fl->l_len);
- fl.l_pid = tswapl(target_fl->l_pid);
+ fl.l_pid = tswap32(target_fl->l_pid);
unlock_user_struct(target_fl, arg, 0);
ret = get_errno(fcntl(fd, host_cmd, &fl));
if (ret == 0) {
@@ -3741,7 +3749,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
target_fl->l_whence = tswap16(fl.l_whence);
target_fl->l_start = tswapl(fl.l_start);
target_fl->l_len = tswapl(fl.l_len);
- target_fl->l_pid = tswapl(fl.l_pid);
+ target_fl->l_pid = tswap32(fl.l_pid);
unlock_user_struct(target_fl, arg, 1);
}
break;
@@ -3754,7 +3762,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
fl.l_whence = tswap16(target_fl->l_whence);
fl.l_start = tswapl(target_fl->l_start);
fl.l_len = tswapl(target_fl->l_len);
- fl.l_pid = tswapl(target_fl->l_pid);
+ fl.l_pid = tswap32(target_fl->l_pid);
unlock_user_struct(target_fl, arg, 0);
ret = get_errno(fcntl(fd, host_cmd, &fl));
break;
@@ -3766,7 +3774,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
fl64.l_whence = tswap16(target_fl64->l_whence);
fl64.l_start = tswapl(target_fl64->l_start);
fl64.l_len = tswapl(target_fl64->l_len);
- fl64.l_pid = tswap16(target_fl64->l_pid);
+ fl64.l_pid = tswap32(target_fl64->l_pid);
unlock_user_struct(target_fl64, arg, 0);
ret = get_errno(fcntl(fd, host_cmd, &fl64));
if (ret == 0) {
@@ -3776,7 +3784,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
target_fl64->l_whence = tswap16(fl64.l_whence);
target_fl64->l_start = tswapl(fl64.l_start);
target_fl64->l_len = tswapl(fl64.l_len);
- target_fl64->l_pid = tswapl(fl64.l_pid);
+ target_fl64->l_pid = tswap32(fl64.l_pid);
unlock_user_struct(target_fl64, arg, 1);
}
break;
@@ -3788,7 +3796,7 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
fl64.l_whence = tswap16(target_fl64->l_whence);
fl64.l_start = tswapl(target_fl64->l_start);
fl64.l_len = tswapl(target_fl64->l_len);
- fl64.l_pid = tswap16(target_fl64->l_pid);
+ fl64.l_pid = tswap32(target_fl64->l_pid);
unlock_user_struct(target_fl64, arg, 0);
ret = get_errno(fcntl(fd, host_cmd, &fl64));
break;
@@ -3808,6 +3816,8 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
case TARGET_F_GETOWN:
case TARGET_F_SETSIG:
case TARGET_F_GETSIG:
+ case TARGET_F_SETLEASE:
+ case TARGET_F_GETLEASE:
ret = get_errno(fcntl(fd, host_cmd, arg));
break;
@@ -6630,7 +6640,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
fl.l_whence = tswap16(target_efl->l_whence);
fl.l_start = tswap64(target_efl->l_start);
fl.l_len = tswap64(target_efl->l_len);
- fl.l_pid = tswapl(target_efl->l_pid);
+ fl.l_pid = tswap32(target_efl->l_pid);
unlock_user_struct(target_efl, arg3, 0);
} else
#endif
@@ -6641,7 +6651,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
fl.l_whence = tswap16(target_fl->l_whence);
fl.l_start = tswap64(target_fl->l_start);
fl.l_len = tswap64(target_fl->l_len);
- fl.l_pid = tswapl(target_fl->l_pid);
+ fl.l_pid = tswap32(target_fl->l_pid);
unlock_user_struct(target_fl, arg3, 0);
}
ret = get_errno(fcntl(arg1, cmd, &fl));
@@ -6654,7 +6664,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
target_efl->l_whence = tswap16(fl.l_whence);
target_efl->l_start = tswap64(fl.l_start);
target_efl->l_len = tswap64(fl.l_len);
- target_efl->l_pid = tswapl(fl.l_pid);
+ target_efl->l_pid = tswap32(fl.l_pid);
unlock_user_struct(target_efl, arg3, 1);
} else
#endif
@@ -6665,7 +6675,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
target_fl->l_whence = tswap16(fl.l_whence);
target_fl->l_start = tswap64(fl.l_start);
target_fl->l_len = tswap64(fl.l_len);
- target_fl->l_pid = tswapl(fl.l_pid);
+ target_fl->l_pid = tswap32(fl.l_pid);
unlock_user_struct(target_fl, arg3, 1);
}
}
@@ -6681,7 +6691,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
fl.l_whence = tswap16(target_efl->l_whence);
fl.l_start = tswap64(target_efl->l_start);
fl.l_len = tswap64(target_efl->l_len);
- fl.l_pid = tswapl(target_efl->l_pid);
+ fl.l_pid = tswap32(target_efl->l_pid);
unlock_user_struct(target_efl, arg3, 0);
} else
#endif
@@ -6692,7 +6702,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
fl.l_whence = tswap16(target_fl->l_whence);
fl.l_start = tswap64(target_fl->l_start);
fl.l_len = tswap64(target_fl->l_len);
- fl.l_pid = tswapl(target_fl->l_pid);
+ fl.l_pid = tswap32(target_fl->l_pid);
unlock_user_struct(target_fl, arg3, 0);
}
ret = get_errno(fcntl(arg1, cmd, &fl));
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 0f4fbd7..481ce59 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -1824,6 +1824,13 @@ struct target_statfs64 {
#define TARGET_F_SETLK64 13
#define TARGET_F_SETLKW64 14
#endif
+
+#define TARGET_F_LINUX_SPECIFIC_BASE 1024
+#define TARGET_F_SETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 0)
+#define TARGET_F_GETLEASE (TARGET_F_LINUX_SPECIFIC_BASE + 1)
+#define TARGET_F_DUPFD_CLOEXEC (TARGET_F_LINUX_SPECIFIC_BASE + 6)
+#define TARGET_F_NOTIFY (TARGET_F_LINUX_SPECIFIC_BASE+2)
+
#if defined (TARGET_ARM)
#define TARGET_O_ACCMODE 0003
#define TARGET_O_RDONLY 00
--
1.6.2.1

View File

@ -0,0 +1,41 @@
From cd19670096c6f7affdba9792cb695b851390c184 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 17:17:32 +0200
Subject: [PATCH 28/33] linux-user: enable getdents for > 32-bit systems
works perfectly fine with the example from getdents(2) and passes the LTP
tests (tested with s390x on x86_64 emulation)
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 86754f1..49dfb40 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -195,9 +195,7 @@ static int gettid(void) {
return -ENOSYS;
}
#endif
-#if TARGET_ABI_BITS == 32
_syscall3(int, sys_getdents, uint, fd, struct linux_dirent *, dirp, uint, count);
-#endif
#if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
#endif
@@ -5820,9 +5818,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#endif
case TARGET_NR_getdents:
-#if TARGET_ABI_BITS != 32
- goto unimplemented;
-#elif TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64
+#if TARGET_ABI_BITS == 32 && HOST_LONG_BITS == 64
{
struct target_dirent *target_dirp;
struct linux_dirent *dirp;
--
1.6.2.1

View File

@ -0,0 +1,271 @@
From 22a1d92ba7beebc34113d8a95badd56b2901c283 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 17:41:57 +0200
Subject: [PATCH 29/33] linux-user: define a couple of syscalls for non-uid16 targets
Quite a number of syscalls are only defined on systems with USE_UID16
defined; this patch defines them on other systems as well.
Fixes a large number of uid/gid-related testcases on the s390x target
(and most likely on other targets as well)
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 125 ++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 105 insertions(+), 20 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 49dfb40..b1ef3c9 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -309,7 +309,7 @@ static int sys_fchmodat(int dirfd, const char *pathname, mode_t mode)
return (fchmodat(dirfd, pathname, mode, 0));
}
#endif
-#if defined(TARGET_NR_fchownat) && defined(USE_UID16)
+#if defined(TARGET_NR_fchownat)
static int sys_fchownat(int dirfd, const char *pathname, uid_t owner,
gid_t group, int flags)
{
@@ -418,7 +418,7 @@ _syscall3(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode)
#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
_syscall3(int,sys_fchmodat,int,dirfd,const char *,pathname, mode_t,mode)
#endif
-#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) && defined(USE_UID16)
+#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat)
_syscall5(int,sys_fchownat,int,dirfd,const char *,pathname,
uid_t,owner,gid_t,group,int,flags)
#endif
@@ -6382,18 +6382,35 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_setfsgid:
ret = get_errno(setfsgid(arg1));
break;
+#else /* USE_UID16 */
+#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat)
+ case TARGET_NR_fchownat:
+ if (!(p = lock_user_string(arg2)))
+ goto efault;
+ ret = get_errno(sys_fchownat(arg1, p, arg3, arg4, arg5));
+ unlock_user(p, arg2, 0);
+ break;
+#endif
#endif /* USE_UID16 */
-#ifdef TARGET_NR_lchown32
+#if defined(TARGET_NR_lchown32) || !defined(USE_UID16)
+#if defined(TARGET_NR_lchown32)
case TARGET_NR_lchown32:
+#else
+ case TARGET_NR_lchown:
+#endif
if (!(p = lock_user_string(arg1)))
goto efault;
ret = get_errno(lchown(p, arg2, arg3));
unlock_user(p, arg1, 0);
break;
#endif
-#ifdef TARGET_NR_getuid32
+#if defined(TARGET_NR_getuid32) || (defined(TARGET_NR_getuid) && !defined(USE_UID16))
+#if defined(TARGET_NR_getuid32)
case TARGET_NR_getuid32:
+#else
+ case TARGET_NR_getuid:
+#endif
ret = get_errno(getuid());
break;
#endif
@@ -6421,33 +6438,57 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#endif
-#ifdef TARGET_NR_getgid32
+#if defined(TARGET_NR_getgid32) || (defined(TARGET_NR_getgid) && !defined(USE_UID16))
+#if defined(TARGET_NR_getgid32)
case TARGET_NR_getgid32:
+#else
+ case TARGET_NR_getgid:
+#endif
ret = get_errno(getgid());
break;
#endif
-#ifdef TARGET_NR_geteuid32
+#if defined(TARGET_NR_geteuid32) || (defined(TARGET_NR_geteuid) && !defined(USE_UID16))
+#if defined(TARGET_NR_geteuid32)
case TARGET_NR_geteuid32:
+#else
+ case TARGET_NR_geteuid:
+#endif
ret = get_errno(geteuid());
break;
#endif
-#ifdef TARGET_NR_getegid32
+#if defined(TARGET_NR_getegid32) || (defined(TARGET_NR_getegid) && !defined(USE_UID16))
+#if defined(TARGET_NR_getegid32)
case TARGET_NR_getegid32:
+#else
+ case TARGET_NR_getegid:
+#endif
ret = get_errno(getegid());
break;
#endif
-#ifdef TARGET_NR_setreuid32
+#if defined(TARGET_NR_setreuid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setreuid32)
case TARGET_NR_setreuid32:
+#else
+ case TARGET_NR_setreuid:
+#endif
ret = get_errno(setreuid(arg1, arg2));
break;
#endif
-#ifdef TARGET_NR_setregid32
+#if defined(TARGET_NR_setregid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setregid32)
case TARGET_NR_setregid32:
+#else
+ case TARGET_NR_setregid:
+#endif
ret = get_errno(setregid(arg1, arg2));
break;
#endif
-#ifdef TARGET_NR_getgroups32
+#if defined(TARGET_NR_getgroups32) || !defined(USE_UID16)
+#if defined(TARGET_NR_getgroups32)
case TARGET_NR_getgroups32:
+#else
+ case TARGET_NR_getgroups:
+#endif
{
int gidsetsize = arg1;
uint32_t *target_grouplist;
@@ -6471,8 +6512,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
break;
#endif
-#ifdef TARGET_NR_setgroups32
+#if defined(TARGET_NR_setgroups32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setgroups32)
case TARGET_NR_setgroups32:
+#else
+ case TARGET_NR_setgroups:
+#endif
{
int gidsetsize = arg1;
uint32_t *target_grouplist;
@@ -6492,18 +6537,30 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
break;
#endif
-#ifdef TARGET_NR_fchown32
+#if defined(TARGET_NR_fchown32) || !defined(USE_UID16)
+#if defined(TARGET_NR_fchown32)
case TARGET_NR_fchown32:
+#else
+ case TARGET_NR_fchown:
+#endif
ret = get_errno(fchown(arg1, arg2, arg3));
break;
#endif
-#ifdef TARGET_NR_setresuid32
+#if defined(TARGET_NR_setresuid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setresuid32)
case TARGET_NR_setresuid32:
+#else
+ case TARGET_NR_setresuid:
+#endif
ret = get_errno(setresuid(arg1, arg2, arg3));
break;
#endif
-#ifdef TARGET_NR_getresuid32
+#if defined(TARGET_NR_getresuid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_getresuid32)
case TARGET_NR_getresuid32:
+#else
+ case TARGET_NR_getresuid:
+#endif
{
uid_t ruid, euid, suid;
ret = get_errno(getresuid(&ruid, &euid, &suid));
@@ -6516,13 +6573,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
break;
#endif
-#ifdef TARGET_NR_setresgid32
+#if defined(TARGET_NR_setresgid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setresgid32)
case TARGET_NR_setresgid32:
+#else
+ case TARGET_NR_setresgid:
+#endif
ret = get_errno(setresgid(arg1, arg2, arg3));
break;
#endif
+#if defined(TARGET_NR_getresgid32) || !defined(USE_UID16)
#ifdef TARGET_NR_getresgid32
case TARGET_NR_getresgid32:
+#else
+ case TARGET_NR_getresgid:
+#endif
{
gid_t rgid, egid, sgid;
ret = get_errno(getresgid(&rgid, &egid, &sgid));
@@ -6535,31 +6600,51 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
}
break;
#endif
-#ifdef TARGET_NR_chown32
+#if defined(TARGET_NR_chown32) || !defined(USE_UID16)
+#if defined(TARGET_NR_chown32)
case TARGET_NR_chown32:
+#else
+ case TARGET_NR_chown:
+#endif
if (!(p = lock_user_string(arg1)))
goto efault;
ret = get_errno(chown(p, arg2, arg3));
unlock_user(p, arg1, 0);
break;
#endif
-#ifdef TARGET_NR_setuid32
+#if defined(TARGET_NR_setuid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setuid32)
case TARGET_NR_setuid32:
+#else
+ case TARGET_NR_setuid:
+#endif
ret = get_errno(setuid(arg1));
break;
#endif
-#ifdef TARGET_NR_setgid32
+#if defined(TARGET_NR_setgid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setgid32)
case TARGET_NR_setgid32:
+#else
+ case TARGET_NR_setgid:
+#endif
ret = get_errno(setgid(arg1));
break;
#endif
-#ifdef TARGET_NR_setfsuid32
+#if defined(TARGET_NR_setfsuid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setfsuid32)
case TARGET_NR_setfsuid32:
+#else
+ case TARGET_NR_setfsuid:
+#endif
ret = get_errno(setfsuid(arg1));
break;
#endif
-#ifdef TARGET_NR_setfsgid32
+#if defined(TARGET_NR_setfsgid32) || !defined(USE_UID16)
+#if defined(TARGET_NR_setfsgid32)
case TARGET_NR_setfsgid32:
+#else
+ case TARGET_NR_setfsgid:
+#endif
ret = get_errno(setfsgid(arg1));
break;
#endif
--
1.6.2.1

View File

@ -0,0 +1,28 @@
From fe268c13396fd05318a88ac7987198f34c3931e3 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 17:55:41 +0200
Subject: [PATCH 30/33] linux-user: getpriority errno fix
getpriority returned wrong errno; fixes LTP test getpriority02.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b1ef3c9..30fb4ab 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5327,7 +5327,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
/* libc does special remapping of the return value of
* sys_getpriority() so it's just easiest to call
* sys_getpriority() directly rather than through libc. */
- ret = sys_getpriority(arg1, arg2);
+ ret = get_errno(sys_getpriority(arg1, arg2));
break;
case TARGET_NR_setpriority:
ret = get_errno(setpriority(arg1, arg2, arg3));
--
1.6.2.1

View File

@ -0,0 +1,46 @@
From 5a8884c3742e2e0cb467efc23b3b8bedaa13f65d Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 23 Jul 2009 14:56:59 +0200
Subject: [PATCH 31/33] linux-user: fadvise64 implementation
good enough to pass all LTP fadvise64 tests
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 30fb4ab..c4b7001 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6680,12 +6680,23 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
arg4 = temp;
}
#endif
-#if defined(TARGET_NR_fadvise64_64) || defined(TARGET_NR_arm_fadvise64_64)
+#if defined(TARGET_NR_fadvise64_64) || defined(TARGET_NR_arm_fadvise64_64) || defined(TARGET_NR_fadvise64)
#ifdef TARGET_NR_fadvise64_64
case TARGET_NR_fadvise64_64:
#endif
- /* This is a hint, so ignoring and returning success is ok. */
- ret = get_errno(0);
+#ifdef TARGET_NR_fadvise64
+ case TARGET_NR_fadvise64:
+#endif
+#ifdef TARGET_S390X
+ switch (arg4) {
+ case 4: arg4 = POSIX_FADV_NOREUSE + 1; break; /* make sure it's an invalid value */
+ case 5: arg4 = POSIX_FADV_NOREUSE + 2; break; /* ditto */
+ case 6: arg4 = POSIX_FADV_DONTNEED; break;
+ case 7: arg4 = POSIX_FADV_NOREUSE; break;
+ default: break;
+ }
+#endif
+ ret = -posix_fadvise(arg1, arg2, arg3, arg4);
break;
#endif
#ifdef TARGET_NR_madvise
--
1.6.2.1

View File

@ -0,0 +1,31 @@
From 6d0d8876abd8e714d86e071247f33f479ebbfa9e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Fri, 10 Jul 2009 16:43:26 +0200
Subject: [PATCH 32/33] linux-user: zero fstat buffer to initialize nsec fields
The fstat implementation does not initialize the nanosecond fields in the
stat buffer; this caused funny values to turn up there, preventing, for
instance, cp -p from preserving timestamps because utimensat rejected
the out-of-bounds nanosecond values. Resetting the entire structure
to zero fixes that.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c4b7001..ef76537 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5552,6 +5552,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
if (!lock_user_struct(VERIFY_WRITE, target_st, arg2, 0))
goto efault;
+ memset(target_st, 0, sizeof(*target_st));
__put_user(st.st_dev, &target_st->st_dev);
__put_user(st.st_ino, &target_st->st_ino);
__put_user(st.st_mode, &target_st->st_mode);
--
1.6.2.1

View File

@ -0,0 +1,76 @@
From b54168c6f68c8db62e6c0718b23f637f9804abee Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Thu, 30 Jul 2009 16:02:52 +0200
Subject: [PATCH 33/33] dup3 check, fallocate check fixed
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
configure | 20 +++++++++++++++++++-
linux-user/syscall.c | 4 +++-
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 229f70b..cb4914d 100755
--- a/configure
+++ b/configure
@@ -1370,6 +1370,21 @@ if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
fallocate=yes
fi
+# check for dup3
+dup3=no
+cat > $TMPC << EOF
+#include <unistd.h>
+
+int main(void)
+{
+ dup3(0, 0, 0);
+ return 0;
+}
+EOF
+if $cc $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+ dup3=yes
+fi
+
# Check if tools are available to build documentation.
if test "$build_docs" = "yes" -a \( ! -x "`which texi2html 2>/dev/null`" -o ! -x "`which pod2man 2>/dev/null`" \) ; then
build_docs="no"
@@ -1723,7 +1738,10 @@ if test "$splice" = "yes" ; then
echo "#define CONFIG_SPLICE 1" >> $config_host_h
fi
if test "$fallocate" = "yes" ; then
- echo "#define CONFIG_FALLOCATE 1" >> $config_host_h
+ echo "CONFIG_FALLOCATE=y" >> $config_host_mak
+fi
+if test "$dup3" = "yes" ; then
+ echo "CONFIG_DUP3=y" >> $config_host_mak
fi
if test "$inotify" = "yes" ; then
echo "#define CONFIG_INOTIFY 1" >> $config_host_h
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ef76537..6c109de 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3707,8 +3707,10 @@ static int target_to_host_fcntl_cmd(int cmd)
return F_SETLEASE;
case TARGET_F_GETLEASE:
return F_GETLEASE;
+#ifdef F_DUPFD_CLOEXEC
case TARGET_F_DUPFD_CLOEXEC:
return F_DUPFD_CLOEXEC;
+#endif
case TARGET_F_NOTIFY:
return F_NOTIFY;
default:
@@ -4758,7 +4760,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_dup2:
ret = get_errno(dup2(arg1, arg2));
break;
-#ifdef TARGET_NR_dup3
+#if defined(TARGET_NR_dup3) && defined(CONFIG_DUP3)
case TARGET_NR_dup3:
ret = get_errno(dup3(arg1, arg2, arg3));
break;
--
1.6.2.1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c987d50d321cc856b0d98fd227bb26b0764e43f49abe24ae2312dd9eda204591
size 3068967

3
qemu-0.11.0-rc1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f2470e1c4d6eb82eabc7fe44e1a9fc8968623e06dc7050234a184cbd4bc0a1d0
size 3291544

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu/linux-user/syscall.c
+++ qemu/linux-user/syscall.c
@@ -1867,6 +1867,8 @@
switch (call) {
case IPCOP_semop:
+ ret = -EINVAL;
+ break;
{
struct sembuf *target_sops;
int i;

View File

@ -1,13 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu/linux-user/syscall.c
+++ qemu/linux-user/syscall.c
@@ -3895,6 +3895,8 @@
case TARGET_NR_gettimeofday:
{
struct timeval tv;
+ if(copy_from_user_timeval(&tv, arg1))
+ goto efault;
ret = get_errno(gettimeofday(&tv, NULL));
if (!is_error(ret)) {
host_to_target_timeval(arg1, &tv);

View File

@ -1,18 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu/linux-user/syscall.c
+++ qemu/linux-user/syscall.c
@@ -2087,7 +2087,12 @@
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {
- gemu_log("Unsupported ioctl: cmd=0x%04lx\n", (long)cmd);
+ int i;
+ gemu_log("Unsupported ioctl: cmd=0x%04lx (%x)\n", cmd, (cmd & (TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) >> TARGET_IOC_SIZESHIFT);
+ for(i=0;ioctl_entries[i].target_cmd;i++) {
+ if((ioctl_entries[i].target_cmd & ~(TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) == (cmd & ~(TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)))
+ gemu_log("%p\t->\t%s (%x)\n", ioctl_entries[i].host_cmd, ioctl_entries[i].name, (ioctl_entries[i].target_cmd & (TARGET_IOC_SIZEMASK << TARGET_IOC_SIZESHIFT)) >> TARGET_IOC_SIZESHIFT);
+ }
return -TARGET_ENOSYS;
}
if (ie->target_cmd == cmd)

View File

@ -1,24 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu/linux-user/syscall.c
+++ qemu/linux-user/syscall.c
@@ -2117,6 +2117,11 @@
arg_type++;
target_size = thunk_type_size(arg_type, 0);
switch(ie->access) {
+ /* FIXME: actually the direction given in the ioctl should be
+ * correct so we can assume the communication is uni-directional.
+ * The alsa developers did not like this concept though and
+ * declared ioctls IOC_R and IOC_W even though they were IOC_RW.*/
+/*
case IOC_R:
ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
if (!is_error(ret)) {
@@ -2131,6 +2136,7 @@
unlock_user(argptr, arg, 0);
ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
break;
+*/
default:
case IOC_RW:
argptr = lock_user(arg, target_size, 1);

View File

@ -1,364 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu-0.10.1/linux-user/syscall.c
+++ qemu-0.10.1/linux-user/syscall.c
@@ -29,7 +29,7 @@
#include <fcntl.h>
#include <time.h>
#include <limits.h>
-#include <sys/types.h>
+#include <linux/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/wait.h>
@@ -46,6 +46,9 @@
#include <sys/uio.h>
#include <sys/poll.h>
#include <sys/times.h>
+#include <asm/ipcbuf.h>
+#include <asm/shmbuf.h>
+#include <asm/sembuf.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/statfs.h>
@@ -158,6 +161,7 @@
#define __NR_sys_exit __NR_exit
#define __NR_sys_sched_getaffinity __NR_sched_getaffinity
+#define __NR_sys_ipc __NR_ipc
#define __NR_sys_uname __NR_uname
#define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat
@@ -266,6 +270,10 @@
#if defined(TARGET_NR_tkill) && defined(__NR_tkill)
_syscall2(int,sys_tkill,int,tid,int,sig)
#endif
+#ifdef __NR_ipc
+_syscall6(int,sys_ipc, long, call, long, first, long, second, long, third, void *, ptr, long, fifth)
+#define semctl(a,b,c,d) sys_ipc(IPCOP_semctl,a,b,c,&d,0l)
+#endif
#ifdef __NR_sys_sched_getaffinity
_syscall3(int,sys_sched_getaffinity,pid_t,pid,unsigned int,cpusetsize,void*,mask)
#endif
@@ -1687,6 +1695,18 @@
abi_ulong __unused4;
};
+struct target_semid64_ds
+{
+ struct target_ipc64_perm sem_perm;
+ target_ulong sem_otime;
+ target_ulong __unused1;
+ target_ulong sem_ctime;
+ target_ulong __unused2;
+ target_ulong sem_nsems;
+ target_ulong __unused3;
+ target_ulong __unused4;
+};
+
static inline abi_long target_to_host_ipc_perm(struct ipc_perm *host_ip,
abi_ulong target_addr)
{
@@ -1725,6 +1745,43 @@
return 0;
}
+static inline abi_long target_to_host_ipc64_perm( struct ipc64_perm *host_ip, target_ulong target_addr )
+{
+ struct target_ipc64_perm *target_ip;
+ struct target_semid64_ds *target_sd;
+
+ lock_user_struct(VERIFY_READ, target_sd, target_addr, 1);
+ target_ip=&(target_sd->sem_perm);
+ host_ip->key = tswapl(target_ip->key);
+ host_ip->uid = tswapl(target_ip->uid);
+ host_ip->gid = tswapl(target_ip->gid);
+ host_ip->cuid = tswapl(target_ip->cuid);
+ host_ip->cgid = tswapl(target_ip->cgid);
+ host_ip->mode = tswap16(target_ip->mode);
+ host_ip->seq = tswap16(target_ip->seq);
+ unlock_user_struct(target_sd, target_addr, 1);
+ return 0;
+}
+
+static inline abi_long host_to_target_ipc64_perm(target_ulong target_addr,
+ struct ipc64_perm *host_ip)
+{
+ struct target_ipc64_perm *target_ip;
+ struct target_semid64_ds *target_sd;
+
+ lock_user_struct(VERIFY_WRITE, target_sd, target_addr, 0);
+ target_ip = &(target_sd->sem_perm);
+ target_ip->key = tswapl(host_ip->key);
+ target_ip->uid = tswapl(host_ip->uid);
+ target_ip->gid = tswapl(host_ip->gid);
+ target_ip->cuid = tswapl(host_ip->cuid);
+ target_ip->cgid = tswapl(host_ip->cgid);
+ target_ip->mode = tswap16(host_ip->mode);
+ target_ip->seq = tswap16(host_ip->seq);
+ unlock_user_struct(target_sd, target_addr, 1);
+ return 0;
+}
+
static inline abi_long target_to_host_semid_ds(struct semid_ds *host_sd,
abi_ulong target_addr)
{
@@ -1755,6 +1812,32 @@
return 0;
}
+static inline void target_to_host_semid64_ds(struct semid64_ds *host_sd,
+ target_ulong target_addr)
+{
+ struct target_semid64_ds *target_sd;
+
+ lock_user_struct(VERIFY_READ, target_sd, target_addr, 1);
+ target_to_host_ipc64_perm(&(host_sd->sem_perm),target_addr);
+ host_sd->sem_nsems = tswapl(target_sd->sem_nsems);
+ host_sd->sem_otime = tswapl(target_sd->sem_otime);
+ host_sd->sem_ctime = tswapl(target_sd->sem_ctime);
+ unlock_user_struct(target_sd, target_addr, 0);
+}
+
+static inline void host_to_target_semid64_ds(target_ulong target_addr,
+ struct semid64_ds *host_sd)
+{
+ struct target_semid64_ds *target_sd;
+
+ lock_user_struct(VERIFY_WRITE, target_sd, target_addr, 0);
+ host_to_target_ipc64_perm(target_addr,&(host_sd->sem_perm));
+ target_sd->sem_nsems = tswapl(host_sd->sem_nsems);
+ target_sd->sem_otime = tswapl(host_sd->sem_otime);
+ target_sd->sem_ctime = tswapl(host_sd->sem_ctime);
+ unlock_user_struct(target_sd, target_addr, 1);
+}
+
union semun {
int val;
struct semid_ds *buf;
@@ -1767,6 +1850,10 @@
unsigned short int *array;
};
+#ifndef IPC_64
+#define IPC_64 0x100
+#endif
+
static inline abi_long target_to_host_semun(int cmd,
union semun *host_su,
abi_ulong target_addr,
@@ -1779,7 +1866,15 @@
case IPC_SET:
if (!lock_user_struct(VERIFY_READ, target_su, target_addr, 1))
return -TARGET_EFAULT;
- target_to_host_semid_ds(ds,target_su->buf);
+ target_to_host_semid_ds(ds,tswapl(target_su->buf));
+ host_su->buf = ds;
+ unlock_user_struct(target_su, target_addr, 0);
+ break;
+ case IPC_STAT + IPC_64:
+ case IPC_SET + IPC_64:
+ if (!lock_user_struct(VERIFY_READ, target_su, target_addr, 1))
+ return -TARGET_EFAULT;
+ target_to_host_semid64_ds((struct semid64_ds*)ds,tswapl(target_su->buf));
host_su->buf = ds;
unlock_user_struct(target_su, target_addr, 0);
break;
@@ -1815,7 +1910,14 @@
case IPC_SET:
if (lock_user_struct(VERIFY_WRITE, target_su, target_addr, 0))
return -TARGET_EFAULT;
- host_to_target_semid_ds(target_su->buf,ds);
+ host_to_target_semid_ds(tswapl(target_su->buf),ds);
+ unlock_user_struct(target_su, target_addr, 1);
+ break;
+ case IPC_STAT + IPC_64:
+ case IPC_SET + IPC_64:
+ if (lock_user_struct(VERIFY_WRITE, target_su, target_addr, 0))
+ return -TARGET_EFAULT;
+ host_to_target_semid64_ds(tswapl(target_su->buf),(struct semid64_ds*)ds);
unlock_user_struct(target_su, target_addr, 1);
break;
case GETVAL:
@@ -1843,7 +1945,8 @@
{
union semun arg;
struct semid_ds dsarg;
- int cmd = third&0xff;
+ struct semid64_ds dsarg64;
+ int cmd = third; // &0xff;
abi_long ret = 0;
switch( cmd ) {
@@ -1872,13 +1975,23 @@
ret = get_errno(semctl(first, second, cmd, arg));
host_to_target_semun(cmd,ptr,&arg,&dsarg);
break;
+ case IPC_STAT + IPC_64:
+ target_to_host_semun(cmd,&arg,ptr,(struct semid_ds *)&dsarg64);
+ ret = get_errno(semctl(first, second, cmd, arg));
+ host_to_target_semun(cmd,ptr,&arg,(struct semid_ds *)&dsarg64);
+ break;
case IPC_SET:
target_to_host_semun(cmd,&arg,ptr,&dsarg);
ret = get_errno(semctl(first, second, cmd, arg));
host_to_target_semun(cmd,ptr,&arg,&dsarg);
break;
- default:
+ case IPC_SET + IPC_64:
+ target_to_host_semun(cmd,&arg,ptr,(struct semid_ds *)&dsarg64);
ret = get_errno(semctl(first, second, cmd, arg));
+ host_to_target_semun(cmd,ptr,&arg,(struct semid_ds *)&dsarg64);
+ break;
+ default:
+ ret = get_errno(semctl(first, second, cmd & 0xff, arg));
}
return ret;
@@ -1908,6 +2021,41 @@
abi_ulong __unused5;
};
+struct target_shmid64_ds {
+ struct target_ipc64_perm shm_perm; /* operation perms */
+ target_ulong shm_segsz; /* size of segment (bytes) */
+ target_ulong shm_atime; /* last attach time */
+ target_ulong __unused1;
+ target_ulong shm_dtime; /* last detach time */
+ target_ulong __unused2;
+ target_ulong shm_ctime; /* last change time */
+ target_ulong __unused3;
+ int32_t shm_cpid; /* pid of creator */
+ int32_t shm_lpid; /* pid of last operator */
+ target_ulong shm_nattch; /* no. of current attaches */
+ target_ulong __unused4;
+ target_ulong __unused5;
+};
+
+/* Data structure describing a set of semaphores. */
+struct target_shmid_ds
+ {
+ struct target_ipc_perm shm_perm; /* operation permission struct */
+ unsigned int __unused1;
+ target_ulong shm_atime; /* time of last shmat() */
+ unsigned int __unused2;
+ target_ulong shm_dtime; /* time of last shmdt() */
+ unsigned int __unused3;
+ target_ulong shm_ctime; /* time of last change by shmctl() */
+ unsigned int __unused4;
+ target_ulong shm_segsz; /* size of segment in bytes */
+ unsigned int shm_cpid; /* pid of creator */
+ unsigned int shm_lpid; /* pid of last shmop */
+ target_ulong shm_nattch; /* number of current attaches */
+ unsigned long __unused5;
+ unsigned long __unused6;
+ };
+
static inline abi_long target_to_host_msqid_ds(struct msqid_ds *host_md,
abi_ulong target_addr)
{
@@ -2193,11 +2341,59 @@
case IPCOP_shmctl:
switch(second) {
case IPC_RMID:
+ case IPC_RMID + IPC_64:
case SHM_LOCK:
+ case SHM_LOCK + IPC_64:
case SHM_UNLOCK:
+ case SHM_UNLOCK + IPC_64:
ret = get_errno(shmctl(first, second, NULL));
break;
+ case IPC_STAT + IPC_64:
+ {
+ struct shmid64_ds buf;
+ struct target_shmid64_ds *target_buf;
+#ifdef DEBUG
+ gemu_log("qemu: doing IPC_STAT\n");
+#endif
+ lock_user_struct(VERIFY_WRITE, target_buf, ptr, 1);
+ ret = get_errno(shmctl(first, second, (struct shmid_ds*)&buf));
+
+ host_to_target_ipc64_perm(ptr, &buf.shm_perm);
+ target_buf->shm_atime = tswapl(buf.shm_atime);
+ target_buf->shm_dtime = tswapl(buf.shm_dtime);
+ target_buf->shm_ctime = tswapl(buf.shm_ctime);
+ target_buf->shm_segsz = tswapl(buf.shm_segsz);
+ target_buf->shm_cpid = tswap32(buf.shm_cpid);
+ target_buf->shm_lpid = tswap32(buf.shm_lpid);
+ target_buf->shm_nattch = tswapl(buf.shm_nattch);
+ unlock_user_struct(target_buf, ptr, 0);
+ break;
+ }
+ case IPC_SET + IPC_64:
+ {
+ struct shmid64_ds buf;
+ struct target_shmid64_ds *target_buf;
+#ifdef DEBUG
+ gemu_log("qemu: doing IPC_SET\n");
+#endif
+ lock_user_struct(VERIFY_READ, target_buf, ptr, 1);
+
+ target_to_host_ipc64_perm(&buf.shm_perm, ptr);
+ buf.shm_atime = tswapl(target_buf->shm_atime);
+ buf.shm_dtime = tswapl(target_buf->shm_dtime);
+ buf.shm_ctime = tswapl(target_buf->shm_ctime);
+ buf.shm_segsz = tswapl(target_buf->shm_segsz);
+ buf.shm_cpid = tswap32(target_buf->shm_cpid);
+ buf.shm_lpid = tswap32(target_buf->shm_lpid);
+ buf.shm_nattch = tswapl(target_buf->shm_nattch);
+
+ ret = get_errno(shmctl(first, second, (struct shmid_ds*)&buf));
+
+ unlock_user_struct(target_buf, ptr, 0);
+ break;
+ }
default:
+ gemu_log("Unsopported shmctl(%ld,%#lx)\n", second, second);
goto unimplemented;
}
break;
--- qemu-0.10.1/linux-user/syscall_defs.h
+++ qemu-0.10.1/linux-user/syscall_defs.h
@@ -2001,3 +2001,18 @@
#include "socket.h"
#include "errno_defs.h"
+
+struct target_ipc64_perm
+{
+ int key;
+ uint32_t uid;
+ uint32_t gid;
+ uint32_t cuid;
+ uint32_t cgid;
+ unsigned short mode;
+ unsigned short __pad1;
+ unsigned short seq;
+ unsigned short __pad2;
+ abi_ulong __unused1;
+ abi_ulong __unused2;
+};
--- qemu-0.10.1/linux-user/x86_64/syscall.h
+++ qemu-0.10.1/linux-user/x86_64/syscall.h
@@ -61,21 +61,6 @@
};
#endif
-struct target_ipc64_perm
-{
- int key;
- uint32_t uid;
- uint32_t gid;
- uint32_t cuid;
- uint32_t cgid;
- unsigned short mode;
- unsigned short __pad1;
- unsigned short seq;
- unsigned short __pad2;
- abi_ulong __unused1;
- abi_ulong __unused2;
-};
-
struct target_msqid64_ds {
struct target_ipc64_perm msg_perm;
unsigned int msg_stime; /* last msgsnd time */

View File

@ -1,26 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu/linux-user/syscall.c
+++ qemu/linux-user/syscall.c
@@ -1983,9 +1983,19 @@
switch (call) {
case IPCOP_semop:
- ret = get_errno(semop(first,(struct sembuf *)g2h(ptr), second));
+ {
+ struct sembuf *target_sops;
+ int i;
+ lock_user_struct(VERIFY_READ, target_sops, ptr, 0);
+ for(i=0; i<second; i++) {
+ target_sops[i].sem_num = tswap16(target_sops[i].sem_num);
+ target_sops[i].sem_op = tswap16(target_sops[i].sem_op);
+ target_sops[i].sem_flg = tswap16(target_sops[i].sem_flg);
+ }
+ ret = get_errno(semop(first, target_sops, second));
+ unlock_user_struct(target_sops, ptr, 0);
break;
-
+ }
case IPCOP_semget:
ret = get_errno(semget(first, second, third));
break;

View File

@ -1,24 +0,0 @@
Index: qemu/linux-user/mmap.c
================================================================================
--- qemu-0.10.1/linux-user/mmap.c
+++ qemu-0.10.1/linux-user/mmap.c
@@ -33,6 +33,10 @@
#include "qemu.h"
#include "qemu-common.h"
+#if !defined(MAP_32BIT)
+#define MAP_32BIT 0
+#endif
+
//#define DEBUG_MMAP
#if defined(USE_NPTL)
@@ -232,7 +236,7 @@
if (prot1 == 0) {
/* no page was there, so we allocate one */
void *p = mmap(host_start, qemu_host_page_size, prot,
- flags | MAP_ANONYMOUS, -1, 0);
+ flags | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (p == MAP_FAILED)
return -1;
prot1 = prot;

View File

@ -1,16 +0,0 @@
Index: qemu/linux-user/syscall.c
================================================================================
--- qemu/linux-user/syscall.c
+++ qemu/linux-user/syscall.c
@@ -5491,6 +5491,11 @@
break;
#endif
+#ifdef TARGET_NR_fadvise64
+ case TARGET_NR_fadvise64:
+ goto unimplemented_nowarn;
+#endif
+
#ifdef TARGET_NR_sched_getaffinity
case TARGET_NR_sched_getaffinity:
{

View File

@ -1,13 +0,0 @@
Index: qemu-0.9.0/Makefile
================================================================================
--- qemu/Makefile
+++ qemu/Makefile
@@ -13,7 +13,7 @@
CPPFLAGS += -I. -I$(SRC_PATH) -MMD -MP
CPPFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-LIBS=
+LIBS=-lpthread
ifdef CONFIG_STATIC
BASE_LDFLAGS += -static
endif

View File

@ -1,111 +0,0 @@
Index: qemu-0.9.1/block-vmdk.c
================================================================================
--- qemu/block-vmdk.c
+++ qemu/block-vmdk.c
@@ -719,7 +719,7 @@
"ddb.geometry.cylinders = \"%" PRId64 "\"\n"
"ddb.geometry.heads = \"16\"\n"
"ddb.geometry.sectors = \"63\"\n"
- "ddb.adapterType = \"ide\"\n";
+ "ddb.adapterType = \"%s\"\n";
char desc[1024];
const char *real_filename, *temp_str;
@@ -794,7 +794,8 @@
snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL),
total_size, real_filename,
(flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
- total_size / (int64_t)(63 * 16));
+ total_size / (int64_t)(63 * 16),
+ flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide");
/* write the descriptor */
lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);
--- qemu/block_int.h
+++ qemu/block_int.h
@@ -29,6 +29,7 @@
#define BLOCK_FLAG_ENCRYPT 1
#define BLOCK_FLAG_COMPRESS 2
#define BLOCK_FLAG_COMPAT6 4
+#define BLOCK_FLAG_SCSI 8
struct BlockDriver {
const char *format_name;
--- qemu/qemu-img.c
+++ qemu/qemu-img.c
@@ -53,9 +53,9 @@
"QEMU disk image utility\n"
"\n"
"Command syntax:\n"
- " create [-e] [-6] [-b base_image] [-f fmt] filename [size]\n"
+ " create [-e] [-s] [-6] [-b base_image] [-f fmt] filename [size]\n"
" commit [-f fmt] filename\n"
- " convert [-c] [-e] [-6] [-f fmt] [-O output_fmt] [-B output_base_image] filename [filename2 [...]] output_filename\n"
+ " convert [-c] [-e] [-s] [-6] [-f fmt] [-O output_fmt] [-B output_base_image] filename [filename2 [...]] output_filename\n"
" info [-f fmt] filename\n"
"\n"
"Command parameters:\n"
@@ -73,6 +73,7 @@
" 'output_fmt' is the destination format\n"
" '-c' indicates that target image must be compressed (qcow format only)\n"
" '-e' indicates that the target image must be encrypted (qcow format only)\n"
+ " '-s' indicates that the target image is meant for SCSI (vmdk format only)\n"
" '-6' indicates that the target image must use compatibility level 6 (vmdk format only)\n"
);
printf("\nSupported format:");
@@ -211,7 +212,7 @@
flags = 0;
for(;;) {
- c = getopt(argc, argv, "b:f:he6");
+ c = getopt(argc, argv, "b:f:hes6");
if (c == -1)
break;
switch(c) {
@@ -227,6 +228,9 @@
case 'e':
flags |= BLOCK_FLAG_ENCRYPT;
break;
+ case 's':
+ flags |= BLOCK_FLAG_SCSI;
+ break;
case '6':
flags |= BLOCK_FLAG_COMPAT6;
break;
@@ -262,6 +266,8 @@
error("Unknown file format '%s'", fmt);
printf("Formatting '%s', fmt=%s",
filename, fmt);
+ if (flags & BLOCK_FLAG_SCSI)
+ printf(", SCSI");
if (flags & BLOCK_FLAG_ENCRYPT)
printf(", encrypted");
if (flags & BLOCK_FLAG_COMPAT6)
@@ -398,7 +404,7 @@
out_baseimg = NULL;
flags = 0;
for(;;) {
- c = getopt(argc, argv, "f:O:B:hce6");
+ c = getopt(argc, argv, "f:O:B:hces6");
if (c == -1)
break;
switch(c) {
@@ -420,6 +426,9 @@
case 'e':
flags |= BLOCK_FLAG_ENCRYPT;
break;
+ case 's':
+ flags |= BLOCK_FLAG_SCSI;
+ break;
case '6':
flags |= BLOCK_FLAG_COMPAT6;
break;
@@ -454,6 +463,8 @@
error("Compression not supported for this file format");
if (flags & BLOCK_FLAG_ENCRYPT && drv != &bdrv_qcow && drv != &bdrv_qcow2)
error("Encryption not supported for this file format");
+ if (flags & BLOCK_FLAG_SCSI && drv != &bdrv_vmdk)
+ error("SCSI devices not supported for this file format");
if (flags & BLOCK_FLAG_COMPAT6 && drv != &bdrv_vmdk)
error("Alternative compatibility level not supported for this file format");
if (flags & BLOCK_FLAG_ENCRYPT && flags & BLOCK_FLAG_COMPRESS)

View File

@ -1,20 +0,0 @@
--- hw/mpcore.c
+++ hw/mpcore.c
@@ -106,6 +106,7 @@
case 12: /* Interrupt status. */
return s->status;
}
+ return 0;
}
static void mpcore_timer_write(mpcore_timer_state *s, int offset,
--- target-m68k/translate.c
+++ target-m68k/translate.c
@@ -452,6 +452,7 @@
default:
qemu_assert(0, "bad operand size");
}
+ return 0;
}
/* Assign value to a register. If the width is less than the register width

View File

@ -1,46 +0,0 @@
Index: linux-user/syscall.c
================================================================================
--- configure
+++ configure
@@ -1610,6 +1610,7 @@
echo "KVM_CFLAGS=$kvm_cflags" >> $config_mak
echo "#define CONFIG_KVM 1" >> $config_h
fi
+ target_nptl="yes"
;;
x86_64)
echo "TARGET_ARCH=x86_64" >> $config_mak
--- linux-user/syscall.c
+++ linux-user/syscall.c
@@ -3175,8 +3175,14 @@
flags &= ~CLONE_NPTL_FLAGS2;
/* TODO: Implement CLONE_CHILD_CLEARTID. */
- if (nptl_flags & CLONE_SETTLS)
+ if (nptl_flags & CLONE_SETTLS) {
+#if defined(TARGET_I386) && defined(TARGET_ABI32)
+ do_set_thread_area(new_env, newtls);
+ cpu_x86_load_seg(new_env, R_GS, new_env->segs[R_GS].selector);
+#else
cpu_set_tls (new_env, newtls);
+#endif
+ }
/* Grab a mutex so that thread setup appears atomic. */
pthread_mutex_lock(&clone_lock);
@@ -3247,8 +3253,14 @@
if (flags & CLONE_PARENT_SETTID)
put_user_u32(gettid(), parent_tidptr);
ts = (TaskState *)env->opaque;
- if (flags & CLONE_SETTLS)
+ if (flags & CLONE_SETTLS) {
+#if defined(TARGET_I386) && defined(TARGET_ABI32)
+ do_set_thread_area(env, newtls);
+ cpu_x86_load_seg(env, R_GS, env->segs[R_GS].selector);
+#else
cpu_set_tls (env, newtls);
+#endif
+ }
/* TODO: Implement CLONE_CHILD_CLEARTID. */
#endif
} else {

View File

@ -1,20 +0,0 @@
--- configure
+++ configure
@@ -949,7 +949,7 @@
#include <curses.h>
int main(void) { return curses_version(); }
EOF
- if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lcurses > /dev/null 2> /dev/null ; then
+ if $cc $ARCH_CFLAGS -o $TMPE $TMPC -lncurses > /dev/null 2> /dev/null ; then
curses=yes
fi
fi # test "$curses"
@@ -1427,7 +1427,7 @@
if test "$curses" = "yes" ; then
echo "#define CONFIG_CURSES 1" >> $config_h
echo "CONFIG_CURSES=yes" >> $config_mak
- echo "CURSES_LIBS=-lcurses" >> $config_mak
+ echo "CURSES_LIBS=-lncurses" >> $config_mak
fi
if test "$brlapi" = "yes" ; then
echo "CONFIG_BRLAPI=yes" >> $config_mak

View File

@ -1,3 +1,44 @@
-------------------------------------------------------------------
Mon Aug 11 14:44:48 CEST 2009 - uli@suse.de
- update -> 0.11.0 RC1
- add machine aliasing support (Mark McLoughlin)
- add getfd/closefd monitor commands (Mark McLoughlin)
- fix live migration (various)
- HPET fixes (various)
- slirp: fix guestfwd for incoming data (Jan Kiszka)
- fix qemu-img convert to copy unallocated parts of the image
(Akkarit Sangpetch)
- vmdk: fix backing file handling (Kevin Wolf)
- scsi: add save/restore support (Nolan Leake)
- e1000: ignore reset command (Kevin Wolf)
- allow monitor interaction when using -incoming exec: (Chris Lalancette)
- fix -net socket,listen (Jan Kiszka)
- serial: fix lost characters after sysrq (Jason Wessel)
- lsi53c895a: Implement additional registers (Sebastian Herbszt)
- i386: fix cpu reset (Nitin Kamble)
- Prevent CD-ROM eject while device is locked (Mark McLoughlin)
- Fix memory leaks (various)
- Reset PS2 keyboard/mouse on reset (Dinesh Subraveti)
- Fix -initrd with > 4GB guests (Glauber Costa)
- qcow2 fixes (various)
- Enable power button event generation (Gleb Natapov)
- fix serial option in -drive
- Fix non-ACPI timer interrupt routing (Beth Kon)
- Fix keyboard mapping on newer Xords with non-default keymaps (balrog)
- Make PCI config status register read-only (Anthony Liguori)
- Fix crash on resolution change -> screen dump -> vga redraw (Avi Kivity)
- fix savevm/loadvm (various)
- virtio: fix guest oops with 2.6.25 kernels (Rusty Russell)
- SH4: add support for -kernel (Takashi Yoshii, Aurelien Jarno)
- hotplug: fix closing of char devices (Jan Kiszka)
- hotplug: remove incorrect check for device name (Eduardo Habkost)
- fix VGA regression (malc)
- added S/390 host and target
- maintaining patches in git
- several linux-user improvements for compatibility and speed
- enabled curl block driver, VNC TLS and SASL, AIO, and Bluetooth
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Apr 16 01:53:59 CEST 2009 - ro@suse.de Thu Apr 16 01:53:59 CEST 2009 - ro@suse.de

471
qemu.spec
View File

@ -1,5 +1,5 @@
# #
# spec file for package qemu (Version 0.10.1) # spec file for package qemu (Version 0.11.0)
# #
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
@ -19,39 +19,47 @@
Name: qemu Name: qemu
BuildRequires: SDL-devel bison e2fsprogs-devel libgnutls-devel libpcap-devel ncurses-devel zlib-devel-static BuildRequires: SDL-devel bison bluez-devel curl-devel cyrus-sasl-devel e2fsprogs-devel libaio-devel libgnutls-devel libpcap-devel ncurses-devel zlib-devel-static
Url: http://fabrice.bellard.free.fr/qemu/ Url: http://fabrice.bellard.free.fr/qemu/
License: BSD 3-Clause; GPL v2 or later; LGPL v2.1 or later; X11/MIT License: BSD 3-clause (or similar) ; GPL v2 or later ; LGPL v2.1 or later ; MIT License (or similar)
Group: System/Emulators/PC Group: System/Emulators/PC
Summary: Universal CPU emulator Summary: Universal CPU emulator
Version: 0.10.1 Version: 0.11.0
Release: 2 Release: 1
Source: %name-%version.tar.bz2 Source: %name-0.11.0-rc1.tar.bz2
Patch1: qemu-0.9.0.cvs-binfmt.patch Patch1: 0001-qemu-0.7.0-amd64.patch
Patch6: qemu-0.7.0-amd64.patch Patch2: 0002-qemu-0.9.0.cvs-binfmt.patch
Patch8: qemu-cvs-pthread.patch Patch3: 0003-qemu-cvs-alsa_bitfield.patch
#Patch19: qemu-0.9.0-nousbdevfs.patch Patch4: 0004-qemu-cvs-alsa_ioctl.patch
Patch34: qemu-0.9.0-migration.patch Patch5: 0005-qemu-cvs-alsa_mmap.patch
Patch50: qemu-cvs-newpath.patch Patch6: 0006-qemu-cvs-gettimeofday.patch
Patch53: qemu-cvs-sched_getaffinity.patch Patch7: 0007-qemu-cvs-ioctl_debug.patch
Patch56: qemu-cvs-ipc.patch Patch8: 0008-qemu-cvs-ioctl_nodirection.patch
Patch57: qemu-cvs-ipc_semop.patch Patch9: 0009-qemu-cvs-newpath.patch
Patch58: qemu-cvs-ioctl_debug.patch Patch10: 0010-qemu-cvs-sched_getaffinity.patch
Patch59: qemu-cvs-alsa_bitfield.patch Patch11: 0011-qemu-cvs-mmap-amd64.patch
Patch60: qemu-cvs-alsa_ioctl.patch Patch12: 0012-qemu-cvs-pthread.patch
Patch61: qemu-cvs-ioctl_nodirection.patch Patch13: 0013-qemu-img-vmdk-scsi.patch
Patch62: qemu-cvs-alsa_mmap.patch Patch14: 0014-qemu-nonvoid_return.patch
Patch63: qemu-cvs-gettimeofday.patch Patch15: 0015-pcap-network-emulation.patch
Patch64: qemu-cvs-nofadvise64.patch Patch16: 0016-i386-linux-user-NPTL-support.patch
Patch65: qemu-cvs-flash.patch Patch17: 0017-qemu-0.11-git-ioctl_mount.patch
Patch66: qemu-cvs-mmap-amd64.patch Patch18: 0018-qemu-0.11-git-user-linux-ppc-uid16_fix.patch
Patch85: qemu-img-vmdk-scsi.patch Patch19: 0019-Rewrite-mmap_find_vma-to-work-fine-on-64-bit-hosts.patch
Patch86: qemu-svn-ncurses.patch Patch20: 0020-TCG-sync-op-32-bit-targets-fixed.patch
Patch88: qemu-svn-pcap.patch Patch21: 0021-S-390-CPU-emulation.patch
Patch90: qemu-nonvoid_return.patch Patch22: 0022-S-390-host-target-build-system-support.patch
#Patch91: qemu-svn-dirent.patch Patch23: 0023-S-390-host-support-for-TCG.patch
Patch92: qemu-svn-s390.patch Patch24: 0024-linux-user-S-390-64-bit-s390x-support.patch
Patch93: qemu-svn-i386-nptl.patch Patch25: 0025-linux-user-don-t-do-locking-in-single-threaded-proc.patch
Patch26: 0026-linux-user-dup3-fallocate-syscalls.patch
Patch27: 0027-linux-user-fcntl-fixes-for-LTP.patch
Patch28: 0028-linux-user-enable-getdents-for-32-bit-systems.patch
Patch29: 0029-linux-user-define-a-couple-of-syscalls-for-non-uid1.patch
Patch30: 0030-linux-user-getpriority-errno-fix.patch
Patch31: 0031-linux-user-fadvise64-implementation.patch
Patch32: 0032-linux-user-zero-fstat-buffer-to-initialize-nsec-fie.patch
Patch33: 0033-dup3-check-fallocate-check-fixed.patch
# this is to make lint happy # this is to make lint happy
Source300: rpmlintrc Source300: rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -71,42 +79,54 @@ Authors:
Fabrice Bellard <fabrice.bellard@free.fr> Fabrice Bellard <fabrice.bellard@free.fr>
%prep %prep
%setup -q %setup -q -n qemu-0.11.0-rc1
ln -s fpu/*.h .
%patch1 -p1 %patch1 -p1
%patch6 %patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1 %patch8 -p1
#%patch19 %patch9 -p1
%patch50 -p1 %patch10 -p1
%patch53 -p1 %patch11 -p1
%patch56 -p1 %patch12 -p1
%patch57 -p1 %patch13 -p1
%patch58 -p1 %patch14 -p1
%patch59 -p1 %patch15 -p1
%patch60 -p1 %patch16 -p1
%patch61 -p1 %patch17 -p1
%patch62 -p1 %patch18 -p1
%patch63 -p1 %patch19 -p1
%patch64 -p1 %patch20 -p1
%patch65 -p1 %patch21 -p1
%patch66 -p1 %patch22 -p1
%patch85 -p1 %patch23 -p1
%patch86 %patch24 -p1
%patch88 %patch25 -p1
%patch90 %patch26 -p1
#%patch91 %patch27 -p1
%patch92 %patch28 -p1
%patch93 %patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%build %build
# build QEMU # build QEMU
mkdir -p dynamic mkdir -p dynamic
# build qemu-system without kqemu support # build qemu-system
./configure --prefix=/usr \ ./configure --prefix=/usr \
--interp-prefix=/usr/share/qemu/qemu-i386 \ --interp-prefix=/usr/share/qemu/qemu-i386 \
--audio-card-list="ac97 adlib cs4231a gus" \ --audio-card-list="ac97 es1370 sb16 cs4231a adlib gus" \
--audio-drv-list="alsa sdl" --enable-mixemu \ --audio-drv-list="alsa sdl" --enable-mixemu \
--extra-cflags="$QEMU_OPT_FLAGS" --enable-system --disable-linux-user --extra-cflags="$QEMU_OPT_FLAGS" --enable-system --disable-linux-user
# curl test fails for no reason in build system
echo "CONFIG_CURL=y" >> config-host.mak
echo "CURL_LIBS=-lcurl" >> config-host.mak
echo "#define CONFIG_CURL 1" >> config-host.h
make %{?jobs:-j%{jobs}} V=1 make %{?jobs:-j%{jobs}} V=1
make qemu-img V=1 make qemu-img V=1
mv */qemu */qemu-* qemu-img dynamic || true mv */qemu */qemu-* qemu-img dynamic || true
@ -121,21 +141,13 @@ make clean
make %{?jobs:-j%{jobs}} V=1 make %{?jobs:-j%{jobs}} V=1
%install %install
install -d -m 755 $RPM_BUILD_ROOT/usr/bin make install DESTDIR=$RPM_BUILD_ROOT
%ifnarch alpha rm -fr $RPM_BUILD_ROOT/usr/share/doc
install -m 755 */qemu $RPM_BUILD_ROOT/usr/bin install -m 755 */qemu $RPM_BUILD_ROOT/usr/bin
ln -sf qemu $RPM_BUILD_ROOT/usr/bin/qemu-system-i386 ln -sf qemu $RPM_BUILD_ROOT/usr/bin/qemu-system-i386
%endif
install -m 755 */qemu-*[^.]? $RPM_BUILD_ROOT/usr/bin install -m 755 */qemu-*[^.]? $RPM_BUILD_ROOT/usr/bin
install -d -m 755 $RPM_BUILD_ROOT/%{_mandir}/man1
install -m 644 qemu.1 $RPM_BUILD_ROOT/%{_mandir}/man1
install -d -m 755 $RPM_BUILD_ROOT/usr/share/qemu
install -m 644 pc-bios/*.bin pc-bios/video.x pc-bios/openbios-sparc* $RPM_BUILD_ROOT/usr/share/qemu
install -d -m 755 $RPM_BUILD_ROOT/usr/sbin install -d -m 755 $RPM_BUILD_ROOT/usr/sbin
install -m 755 qemu-binfmt-conf.sh $RPM_BUILD_ROOT/usr/sbin install -m 755 qemu-binfmt-conf.sh $RPM_BUILD_ROOT/usr/sbin
install -m 755 dynamic/qemu-img $RPM_BUILD_ROOT/usr/bin
install -d -m 755 $RPM_BUILD_ROOT/usr/share/qemu/keymaps
install -m 644 keymaps/[a-z]* $RPM_BUILD_ROOT/usr/share/qemu/keymaps
%ifnarch %ix86 x86_64 %ifnarch %ix86 x86_64
ln -sf ../../../emul/ia32-linux $RPM_BUILD_ROOT/usr/share/qemu/qemu-i386 ln -sf ../../../emul/ia32-linux $RPM_BUILD_ROOT/usr/share/qemu/qemu-i386
%endif %endif
@ -148,335 +160,14 @@ rm -rf ${RPM_BUILD_ROOT}
%files %files
%defattr(-, root, root) %defattr(-, root, root)
%doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html %doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html qemu-tech.html
%ifnarch alpha
/usr/bin/qemu /usr/bin/qemu
%endif
/usr/bin/qemu-* /usr/bin/qemu-*
/usr/sbin/qemu* /usr/sbin/qemu*
%{_mandir}/man1/qemu*.1.gz %doc %{_mandir}/man[18]/qemu*.[18].gz
/usr/share/qemu /usr/share/qemu
%ifnarch %ix86 x86_64 ia64 %ifnarch %ix86 x86_64 ia64
%dir /emul/ia32-linux %dir /emul/ia32-linux
%endif %endif
%changelog %changelog
* Thu Apr 16 2009 ro@suse.de
- buildfix: refresh patches
* Fri Mar 27 2009 crrodriguez@suse.de
- BuildRequire zlib-devel-static
* Tue Mar 24 2009 uli@suse.de
- update -> release (0.10.1)
- fixes bnc #435135 (CVE-2008-4539, SWAMP #22179), #362956
(CVE-2008-1945, CVE-2008-0928), #461565 (CVE-2008-2382)
- Kernel Virtual Machine acceleration support
- GDB XML register description support
- Intel e1000 emulation
- HPET emulation
- VirtIO paravirtual device support
- Marvell 88w8618 / MusicPal emulation
- Nokia N-series tablet emulation / OMAP2 processor emulation
- PCI hotplug support
- Curses display support
- qemu-nbd utility to mount supported block formats
- Altivec support in PPC emulation and new firmware (OpenBIOS)
- Multiple VNC clients are now supported
- TLS encryption is now supported in VNC
- MIPS Magnum R4000 machine (Hervé Poussineau)
- Braille support (Samuel Thibault)
- Freecom MusicPal system emulation (Jan Kiszka)
- OMAP242x and Nokia N800, N810 machines (Andrzej Zaborowski)
- EsounD audio driver (Frederick Reeve)
- Gravis Ultrasound GF1 sound card (Tibor "TS" Schütz)
- Many, many, bug fixes and new features
- virtio-net: allow masking of notifications on empty queue (Alex
Williamson)
- e1000: fix rx descriptor low threshold logic (Alex Willaimson)
- x86 tcg: add NULL checks to lsl instruction (Jan Kiszka)
- kvm vga: fix screen corruption with -std-vga and Windows (Avi Kivity)
- kvm vga: fix screen corruption with Ubuntu installations (Glauber Costa)
- virtio-net: check right return size on sg list (Alex Williamson)
- Make qemu_announce_self handle holes (live migration after hotplug)
(Marcelo Tosatti)
- Revert r6804-r6808 (qcow2 allocation info). This series of changes
added a high cost to startup for large qcow2 images (Anthony Liguori)
- qemu-img: fix help message (Aurelien Jarno)
- Fix build for non-default installs of SDL (Anthony Liguori)
- Fix race condition in env->interrupt_request. When using TCG and a
dynticks host timer, this condition could cause TCG to get stuck in an
infinite loop (Aurelien Jarno)
- Fix reading encrypted hard disk passwords during early startup (Jan
Kiszka)
- Fix encrypted disk reporting in 'info block' (Jan Kiszka)
- Fix console size with tiny displays (MusicPal) (Jan Kiszka)
- Improve error handling in bdrv_open2 (Jan Kiszka)
- Avoid leaking data in mux'ed character devices (Jan Kiszka)
- Fix initial character device reset (no banner in monitor) (Jan Kiszka)
- Fix cpuid KVM crash on i386 host (Lubomir Rintel)
- Fix SLES10sp2 installation by adding ISTAT1 register to LSI SCSI
emulation (Ryan Harper)
- s390x TCG backend
- i386-linux-user NPTL support
* Wed Oct 08 2008 uli@suse.de
- update -> current SVN
- fixes PPC hosts
- fixes SH4 targets (reenabled), adds NPTL support
- SSSE3, SSE4.* instructions, "unreal" mode fixed
- Alpha target converted to TCG
- live migration
- Bluetooth emulation
- SCSI tape support
- OpenBIOS binary updated
- UHCI emulation rewritten
- lots of bugfixes
* Mon Aug 04 2008 ro@suse.de
- fix build by adding return statements for two nonvoid functions
(qemu-nonvoid_return.patch), actually unreached code
* Thu Jul 24 2008 uli@suse.de
- update -> current SVN
- MIPS Magnum R4000 machine (Hervé Poussineau)
- Braille support (Samuel Thibault)
- Freecom MusicPal system emulation (Jan Kiszka)
- OMAP242x and Nokia N800, N810 machines (Andrzej Zaborowski)
- EsounD audio driver (Frederick Reeve)
- Gravis Ultrasound GF1 sound card (Tibor "TS" Schütz)
- added pcap networking
- ditched GCC3 thanks to TCG. Hooray!
(downside: no PPC and SH4 emulation, no S/390 host)
* Thu May 15 2008 cthiel@suse.de
- use lsilogic instead of buslogic for SCSI VMDK images
* Thu May 08 2008 uli@suse.de
- add format option to disable autodetection of disk image format
(bnc#380828)
* Fri Apr 25 2008 uli@suse.de
- revert secfix (causes data corruption, no known good patch
available yet)
- support creation of SCSI VMDK images
* Tue Mar 11 2008 uli@suse.de
- secfix (unchecked block read/write vulnerability, bug #362956)
* Thu Jan 17 2008 uli@suse.de
- update -> 0.9.1
- TFTP booting from host directory (Anthony Liguori, Erwan Velu)
- Tap device emulation for Solaris (Sittichai Palanisong)
- Monitor multiplexing to several I/O channels (Jason Wessel)
- ds1225y nvram support (Herve Poussineau)
- CPU model selection support (J. Mayer, Paul Brook, Herve Poussineau)
- Several Sparc fixes (Aurelien Jarno, Blue Swirl, Robert Reif)
- MIPS 64-bit FPU support (Thiemo Seufer)
- Xscale PDA emulation (Andrzej Zaborowski)
- ColdFire system emulation (Paul Brook)
- Improved SH4 support (Magnus Damm)
- MIPS64 support (Aurelien Jarno, Thiemo Seufer)
- Preliminary Alpha guest support (J. Mayer)
- Gumstix boards: connex and verdex emulation (Thorsten Zitterell)
- Intel mainstone II board emulation (Armin Kuster)
- VMware SVGA II graphics card support (Andrzej Zaborowski)
- revert s390-dis.c to last GPLv2 version
- reenabled qemu-system-ppcemb
* Mon Dec 10 2007 uli@suse.de
- fixed open() usage with O_CREAT
* Tue Nov 13 2007 uli@suse.de
- update -> current CVS:
- Read-only support for Parallels disk images (Alex Beregszaszi)
- CRIS emulation (Edgar E. Iglesias)
- SPARC32PLUS execution support (Blue Swirl)
- MIPS mipssim pseudo machine (Thiemo Seufer)
- Strace for Linux userland emulation (Stuart Anderson, Thayne Harbaugh)
- OMAP310 MPU emulation plus Palm T|E machine (Andrzej Zaborowski)
- ARM v6, v7, NEON SIMD and SMP emulation (Paul Brook/CodeSourcery)
* Fri Oct 12 2007 ro@suse.de
- hack to fix build: undef DEBUG_BLOCK for now
* Fri Sep 28 2007 agraf@suse.de
- fix SVM support (Alexander Graf)
* Thu Sep 13 2007 agraf@suse.de
- add SVM emulation support (Alexander Graf)
- fix a misassumption in the s390 fix (uli)
- allow more IDE power management (Ben Guthro)
- log any I/O error and perform automatic read retry for CDrom (Ben Guthro)
- fix Coherent guest support (Jan Jezabek)
- fix several Darwin guest issues (Filip Navara)
* Mon Aug 20 2007 agraf@suse.de
- fix ATAPI bug when using libata (Brandon Philips) (#291775)
* Sat Aug 11 2007 olh@suse.de
- disable only SNDRV_SB_CSP_IOCTL_LOAD_CODE for _IOC_SIZEBITS < 14
* Thu Aug 09 2007 olh@suse.de
- disable some alsa SB ioctl declarations
* Mon Aug 06 2007 olh@suse.de
- remove inclusion of linux/compiler.h
* Mon Jul 30 2007 uli@suse.de
- fixed for S/390
* Tue Jul 10 2007 schwab@suse.de
- Add (incomplete) m68k emulation.
* Mon Jul 09 2007 agraf@suse.de
- included alsa support in qemu-user
- update to current cvs
- TFTP booting from host directory (Anthony Liguori, Erwan Velu)
- Tap device emulation for Solaris (Sittichai Palanisong)
- Monitor multiplexing to several I/O channels (Jason Wessel)
- ds1225y nvram support (Herve Poussineau)
- CPU model selection support (J. Mayer, Paul Brook, Herve Poussineau)
- Several Sparc fixes (Aurelien Jarno, Blue Swirl)
- MIPS 64-bit FPU support (Thiemo Seufer)
- Xscale PDA emulation (Andrzei Zaborowski)
- ColdFire system emulation (Paul Brook)
- Improved SH4 support (Magnus Damm)
- MIPS64 support (Aurelien Jarno, Thiemo Seufer)
- Preliminary Alpha guest support (J. Mayer)
- IPC fixes
* Wed Jun 20 2007 agraf@suse.de
- applied proper fix for x86_64 and the MAP_32BIT flag
* Wed Jun 20 2007 uli@suse.de
- added secfixes (bug #252519)
* Thu Jun 14 2007 agraf@suse.de
- made wine work (set FS register to 0 on init)
- suppressed robust_list warnings
* Wed Jun 13 2007 agraf@suse.de
- made flash player 9 work on ppc
- fixed FUTEX_WAKE_OP on machines where endianness differs
- made mmap on x86_64 use the MAP_32BIT flag
- removed a useless spin_lock
- removed an annoying debug message for forking
- implemented sched_getaffinity syscall
- fixed configure call so it takes gcc3 again
* Wed Jun 13 2007 uli@suse.de
- support "vga=" parameter (Pascal Terjan)
- direct jump support for x86-64 (Gwenole Beauchesne)
- fix chaining of CPU instances (Gwenole Beauchesne)
- live migration support (Anthony Liguori)
- fix fprem/fprem1 insns (Julian Seward)
- KVM support
- Z80/ZX Spectrum emulation (Stuart Brady)
- GCC4 support postponed (breaks x86-64 on i386)
* Mon Jun 11 2007 agraf@suse.de
- implemented TLS support on i386 so qemu-user can be used to run
with current libc versions (partly done by David Woodhouse,
fixed by Alexander Graf)
- added a dirty hack for an mmap page table bug on qemu-user x86
emulation
- disable AF_NETLINK in qemu-user (endianness problems)
- applied fast path mangling patch from Kirill A. Shutemov
- applied strace patch for debugging (by Stuart R. Anderson)
* Wed Apr 04 2007 agraf@suse.de
- fixed initrd loading on x86
* Thu Mar 29 2007 ro@suse.de
- added bison to BuildRequires
* Tue Feb 20 2007 uli@suse.de
- added better fix by Robert Schiele (bug #241950)
- update -> 0.9.0
- Support for relative paths in backing files for disk images
- Async file I/O API
- New qcow2 disk image format
- Support of multiple VM snapshots
- Linux: specific host CDROM and floppy support
- SMM support
- Moved PCI init, MP table init and ACPI table init to Bochs BIOS
- Support for MIPS32 Release 2 instruction set (Thiemo Seufer)
- MIPS Malta system emulation (Aurelien Jarno, Stefan Weil)
- Darwin userspace emulation (Pierre d'Herbemont)
- m68k user support (Paul Brook)
- several x86 and x86_64 emulation fixes
- Mouse relative offset VNC extension (Anthony Liguori)
- PXE boot support (Anthony Liguori)
- '-daemonize' option (Anthony Liguori)
* Tue Feb 06 2007 uli@suse.de
- added fix by Robert Schiele to work without usbdevfs
(bug #241950)
* Fri Feb 02 2007 ro@suse.de
- remove -fstack-protector from CFLAGS
* Fri Oct 27 2006 schwab@suse.de
- Fix char signedness.
* Mon Sep 11 2006 uli@suse.de
- re-added ARM FPE patch
- fixed SPARC on PPC
- install missing openbios-sparc32
* Sat Sep 09 2006 dmueller@suse.de
- update to 0.8.2:
- ACPI support
- PC VGA BIOS fixes
- MIPS FPU support (Marius Groeger)
- PPC breakpoints and single stepping (Jason Wessel)
- USB updates (Paul Brook)
- UDP/TCP/telnet character devices (Jason Wessel)
- Windows sparse file support (Frediano Ziglio)
- RTL8139 NIC TCP segmentation offloading (Igor Kovalenko)
- PCNET NIC support (Antony T Curtis)
- Support for variable frequency host CPUs
- Workaround for win32 SMP hosts
- Support for AMD Flash memories (Jocelyn Mayer)
- Audio capture to WAV files support (malc)
* Tue May 30 2006 uli@suse.de
- fixed to build on PPC with new glibc
* Mon May 29 2006 uli@suse.de
- fixed to build with new kernel headers
* Wed Mar 08 2006 uli@suse.de
- split giant patch
- added NWFPE glue code fix
* Tue Mar 07 2006 schwab@suse.de
- More fixes for ia64 port.
* Tue Mar 07 2006 schwab@suse.de
- Remove obsolete hunk from ia64 patch.
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Tue Dec 20 2005 uli@suse.de
- update -> 0.8.0
* Thu Dec 08 2005 uli@suse.de
- update to current CVS (MIPS userspace, ARM system, SMP, USB,
NX, VLAN, serial, parallel, ES1370, ALSA backend)
- build i386 and AMD64 emus with kqemu support if possible
- install missing PPC video driver, SPARC boot ROM
- install missing keymaps
* Mon Nov 07 2005 uli@suse.de
- updated linker scripts for new binutils release
* Sat Sep 17 2005 dmueller@suse.de
- update to 0.7.2
* Mon Aug 15 2005 schwab@suse.de
- Don't package /emul/ia32-linux on ia64.
* Mon Aug 15 2005 schwab@suse.de
- Fix compilation on ia64.
* Mon Aug 01 2005 uli@suse.de
- update -> 0.7.1
- enabled x86_64-system
* Mon Jul 11 2005 uli@suse.de
- update -> CVS (MIPS emulation)
- build with throwaway GCC3 (still no GCC4-compatible QEMU in
sight)
- enabled armeb-user
- link *-user statically (necessary for chrooting into non-native
systems)
- disabled s390, alpha, armv4l build (broken and unmaintained)
- disabled qemu-fast (broken and deprecated)
- disabled i386-user on x86_64 (useless)
- build with %%jobs
* Wed Jun 01 2005 ro@suse.de
- update to 0.7.0, still no success with gcc-4
* Thu Jan 27 2005 uli@suse.de
- baselibs-x86 link is unnecessary on x86/AMD64
- two ARM emulation fixes (RRX operand fix by Paul Brook, shifter
carry fix by me)
- SDL 1.2.8 can be linked statically -> enabled qemu-fast
* Mon Nov 29 2004 uli@suse.de
- update -> 0.6.1
- build softmmu binaries on s390 (still doesn't work though)
- pack /emul/ia32-linux directory and symlink from /usr/share/qemu
so it's possible to use the IA64 baselibs-x86 packages
* Wed Sep 15 2004 uli@suse.de
- removed unnecessary dependency on private glibc symbol
(bug #44864)
* Fri Aug 06 2004 uli@suse.de
- update -> 0.6.0 (fixes for several OSs, improvements in emulated
hardware (IDE, PCI, network, VGA, APM, PowerMac), minor fixes,
tool for conversion of VMware images)
* Tue May 11 2004 uli@suse.de
- update -> 0.5.5 (contains ARM, utime() fixes and several others)
- make uname() return target machine name (fixes config.guess,
rpm etc.)
- fake sigaltstack() (fixes m4)
- enabled x86-64
* Wed May 05 2004 uli@suse.de
- fixed ARM emulation bug
* Wed Apr 28 2004 uli@suse.de
- build with -fno-unit-at-a-time (fixes PPC system emulator)
* Wed Apr 28 2004 uli@suse.de
- update -> 0.5.4 (runs Linux/PPC, several fixes)
* Mon Apr 19 2004 uli@suse.de
- initial package