Hello community,
here is the log from the commit of package qemu for openSUSE:Factory
checked in at Tue Aug 11 17:37:10 CEST 2009.
--------
--- qemu/qemu.changes 2009-04-16 01:54:06.000000000 +0200
+++ qemu/qemu.changes 2009-08-11 16:06:39.000000000 +0200
@@ -1,0 +2,41 @@
+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
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
qemu-0.10.1.tar.bz2
qemu-0.7.0-amd64.patch
qemu-0.9.0-migration.patch
qemu-0.9.0.cvs-binfmt.patch
qemu-cvs-alsa_bitfield.patch
qemu-cvs-alsa_ioctl.patch
qemu-cvs-alsa_mmap.patch
qemu-cvs-flash.patch
qemu-cvs-gettimeofday.patch
qemu-cvs-ioctl_debug.patch
qemu-cvs-ioctl_nodirection.patch
qemu-cvs-ipc.patch
qemu-cvs-ipc_semop.patch
qemu-cvs-mmap-amd64.patch
qemu-cvs-newpath.patch
qemu-cvs-nofadvise64.patch
qemu-cvs-pthread.patch
qemu-cvs-sched_getaffinity.patch
qemu-img-vmdk-scsi.patch
qemu-nonvoid_return.patch
qemu-svn-i386-nptl.patch
qemu-svn-ncurses.patch
qemu-svn-pcap.patch
qemu-svn-s390.patch
New:
----
0001-qemu-0.7.0-amd64.patch
0002-qemu-0.9.0.cvs-binfmt.patch
0003-qemu-cvs-alsa_bitfield.patch
0004-qemu-cvs-alsa_ioctl.patch
0005-qemu-cvs-alsa_mmap.patch
0006-qemu-cvs-gettimeofday.patch
0007-qemu-cvs-ioctl_debug.patch
0008-qemu-cvs-ioctl_nodirection.patch
0009-qemu-cvs-newpath.patch
0010-qemu-cvs-sched_getaffinity.patch
0011-qemu-cvs-mmap-amd64.patch
0012-qemu-cvs-pthread.patch
0013-qemu-img-vmdk-scsi.patch
0014-qemu-nonvoid_return.patch
0015-pcap-network-emulation.patch
0016-i386-linux-user-NPTL-support.patch
0017-qemu-0.11-git-ioctl_mount.patch
0018-qemu-0.11-git-user-linux-ppc-uid16_fix.patch
0019-Rewrite-mmap_find_vma-to-work-fine-on-64-bit-hosts.patch
0020-TCG-sync-op-32-bit-targets-fixed.patch
0021-S-390-CPU-emulation.patch
0022-S-390-host-target-build-system-support.patch
0023-S-390-host-support-for-TCG.patch
0024-linux-user-S-390-64-bit-s390x-support.patch
0025-linux-user-don-t-do-locking-in-single-threaded-proc.patch
0026-linux-user-dup3-fallocate-syscalls.patch
0027-linux-user-fcntl-fixes-for-LTP.patch
0028-linux-user-enable-getdents-for-32-bit-systems.patch
0029-linux-user-define-a-couple-of-syscalls-for-non-uid1.patch
0030-linux-user-getpriority-errno-fix.patch
0031-linux-user-fadvise64-implementation.patch
0032-linux-user-zero-fstat-buffer-to-initialize-nsec-fie.patch
0033-dup3-check-fallocate-check-fixed.patch
qemu-0.11.0-rc1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ qemu.spec ++++++
--- /var/tmp/diff_new_pack.J7kJDx/_old 2009-08-11 17:34:46.000000000 +0200
+++ /var/tmp/diff_new_pack.J7kJDx/_new 2009-08-11 17:34:46.000000000 +0200
@@ -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.
#
@@ -19,39 +19,47 @@
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/
-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
Summary: Universal CPU emulator
-Version: 0.10.1
-Release: 2
-Source: %name-%version.tar.bz2
-Patch1: qemu-0.9.0.cvs-binfmt.patch
-Patch6: qemu-0.7.0-amd64.patch
-Patch8: qemu-cvs-pthread.patch
-#Patch19: qemu-0.9.0-nousbdevfs.patch
-Patch34: qemu-0.9.0-migration.patch
-Patch50: qemu-cvs-newpath.patch
-Patch53: qemu-cvs-sched_getaffinity.patch
-Patch56: qemu-cvs-ipc.patch
-Patch57: qemu-cvs-ipc_semop.patch
-Patch58: qemu-cvs-ioctl_debug.patch
-Patch59: qemu-cvs-alsa_bitfield.patch
-Patch60: qemu-cvs-alsa_ioctl.patch
-Patch61: qemu-cvs-ioctl_nodirection.patch
-Patch62: qemu-cvs-alsa_mmap.patch
-Patch63: qemu-cvs-gettimeofday.patch
-Patch64: qemu-cvs-nofadvise64.patch
-Patch65: qemu-cvs-flash.patch
-Patch66: qemu-cvs-mmap-amd64.patch
-Patch85: qemu-img-vmdk-scsi.patch
-Patch86: qemu-svn-ncurses.patch
-Patch88: qemu-svn-pcap.patch
-Patch90: qemu-nonvoid_return.patch
-#Patch91: qemu-svn-dirent.patch
-Patch92: qemu-svn-s390.patch
-Patch93: qemu-svn-i386-nptl.patch
+Version: 0.11.0
+Release: 1
+Source: %name-0.11.0-rc1.tar.bz2
+Patch1: 0001-qemu-0.7.0-amd64.patch
+Patch2: 0002-qemu-0.9.0.cvs-binfmt.patch
+Patch3: 0003-qemu-cvs-alsa_bitfield.patch
+Patch4: 0004-qemu-cvs-alsa_ioctl.patch
+Patch5: 0005-qemu-cvs-alsa_mmap.patch
+Patch6: 0006-qemu-cvs-gettimeofday.patch
+Patch7: 0007-qemu-cvs-ioctl_debug.patch
+Patch8: 0008-qemu-cvs-ioctl_nodirection.patch
+Patch9: 0009-qemu-cvs-newpath.patch
+Patch10: 0010-qemu-cvs-sched_getaffinity.patch
+Patch11: 0011-qemu-cvs-mmap-amd64.patch
+Patch12: 0012-qemu-cvs-pthread.patch
+Patch13: 0013-qemu-img-vmdk-scsi.patch
+Patch14: 0014-qemu-nonvoid_return.patch
+Patch15: 0015-pcap-network-emulation.patch
+Patch16: 0016-i386-linux-user-NPTL-support.patch
+Patch17: 0017-qemu-0.11-git-ioctl_mount.patch
+Patch18: 0018-qemu-0.11-git-user-linux-ppc-uid16_fix.patch
+Patch19: 0019-Rewrite-mmap_find_vma-to-work-fine-on-64-bit-hosts.patch
+Patch20: 0020-TCG-sync-op-32-bit-targets-fixed.patch
+Patch21: 0021-S-390-CPU-emulation.patch
+Patch22: 0022-S-390-host-target-build-system-support.patch
+Patch23: 0023-S-390-host-support-for-TCG.patch
+Patch24: 0024-linux-user-S-390-64-bit-s390x-support.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
Source300: rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -71,42 +79,54 @@
Fabrice Bellard
%prep
-%setup -q
-ln -s fpu/*.h .
+%setup -q -n qemu-0.11.0-rc1
%patch1 -p1
-%patch6
+%patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
+%patch7 -p1
%patch8 -p1
-#%patch19
-%patch50 -p1
-%patch53 -p1
-%patch56 -p1
-%patch57 -p1
-%patch58 -p1
-%patch59 -p1
-%patch60 -p1
-%patch61 -p1
-%patch62 -p1
-%patch63 -p1
-%patch64 -p1
-%patch65 -p1
-%patch66 -p1
-%patch85 -p1
-%patch86
-%patch88
-%patch90
-#%patch91
-%patch92
-%patch93
+%patch9 -p1
+%patch10 -p1
+%patch11 -p1
+%patch12 -p1
+%patch13 -p1
+%patch14 -p1
+%patch15 -p1
+%patch16 -p1
+%patch17 -p1
+%patch18 -p1
+%patch19 -p1
+%patch20 -p1
+%patch21 -p1
+%patch22 -p1
+%patch23 -p1
+%patch24 -p1
+%patch25 -p1
+%patch26 -p1
+%patch27 -p1
+%patch28 -p1
+%patch29 -p1
+%patch30 -p1
+%patch31 -p1
+%patch32 -p1
+%patch33 -p1
%build
# build QEMU
mkdir -p dynamic
-# build qemu-system without kqemu support
+# build qemu-system
./configure --prefix=/usr \
--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 \
--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 qemu-img V=1
mv */qemu */qemu-* qemu-img dynamic || true
@@ -121,21 +141,13 @@
make %{?jobs:-j%{jobs}} V=1
%install
-install -d -m 755 $RPM_BUILD_ROOT/usr/bin
-%ifnarch alpha
+make install DESTDIR=$RPM_BUILD_ROOT
+rm -fr $RPM_BUILD_ROOT/usr/share/doc
install -m 755 */qemu $RPM_BUILD_ROOT/usr/bin
ln -sf qemu $RPM_BUILD_ROOT/usr/bin/qemu-system-i386
-%endif
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 -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
ln -sf ../../../emul/ia32-linux $RPM_BUILD_ROOT/usr/share/qemu/qemu-i386
%endif
@@ -148,13 +160,11 @@
%files
%defattr(-, root, root)
-%doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html
-%ifnarch alpha
+%doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html qemu-tech.html
/usr/bin/qemu
-%endif
/usr/bin/qemu-*
/usr/sbin/qemu*
-%{_mandir}/man1/qemu*.1.gz
+%doc %{_mandir}/man[18]/qemu*.[18].gz
/usr/share/qemu
%ifnarch %ix86 x86_64 ia64
%dir /emul/ia32-linux
++++++ 0001-qemu-0.7.0-amd64.patch ++++++
From 736ba7792e27aa443af4a3737a7372ff774dc394 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
@@ -86,8 +84,8 @@ SECTIONS
.data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) }
+ .eh_frame : { KEEP (*(.eh_frame)) }
+ .gcc_except_table : { *(.gcc_except_table) }
.dynamic : { *(.dynamic) }
.ctors :
{
--
1.6.2.1
++++++ 0002-qemu-0.9.0.cvs-binfmt.patch ++++++
From 993c181ec92f0e5edfcb609048a4fa288c193309 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Tue, 14 Apr 2009 16:18:44 +0200
Subject: [PATCH 02/33] qemu-0.9.0.cvs-binfmt
Fixes binfmt_misc setup script:
- x86_64 is i386-compatible
- m68k signature fixed
- path to QEMU
Signed-off-by: Ulrich Hecht
---
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
cpu=`uname -m`
case "$cpu" in
- i386|i486|i586|i686|i86pc|BePC)
+ i386|i486|i586|i686|i86pc|BePC|x86_64)
cpu="i386"
;;
m68k)
@@ -24,36 +24,39 @@ case "$cpu" in
"Power Macintosh"|ppc|ppc64)
cpu="ppc"
;;
- armv4l)
+ armv[4-9]*l)
cpu="arm"
;;
+ sparc*)
+ cpu="sparc"
+ ;;
esac
# register the interpreter for each cpu except for the native one
if [ $cpu != "i386" ] ; then
- echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
- echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
+ echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
+ echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "arm" ] ; then
- echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
- echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
+ echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
+ echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "sparc" ] ; then
- echo ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
+ echo ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "ppc" ] ; then
- echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
+ echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "m68k" ] ; then
echo 'Please check cpu value and header information for m68k!'
- echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
+ echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\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-m68k:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "mips" ] ; then
# FIXME: We could use the other endianness on a MIPS host.
- echo ':mips:M::\x7fELF\x01\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/local/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
- echo ':mipsel:M::\x7fELF\x01\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/local/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
- echo ':mipsn32:M::\x7fELF\x01\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/local/bin/qemu-mipsn32:' > /proc/sys/fs/binfmt_misc/register
- echo ':mipsn32el:M::\x7fELF\x01\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/local/bin/qemu-mipsn32el:' > /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/local/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/local/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
+ echo ':mips:M::\x7fELF\x01\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-mips:' > /proc/sys/fs/binfmt_misc/register
+ echo ':mipsel:M::\x7fELF\x01\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-mipsel:' > /proc/sys/fs/binfmt_misc/register
+ echo ':mipsn32:M::\x7fELF\x01\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-mipsn32:' > /proc/sys/fs/binfmt_misc/register
+ echo ':mipsn32el:M::\x7fELF\x01\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-mipsn32el:' > /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
fi
--
1.6.2.1
++++++ 0003-qemu-cvs-alsa_bitfield.patch ++++++
From 6a9b13749aa2889fee2d6dc2fc4ae80a3df24a49 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Tue, 14 Apr 2009 16:20:50 +0200
Subject: [PATCH 03/33] qemu-cvs-alsa_bitfield
Implements TYPE_INTBITFIELD partially. (required for ALSA support)
Signed-off-by: Ulrich Hecht
---
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_SHORT:
case TYPE_INT:
+ case TYPE_INTBITFIELD:
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
case TYPE_LONG:
@@ -139,6 +140,26 @@ const argtype *thunk_convert(void *dst, const void *src,
case TYPE_INT:
*(uint32_t *)dst = tswap32(*(uint32_t *)src);
break;
+ case TYPE_INTBITFIELD:
+#if defined(TARGET_I386) && defined(__powerpc__)
+ /* powerpc uses the MSB, whereas i386 uses the LSB
+ * to store the first bit in a field */
+ {
+ unsigned char byte = *(uint8_t *)src;
+ *(uint8_t *)dst = ((byte >> 7) & 1)
+ | ((byte >> 5) & 2)
+ | ((byte >> 3) & 4)
+ | ((byte >> 1) & 8)
+ | ((byte << 1) & 16)
+ | ((byte << 3) & 32)
+ | ((byte << 5) & 64)
+ | ((byte << 7) & 128);
+ /* FIXME: implement for bitfields > 1 byte and other archs */
+ }
+#else
+ *(uint32_t *)dst = tswap32(*(uint32_t *)src);
+#endif
+ break;
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
*(uint64_t *)dst = tswap64(*(uint64_t *)src);
diff --git a/thunk.h b/thunk.h
index 109c541..55890f3 100644
--- a/thunk.h
+++ b/thunk.h
@@ -37,6 +37,7 @@ typedef enum argtype {
TYPE_PTR,
TYPE_ARRAY,
TYPE_STRUCT,
+ TYPE_INTBITFIELD,
} argtype;
#define MK_PTR(type) TYPE_PTR, type
@@ -90,6 +91,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
case TYPE_SHORT:
return 2;
case TYPE_INT:
+ case TYPE_INTBITFIELD:
return 4;
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
@@ -127,6 +129,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
case TYPE_SHORT:
return 2;
case TYPE_INT:
+ case TYPE_INTBITFIELD:
return 4;
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
--
1.6.2.1
++++++ 0004-qemu-cvs-alsa_ioctl.patch ++++++
++++ 3626 lines (skipped)
++++++ 0005-qemu-cvs-alsa_mmap.patch ++++++
From 3c312c26b8dd16c170720160677c0cd72ad71655 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Tue, 14 Apr 2009 16:24:15 +0200
Subject: [PATCH 05/33] qemu-cvs-alsa_mmap
Hack to prevent ALSA from using mmap() interface to simplify emulation.
Signed-off-by: Ulrich Hecht
---
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_CONTROL 0x81000000
+
/* NOTE: all the constants are the HOST ones */
abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
int flags, int fd, abi_ulong offset)
@@ -356,6 +359,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
}
#endif
+ /* Alsa tries to communcate with the kernel via mmap. This usually
+ * is a good idea when user- and kernelspace are running on the
+ * same architecture but does not work out when not. To make alsa
+ * not to use mmap, we can just have it fail on the mmap calls that
+ * would initiate this.
+ */
+ if(offset == SNDRV_PCM_MMAP_OFFSET_STATUS || offset == SNDRV_PCM_MMAP_OFFSET_CONTROL) {
+ errno = EINVAL;
+ return -1;
+ }
+
if (offset & ~TARGET_PAGE_MASK) {
errno = EINVAL;
goto fail;
--
1.6.2.1
++++++ 0006-qemu-cvs-gettimeofday.patch ++++++
From 3baf3b46ba7a653bdfdca59edb64f87d7b9a0671 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
++++++ 0007-qemu-cvs-ioctl_debug.patch ++++++
From dfc0f3252a5333ec9c70122c2ca9bb25578e0f2e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0008-qemu-cvs-ioctl_nodirection.patch ++++++
From 0ae47f212081dde6ff4cbc44864003132b8a59ef Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0009-qemu-cvs-newpath.patch ++++++
From 447a7055bbff636821fb9a559e9b8d30b1ab9391 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Tue, 14 Apr 2009 16:28:45 +0200
Subject: [PATCH 09/33] qemu-cvs-newpath
fast path mangling patch by Kirill A. Shutemov
Signed-off-by: Ulrich Hecht
---
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 @@
/* Code to mangle pathnames into those matching a given prefix.
eg. open("/lib/foo.so") => open("/usr/gnemul/i386-linux/lib/foo.so");
-
- The assumption is that this area does not change.
*/
#include
-#include
+#include
#include
-#include
#include
-#include
#include
#include "qemu.h"
-struct pathelem
-{
- /* Name of this, eg. lib */
- char *name;
- /* Full path name, eg. /usr/gnemul/x86-linux/lib. */
- char *pathname;
- struct pathelem *parent;
- /* Children */
- unsigned int num_entries;
- struct pathelem *entries[0];
+struct path_list_head {
+ struct path_list_head *next;
+ char* path;
};
-static struct pathelem *base;
-
-/* First N chars of S1 match S2, and S2 is N chars long. */
-static int strneq(const char *s1, unsigned int n, const char *s2)
-{
- unsigned int i;
-
- for (i = 0; i < n; i++)
- if (s1[i] != s2[i])
- return 0;
- return s2[i] == 0;
-}
-
-static struct pathelem *add_entry(struct pathelem *root, const char *name);
-
-static struct pathelem *new_entry(const char *root,
- struct pathelem *parent,
- const char *name)
-{
- struct pathelem *new = malloc(sizeof(*new));
- new->name = strdup(name);
- asprintf(&new->pathname, "%s/%s", root, name);
- new->num_entries = 0;
- return new;
-}
-
-#define streq(a,b) (strcmp((a), (b)) == 0)
-
-static struct pathelem *add_dir_maybe(struct pathelem *path)
-{
- DIR *dir;
-
- if ((dir = opendir(path->pathname)) != NULL) {
- struct dirent *dirent;
-
- while ((dirent = readdir(dir)) != NULL) {
- if (!streq(dirent->d_name,".") && !streq(dirent->d_name,"..")){
- path = add_entry(path, dirent->d_name);
- }
- }
- closedir(dir);
- }
- return path;
-}
-
-static struct pathelem *add_entry(struct pathelem *root, const char *name)
-{
- root->num_entries++;
-
- root = realloc(root, sizeof(*root)
- + sizeof(root->entries[0])*root->num_entries);
-
- root->entries[root->num_entries-1] = new_entry(root->pathname, root, name);
- root->entries[root->num_entries-1]
- = add_dir_maybe(root->entries[root->num_entries-1]);
- return root;
-}
-
-/* This needs to be done after tree is stabilized (ie. no more reallocs!). */
-static void set_parents(struct pathelem *child, struct pathelem *parent)
-{
- unsigned int i;
-
- child->parent = parent;
- for (i = 0; i < child->num_entries; i++)
- set_parents(child->entries[i], child);
-}
-
-/* FIXME: Doesn't handle DIR/.. where DIR is not in emulated dir. */
-static const char *
-follow_path(const struct pathelem *cursor, const char *name)
-{
- unsigned int i, namelen;
-
- name += strspn(name, "/");
- namelen = strcspn(name, "/");
-
- if (namelen == 0)
- return cursor->pathname;
-
- if (strneq(name, namelen, ".."))
- return follow_path(cursor->parent, name + namelen);
-
- if (strneq(name, namelen, "."))
- return follow_path(cursor, name + namelen);
-
- for (i = 0; i < cursor->num_entries; i++)
- if (strneq(name, namelen, cursor->entries[i]->name))
- return follow_path(cursor->entries[i], name + namelen);
-
- /* Not found */
- return NULL;
-}
+static struct path_list_head* list_head;
void init_paths(const char *prefix)
{
- char pref_buf[PATH_MAX];
-
- if (prefix[0] == '\0' ||
- !strcmp(prefix, "/"))
+ if (prefix[0] != '/' ||
+ prefix[0] == '\0' ||
+ !strcmp(prefix, "/"))
return;
- if (prefix[0] != '/') {
- char *cwd = get_current_dir_name();
- if (!cwd)
- abort();
- strcpy(pref_buf, cwd);
- strcat(pref_buf, "/");
- strcat(pref_buf, prefix);
- free(cwd);
- } else
- strcpy(pref_buf,prefix + 1);
+ list_head = malloc(sizeof(struct path_list_head));
- base = new_entry("", NULL, pref_buf);
- base = add_dir_maybe(base);
- if (base->num_entries == 0) {
- free (base);
- base = NULL;
- } else {
- set_parents(base, base);
- }
+ /* first element of list is prefix */
+ list_head->path = strdup(prefix);
+ list_head->next = NULL;
}
/* Look for path in emulation dir, otherwise return name. */
const char *path(const char *name)
{
+ struct path_list_head *list = list_head;
+ int path_length = strlen(list_head->path) + strlen(name) + 1;
+ char *newname = malloc(path_length);
+ struct stat buf;
+ const char * result = name;
+
/* Only do absolute paths: quick and dirty, but should mostly be OK.
Could do relative by tracking cwd. */
- if (!base || !name || name[0] != '/')
- return name;
-
- return follow_path(base, name) ?: name;
+ if (!list_head || result[0] != '/')
+ goto exit;
+
+ strncpy(newname, list_head->path, path_length);
+ strncat(newname, name, path_length);
+
+ /* look for place where path should be present */
+ while ( list->next && (strcmp(list->next->path, newname) < 0) )
+ list = list->next;
+
+ /* if there is no path in list */
+ if ( !list->next || strcmp(list->next->path, newname) ) {
+ /* add element to list if path exist in emulation dir */
+ if ( !stat(newname, &buf) )
+ {
+ struct path_list_head *new;
+
+ new = malloc(sizeof(struct path_list_head));
+ new->path = strdup(newname);
+ new->next = list->next;
+ list->next = new;
+ result = new->path;
+ }
+
+ } else if ( stat(list->next->path, &buf) ) {
+ /* remove element from list if path doesn't exist in emulation dir */
+ struct path_list_head* tmp;
+
+ tmp = list->next;
+ list->next = tmp->next;
+ free(tmp->path);
+ free(tmp);
+ } else
+ result = list->next->path;
+
+exit:
+ free(newname);
+ return result;
}
--
1.6.2.1
++++++ 0010-qemu-cvs-sched_getaffinity.patch ++++++
From 2c9c1dd32c9abf3ae72101782eada5a11c4334a5 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Tue, 14 Apr 2009 16:30:16 +0200
Subject: [PATCH 10/33] qemu-cvs-sched_getaffinity
Implements sched_getaffinity syscall.
Signed-off-by: Ulrich Hecht
---
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_sched_getaffinity __NR_sched_getaffinity
#define __NR_sys_uname __NR_uname
#define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat
@@ -213,6 +214,9 @@ _syscall3(int,sys_tgkill,int,tgid,int,pid,int,sig)
#if defined(TARGET_NR_tkill) && defined(__NR_tkill)
_syscall2(int,sys_tkill,int,tid,int,sig)
#endif
+#ifdef __NR_sys_sched_getaffinity
+_syscall3(int,sys_sched_getaffinity,pid_t,pid,unsigned int,cpusetsize,void*,mask)
+#endif
#ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code)
#endif
@@ -6979,6 +6983,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#endif
#endif /* CONFIG_SPLICE */
+
+#ifdef TARGET_NR_sched_getaffinity
+ case TARGET_NR_sched_getaffinity:
+ {
+ cpu_set_t *mask;
+ lock_user_struct(VERIFY_READ, mask, arg3, 1);
+ ret = get_errno(sys_sched_getaffinity((pid_t)arg1, (unsigned int)arg2, mask));
+ unlock_user_struct(mask, arg3, 0);
+ break;
+ }
+#endif
+
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.6.2.1
++++++ 0011-qemu-cvs-mmap-amd64.patch ++++++
From b8637036b678276513dd920045016b0e8c37df4d Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0012-qemu-cvs-pthread.patch ++++++
From 09e232e1084dd42cf233fcac97816851b9261693 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0013-qemu-img-vmdk-scsi.patch ++++++
From 8acba6ba3add1b4e463f6fce711357e3c7c70555 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0014-qemu-nonvoid_return.patch ++++++
From e880deb6d14c779cd9ecca4a25168c162183200e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0015-pcap-network-emulation.patch ++++++
From 0792daad3fd53b5fb841fc6ed0e8ec6a06e8479a Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Tue, 14 Apr 2009 16:52:51 +0200
Subject: [PATCH 15/33] pcap network emulation
Implements network emulation using libpcap; useful for direct Ethernet access.
Signed-off-by: Ulrich Hecht
---
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
CPPFLAGS+=-I$(SRC_PATH)/slirp
endif
+ifdef CONFIG_PCAP
+LIBS+=-lpcap
+endif
# specific flags are needed for non soft mmu emulator
ifdef CONFIG_STATIC
diff --git a/configure b/configure
index 2a6ae40..d104413 100755
--- a/configure
+++ b/configure
@@ -169,6 +169,7 @@ mingw32="no"
EXESUF=""
slirp="yes"
vde="yes"
+pcap="yes"
fmod_lib=""
fmod_inc=""
oss_lib=""
@@ -432,6 +433,8 @@ for opt do
;;
--disable-vde) vde="no"
;;
+ --disable-pcap) pcap="no"
+ ;;
--disable-kqemu) kqemu="no"
;;
--disable-xen) xen="no"
@@ -1598,6 +1601,10 @@ if test "$vde" = "yes" ; then
echo "#define CONFIG_VDE 1" >> $config_host_h
echo "VDE_LIBS=-lvdeplug" >> $config_host_mak
fi
+if test "$pcap" = "yes" ; then
+ echo "CONFIG_PCAP=yes" >> $config_host_mak
+ echo "#define CONFIG_PCAP 1" >> $config_host_h
+fi
for card in $audio_card_list; do
def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
echo "$def=y" >> $config_host_mak
diff --git a/net.c b/net.c
index cf6b033..b321135 100644
--- a/net.c
+++ b/net.c
@@ -1270,6 +1270,105 @@ void do_info_usernet(Monitor *mon)
#endif /* CONFIG_SLIRP */
+#if defined(CONFIG_PCAP)
+#include
+typedef struct PCAPState {
+ VLANClientState *vc;
+ pcap_t *handle;
+} PCAPState;
+
+static ssize_t pcap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
+{
+ PCAPState *s = (PCAPState *)(vc->opaque);
+
+ pcap_sendpacket(s->handle, (u_char*)buf, size);
+ return size;
+}
+
+static void pcap_callback(u_char *user, struct pcap_pkthdr *phdr, u_char *pdata)
+{
+ VLANClientState *vc = (VLANClientState *)user;
+
+ qemu_send_packet(vc, pdata, phdr->len);
+}
+
+static void pcap_send(void *opaque)
+{
+ PCAPState *s = (PCAPState *)opaque;
+
+ pcap_dispatch(s->handle, 1, (pcap_handler)&pcap_callback, (u_char *)s->vc);
+}
+
+static int net_pcap_init(VLANState *vlan, const char *model, const char *name, char *ifname)
+{
+ PCAPState *s;
+ char errbuf[PCAP_ERRBUF_SIZE];
+ int fd;
+
+ s = qemu_mallocz(sizeof(PCAPState));
+ if (!s)
+ return -1;
+
+ if (ifname == NULL && (ifname = pcap_lookupdev(errbuf)) == NULL) {
+ fprintf(stderr, "qemu: pcap_lookupdev: %s\n", errbuf);
+ goto fail;
+ }
+
+ /* Attempt to connect device. */
+ s->handle = (void*)pcap_open_live(ifname, 65535, 1, 0, errbuf);
+ if (!s->handle) {
+ fprintf(stderr, "qemu: pcap_open_live: %s\n", errbuf);
+ goto fail;
+ }
+
+ /* Check non-blocking mode. */
+ if (pcap_setnonblock(s->handle, 1, errbuf) < 0) {
+ fprintf(stderr, "qemu: pcap_setnonblock: %s\n", errbuf);
+ goto fail;
+ }
+
+#if defined(BIOCSHDRCMPLT)
+ /*
+ * Tell the kernel that the header is fully-formed when it gets it.
+ * This is required in order to fake the src address.
+ */
+ {
+ unsigned int one = 1;
+ ioctl(pcap_fileno(s->handle), BIOCSHDRCMPLT, &one);
+ }
+#endif /* BIOCSHDRCMPLT */
+
+#if defined(BIOCIMMEDIATE)
+ /*
+ * Tell the kernel that the packet has to be processed immediately.
+ */
+ {
+ unsigned int one = 1;
+ ioctl(pcap_fileno(s->handle), BIOCIMMEDIATE, &one);
+ }
+#endif /* BIOCIMMEDIATE */
+
+ 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");
+ if ((fd = pcap_get_selectable_fd(s->handle)) < 0) {
+ fprintf(stderr, "qemu: pcap_get_selectable_fd failed\n");
+ goto fail;
+ }
+ qemu_set_fd_handler(fd, pcap_send, NULL, s);
+
+ return 0;
+
+fail:
+ if (s) {
+ if (s->handle)
+ pcap_close(s->handle);
+ qemu_free(s);
+ }
+
+ return -1;
+}
+#endif /* CONFIG_PCAP */
+
#if !defined(_WIN32)
typedef struct TAPState {
@@ -2636,6 +2735,15 @@ int net_client_init(Monitor *mon, const char *device, const char *p)
ret = 0;
} else
#endif
+#ifdef CONFIG_PCAP
+ if (!strcmp(device, "pcap")) {
+ char ifname[64];
+ if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0)
+ ret = net_pcap_init(vlan, device, name, NULL);
+ else
+ ret = net_pcap_init(vlan, device, name, ifname);
+ } else
+#endif
#ifdef _WIN32
if (!strcmp(device, "tap")) {
static const char * const tap_params[] = {
diff --git a/qemu-options.hx b/qemu-options.hx
index a58287c..4d46d6c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -801,6 +801,10 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
" default of 'sndbuf=1048576' can be disabled using 'sndbuf=0'\n"
#endif
#endif
+#ifdef CONFIG_PCAP
+ "-net pcap[,vlan=n][,ifname=name]\n"
+ " connect the host network interface using PCAP to VLAN 'n'\n"
+#endif
"-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"
"-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port]\n"
--
1.6.2.1
++++++ 0016-i386-linux-user-NPTL-support.patch ++++++
From d6f4cb8539685ddb6f3ecd8f043c33a3213b0d56 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0017-qemu-0.11-git-ioctl_mount.patch ++++++
From dc645f74998b4beeee36b37e81c3a358e75be0b1 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
++++++ 0018-qemu-0.11-git-user-linux-ppc-uid16_fix.patch ++++++
From 075e9351395b1000568b215589eb3f1f7fdcb7a1 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
++++++ 0019-Rewrite-mmap_find_vma-to-work-fine-on-64-bit-hosts.patch ++++++
From c77c088e30c44fc8677d7d95cb2180d8dfb43b1c Mon Sep 17 00:00:00 2001
From: Kirill A. Shutemov
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
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
Signed-off-by: Kirill A. Shutemov
Signed-off-by: Riku Voipio
---
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
++++++ 0020-TCG-sync-op-32-bit-targets-fixed.patch ++++++
From 3d1745fd8e80e99b435b63b650b9b31202aace6c Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0021-S-390-CPU-emulation.patch ++++++
++++ 4753 lines (skipped)
++++++ 0022-S-390-host-target-build-system-support.patch ++++++
From 5353e78aaf5746e4d911d14df75557b1dac5166b Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0023-S-390-host-support-for-TCG.patch ++++++
++++ 1486 lines (skipped)
++++++ 0024-linux-user-S-390-64-bit-s390x-support.patch ++++++
++++ 1350 lines (skipped)
++++++ 0025-linux-user-don-t-do-locking-in-single-threaded-proc.patch ++++++
From f06038e90fe4eb5dd8c73735356125ab0d3e899b Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0026-linux-user-dup3-fallocate-syscalls.patch ++++++
From 4af40cd06ca8bf1faa436a966833df346d7dba65 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
+
+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
++++++ 0027-linux-user-fcntl-fixes-for-LTP.patch ++++++
From b597826b87618cb1cb082e73b52354da2a62423f Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0028-linux-user-enable-getdents-for-32-bit-systems.patch ++++++
From cd19670096c6f7affdba9792cb695b851390c184 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0029-linux-user-define-a-couple-of-syscalls-for-non-uid1.patch ++++++
From 22a1d92ba7beebc34113d8a95badd56b2901c283 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0030-linux-user-getpriority-errno-fix.patch ++++++
From fe268c13396fd05318a88ac7987198f34c3931e3 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0031-linux-user-fadvise64-implementation.patch ++++++
From 5a8884c3742e2e0cb467efc23b3b8bedaa13f65d Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0032-linux-user-zero-fstat-buffer-to-initialize-nsec-fie.patch ++++++
From 6d0d8876abd8e714d86e071247f33f479ebbfa9e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
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
---
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
++++++ 0033-dup3-check-fallocate-check-fixed.patch ++++++
From b54168c6f68c8db62e6c0718b23f637f9804abee Mon Sep 17 00:00:00 2001
From: Ulrich Hecht
Date: Thu, 30 Jul 2009 16:02:52 +0200
Subject: [PATCH 33/33] dup3 check, fallocate check fixed
Signed-off-by: Ulrich Hecht
---
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
+
+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
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org