Accepting request 85070 from openSUSE:Tools:Unstable
reboot syscall and more mmap fixes OBS-URL: https://build.opensuse.org/request/show/85070 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=18
This commit is contained in:
parent
54a31a9429
commit
57f72b0579
@ -1,33 +1,21 @@
|
||||
From 2013ec7c2d1b5a71d73701da746363b69d4c992c Mon Sep 17 00:00:00 2001
|
||||
From: Ulrich Hecht <uli@suse.de>
|
||||
Date: Tue, 14 Apr 2009 16:34:05 +0200
|
||||
Subject: [PATCH 10/17] qemu-cvs-mmap-amd64
|
||||
From: Alexander Graf <agraf@suse.de>
|
||||
|
||||
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.
|
||||
When executing 32-bit guest binaries on 64-bit hosts, mmap() can return
|
||||
a 64-bit pointer. Tell mmap() to always map in 32-bit address space, so
|
||||
we make 32-bit guest applications happy.
|
||||
|
||||
Signed-off-by: Ulrich Hecht <uli@suse.de>
|
||||
This is a hack and should not go upstream in its current form!
|
||||
|
||||
Signed-off-by: Alexander Graf <agraf@suse.de>
|
||||
---
|
||||
linux-user/mmap.c | 6 +++++-
|
||||
1 files changed, 5 insertions(+), 1 deletions(-)
|
||||
linux-user/mmap.c | 12 ++++++------
|
||||
1 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
|
||||
index e18c228..de8abe9 100644
|
||||
index 994c02b..e24b63a 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(CONFIG_USE_NPTL)
|
||||
@@ -169,7 +173,7 @@ static int mmap_frag(abi_ulong real_start,
|
||||
@@ -169,7 +169,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,
|
||||
@ -36,6 +24,51 @@ index e18c228..de8abe9 100644
|
||||
if (p == MAP_FAILED)
|
||||
return -1;
|
||||
prot1 = prot;
|
||||
@@ -292,7 +292,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
|
||||
* - shmat() with SHM_REMAP flag
|
||||
*/
|
||||
ptr = mmap(g2h(addr), size, PROT_NONE,
|
||||
- MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
|
||||
+ MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE|MAP_32BIT, -1, 0);
|
||||
|
||||
/* ENOMEM, if host address space has no memory */
|
||||
if (ptr == MAP_FAILED) {
|
||||
@@ -454,14 +454,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
|
||||
especially important if qemu_host_page_size >
|
||||
qemu_real_host_page_size */
|
||||
p = mmap(g2h(mmap_start),
|
||||
- host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
|
||||
+ host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
|
||||
if (p == MAP_FAILED)
|
||||
goto fail;
|
||||
/* update start so that it points to the file position at 'offset' */
|
||||
host_start = (unsigned long)p;
|
||||
if (!(flags & MAP_ANONYMOUS)) {
|
||||
p = mmap(g2h(mmap_start), len, prot,
|
||||
- flags | MAP_FIXED, fd, host_offset);
|
||||
+ flags | MAP_FIXED | MAP_32BIT, fd, host_offset);
|
||||
host_start += offset - host_offset;
|
||||
}
|
||||
start = h2g(host_start);
|
||||
@@ -547,7 +547,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
|
||||
else
|
||||
offset1 = offset + real_start - start;
|
||||
p = mmap(g2h(real_start), real_end - real_start,
|
||||
- prot, flags, fd, offset1);
|
||||
+ prot, flags | MAP_32BIT, fd, offset1);
|
||||
if (p == MAP_FAILED)
|
||||
goto fail;
|
||||
}
|
||||
@@ -603,7 +603,7 @@ static void mmap_reserve(abi_ulong start, abi_ulong size)
|
||||
}
|
||||
if (real_start != real_end) {
|
||||
mmap(g2h(real_start), real_end - real_start, PROT_NONE,
|
||||
- MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE,
|
||||
+ MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE | MAP_32BIT,
|
||||
-1, 0);
|
||||
}
|
||||
}
|
||||
--
|
||||
1.7.1
|
||||
1.6.0.2
|
||||
|
||||
|
||||
|
40
0020-linux-user-implement-reboot-syscall.patch
Normal file
40
0020-linux-user-implement-reboot-syscall.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From: Alexander Graf <agraf@suse.de>
|
||||
|
||||
For OBS, we're running a full cross-guest inside of a VM. When a build
|
||||
is done there, we reboot the guest as shutdown mechanism.
|
||||
|
||||
Unfortunately, reboot is not implemented in linux-user. So this mechanism
|
||||
fails, spilling unpretty warnings. This patch implements sys_reboot()
|
||||
emulation.
|
||||
|
||||
Signed-off-by: Alexander Graf <agraf@suse.de>
|
||||
---
|
||||
linux-user/syscall.c | 8 +++++++-
|
||||
1 files changed, 7 insertions(+), 1 deletions(-)
|
||||
|
||||
Index: qemu-0.14.1/linux-user/syscall.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/linux-user/syscall.c
|
||||
+++ qemu-0.14.1/linux-user/syscall.c
|
||||
@@ -239,6 +239,8 @@ _syscall6(int,sys_futex,int *,uaddr,int,
|
||||
const struct timespec *,timeout,int *,uaddr2,int,val3)
|
||||
#endif
|
||||
#endif
|
||||
+_syscall4(int, reboot, int, magic1, int, magic2, unsigned int, cmd,
|
||||
+ void *, arg);
|
||||
|
||||
static bitmask_transtbl fcntl_flags_tbl[] = {
|
||||
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
|
||||
@@ -5536,7 +5538,11 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
break;
|
||||
#endif
|
||||
case TARGET_NR_reboot:
|
||||
- goto unimplemented;
|
||||
+ if (!(p = lock_user_string(arg4)))
|
||||
+ goto efault;
|
||||
+ ret = reboot(arg1, arg2, arg3, p);
|
||||
+ unlock_user(p, arg4, 0);
|
||||
+ break;
|
||||
#ifdef TARGET_NR_readdir
|
||||
case TARGET_NR_readdir:
|
||||
goto unimplemented;
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 27 09:57:34 UTC 2011 - adrian@suse.de
|
||||
|
||||
- add 0020-linux-user-implement-reboot-syscall.patch from alex
|
||||
- extend 0010 mmap patch for files
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Sep 26 15:53:41 UTC 2011 - adrian@suse.de
|
||||
|
||||
|
@ -44,6 +44,7 @@ Patch16: 0016-fix-mipsn32-linux-user-builds.patch
|
||||
Patch17: 0017-S-390-build-fix.patch
|
||||
Patch18: 0018-qemu-0.14.1-mcast-udp.patch
|
||||
Patch19: 0019-linux-user-fix-openat.patch
|
||||
Patch20: 0020-linux-user-implement-reboot-syscall.patch
|
||||
# this is to make lint happy
|
||||
Source300: rpmlintrc
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -106,6 +107,7 @@ Authors:
|
||||
%patch16 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
|
||||
%build
|
||||
# build QEMU
|
||||
|
Loading…
Reference in New Issue
Block a user