SHA256
1
0
forked from pool/qemu

Accepting request 121073 from home:a_faerber:branches:Virtualization

Update qemu to v1.1-rc1

OBS-URL: https://build.opensuse.org/request/show/121073
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=66
This commit is contained in:
Andreas Färber 2012-05-15 12:58:40 +00:00 committed by Git OBS Bridge
parent 89c8c64fd9
commit d0c2d1f9ab
58 changed files with 255 additions and 2473 deletions

View File

@ -1,4 +1,4 @@
From 46def18ae5e55d5d5287ff2c4fc3b8aed446f564 Mon Sep 17 00:00:00 2001
From 68f2d99027d69029f20714134d0dc0e29751ba1c Mon Sep 17 00:00:00 2001
From: Peter Maydell <peter.maydell@linaro.org>
Date: Wed, 5 Oct 2011 10:04:02 +0100
Subject: [PATCH] Handle CPU interrupts by inline checking of a flag
@ -20,6 +20,8 @@ and thus whether flipping it might change performance.
Mostly this needs benchmarking to determine what the actual speed
hit is, which I never got round to. Feel free to do some :-)
[AF: CPUState -> CPUArchState]
---
cpu-exec.c | 11 ++++++++++-
exec.c | 14 ++++++++++++--
@ -30,12 +32,12 @@ hit is, which I never got round to. Feel free to do some :-)
6 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index a9fa608..5f7982f 100644
index 0344cd5..0547f2d 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -564,7 +564,16 @@ int cpu_exec(CPUState *env)
@@ -563,7 +563,16 @@ int cpu_exec(CPUArchState *env)
tc_ptr = tb->tc_ptr;
/* execute the generated code */
/* execute the generated code */
next_tb = tcg_qemu_tb_exec(env, tc_ptr);
- if ((next_tb & 3) == 2) {
+ if ((next_tb & 3) == 3) {
@ -50,12 +52,12 @@ index a9fa608..5f7982f 100644
+ } else if ((next_tb & 3) == 2) {
/* Instruction counter expired. */
int insns_left;
tb = (TranslationBlock *)(long)(next_tb & ~3);
tb = (TranslationBlock *)(next_tb & ~3);
diff --git a/exec.c b/exec.c
index 6c206ff..bb221cf 100644
index 0607c9b..455e0bb 100644
--- a/exec.c
+++ b/exec.c
@@ -125,6 +125,8 @@ DEFINE_TLS(CPUState *,cpu_single_env);
@@ -130,6 +130,8 @@ DEFINE_TLS(CPUArchState *,cpu_single_env);
1 = Precise instruction counting.
2 = Adaptive rate instruction counting. */
int use_icount = 0;
@ -64,7 +66,7 @@ index 6c206ff..bb221cf 100644
typedef struct PageDesc {
/* list of TBs intersecting this ram page */
@@ -1670,7 +1672,13 @@ static void tcg_handle_interrupt(CPUState *env, int mask)
@@ -1738,7 +1740,13 @@ static void tcg_handle_interrupt(CPUArchState *env, int mask)
cpu_abort(env, "Raised interrupt while not in I/O function");
}
} else {
@ -79,8 +81,8 @@ index 6c206ff..bb221cf 100644
}
}
@@ -1693,7 +1701,9 @@ void cpu_reset_interrupt(CPUState *env, int mask)
void cpu_exit(CPUState *env)
@@ -1761,7 +1769,9 @@ void cpu_reset_interrupt(CPUArchState *env, int mask)
void cpu_exit(CPUArchState *env)
{
env->exit_request = 1;
- cpu_unlink_tb(env);
@ -91,7 +93,7 @@ index 6c206ff..bb221cf 100644
const CPULogItem cpu_log_items[] = {
diff --git a/gen-icount.h b/gen-icount.h
index 5fb3829..060f814 100644
index 430cb44..65a75d9 100644
--- a/gen-icount.h
+++ b/gen-icount.h
@@ -2,13 +2,25 @@
@ -112,7 +114,7 @@ index 5fb3829..060f814 100644
+ TCGv_i32 flag;
+ stopflag_label = gen_new_label();
+ flag = tcg_temp_local_new_i32();
+ tcg_gen_ld_i32(flag, cpu_env, offsetof(CPUState, exit_request));
+ tcg_gen_ld_i32(flag, cpu_env, offsetof(CPUArchState, exit_request));
+ tcg_gen_brcondi_i32(TCG_COND_NE, flag, 0, stopflag_label);
+ tcg_temp_free_i32(flag);
+ }
@ -132,10 +134,10 @@ index 5fb3829..060f814 100644
*icount_arg = num_insns;
gen_set_label(icount_label);
diff --git a/linux-user/main.c b/linux-user/main.c
index d1bbc57..1cd8eb7 100644
index 191b750..dd340b2 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -52,6 +52,7 @@ unsigned long reserved_va;
@@ -64,6 +64,7 @@ unsigned long reserved_va;
#endif
static void usage(void);
@ -143,7 +145,7 @@ index d1bbc57..1cd8eb7 100644
static const char *interp_prefix = CONFIG_QEMU_INTERP_PREFIX;
const char *qemu_uname_release = CONFIG_UNAME_RELEASE;
@@ -3072,6 +3073,11 @@ static void handle_arg_reserved_va(const char *arg)
@@ -3107,6 +3108,11 @@ static void handle_arg_reserved_va(const char *arg)
}
#endif
@ -155,20 +157,20 @@ index d1bbc57..1cd8eb7 100644
static void handle_arg_singlestep(const char *arg)
{
singlestep = 1;
@@ -3125,6 +3131,8 @@ struct qemu_argument arg_table[] = {
#endif
{"d", "QEMU_LOG", true, handle_arg_log,
@@ -3162,6 +3168,8 @@ struct qemu_argument arg_table[] = {
"options", "activate log"},
{"D", "QEMU_LOG_FILENAME", true, handle_arg_log_filename,
"logfile", "override default logfile location"},
+ {"no-stopflag", "QEMU_NOSTOPFLAG", false, handle_arg_nostopflag,
+ "", "run in singlestep mode"},
{"p", "QEMU_PAGESIZE", true, handle_arg_pagesize,
"pagesize", "set the host page size to 'pagesize'"},
{"singlestep", "QEMU_SINGLESTEP", false, handle_arg_singlestep,
diff --git a/qemu-options.hx b/qemu-options.hx
index 681eaf1..83b1f38 100644
index a169792..c50c3d9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1112,6 +1112,15 @@ STEXI
@@ -1176,6 +1176,15 @@ STEXI
Disable HPET support.
ETEXI
@ -181,14 +183,14 @@ index 681eaf1..83b1f38 100644
+(this is slightly faster but racy!)
+ETEXI
+
DEF("balloon", HAS_ARG, QEMU_OPTION_balloon,
"-balloon none disable balloon device\n"
"-balloon virtio[,addr=str]\n"
DEF("acpitable", HAS_ARG, QEMU_OPTION_acpitable,
"-acpitable [sig=str][,rev=n][,oem_id=str][,oem_table_id=str][,oem_rev=n][,asl_compiler_id=str][,asl_compiler_rev=n][,{data|file}=file1[:file2]...]\n"
" ACPI table description\n", QEMU_ARCH_I386)
diff --git a/vl.c b/vl.c
index a50842b..7fdd80f 100644
index 5e0080b..7388894 100644
--- a/vl.c
+++ b/vl.c
@@ -174,6 +174,8 @@ int main(int argc, char **argv)
@@ -175,6 +175,8 @@ int main(int argc, char **argv)
#define MAX_VIRTIO_CONSOLES 1
@ -197,10 +199,10 @@ index a50842b..7fdd80f 100644
static const char *data_dir;
const char *bios_name = NULL;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
@@ -2819,6 +2821,9 @@ int main(int argc, char **argv, char **envp)
case QEMU_OPTION_rtc_td_hack:
rtc_td_hack = 1;
@@ -2952,6 +2954,9 @@ int main(int argc, char **argv, char **envp)
qdev_prop_register_global_list(slew_lost_ticks);
break;
}
+ case QEMU_OPTION_no_stopflag:
+ use_stopflag = 0;
+ break;

View File

@ -1,4 +1,4 @@
From f48d5facfbfa643ff2d89fa215d7982877468f02 Mon Sep 17 00:00:00 2001
From f13c82700bcd83f761f26cce053bb28645d911da Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 21 Nov 2011 23:50:36 +0100
Subject: [PATCH] XXX dont dump core on sigabort
@ -8,7 +8,7 @@ Subject: [PATCH] XXX dont dump core on sigabort
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 78e3380..cfa92b9 100644
index b1e139d..0d6cb7b 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -373,6 +373,10 @@ static void QEMU_NORETURN force_sig(int target_sig)

View File

@ -1,85 +0,0 @@
From 7c38fac0f55fad6c8506796bbbee3ab036c6350f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 20 Nov 2011 13:02:54 +0100
Subject: [PATCH] linux-user: fix QEMU_STRACE=1 segfault
While debugging some issues with QEMU_STRACE I stumbled over segmentation
faults that were pretty reproducible. Turns out we tried to treat a
normal return value as errno, resulting in an access over array boundaries
for the resolution.
Fix this by allowing failure to resolve invalid errnos into strings.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v1 -> v2:
- propagate fault further down, so we display the negative value
v2 -> v3:
- fix boolean logic
- fix print_syscall_ret_addr
---
linux-user/strace.c | 18 ++++++++++++++----
linux-user/syscall.c | 3 +++
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/linux-user/strace.c b/linux-user/strace.c
index 90027a1..269481e 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -284,8 +284,13 @@ print_ipc(const struct syscallname *name,
static void
print_syscall_ret_addr(const struct syscallname *name, abi_long ret)
{
-if( ret == -1 ) {
- gemu_log(" = -1 errno=%d (%s)\n", errno, target_strerror(errno));
+ char *errstr = NULL;
+
+ if (ret == -1) {
+ errstr = target_strerror(errno);
+ }
+ if ((ret == -1) && errstr) {
+ gemu_log(" = -1 errno=%d (%s)\n", errno, errstr);
} else {
gemu_log(" = 0x" TARGET_ABI_FMT_lx "\n", ret);
}
@@ -1515,14 +1520,19 @@ void
print_syscall_ret(int num, abi_long ret)
{
int i;
+ char *errstr = NULL;
for(i=0;i<nsyscalls;i++)
if( scnames[i].nr == num ) {
if( scnames[i].result != NULL ) {
scnames[i].result(&scnames[i],ret);
} else {
- if( ret < 0 ) {
- gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n", -ret, target_strerror(-ret));
+ if (ret < 0) {
+ errstr = target_strerror(-ret);
+ }
+ if (errstr) {
+ gemu_log(" = -1 errno=" TARGET_ABI_FMT_ld " (%s)\n",
+ -ret, errstr);
} else {
gemu_log(" = " TARGET_ABI_FMT_ld "\n", ret);
}
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f227097..f170724 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -731,6 +731,9 @@ static inline int is_error(abi_long ret)
char *target_strerror(int err)
{
+ if ((err >= ERRNO_TABLE_SIZE) || (err < 0)) {
+ return NULL;
+ }
return strerror(target_to_host_errno(err));
}

View File

@ -1,20 +1,21 @@
From e093a96fb61a17b9b0ee88d35fbe8871ec205797 Mon Sep 17 00:00:00 2001
From 9c71705a2b6a9158395d4fe7ffa1f01f96147853 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 1 Dec 2011 19:00:01 +0100
Subject: [PATCH] XXX work around SA_RESTART race with boehm-gc (ARM only)
[AF: CPUState -> CPUArchState, adapt to reindentation]
---
linux-user/main.c | 25 ++++++++-----
linux-user/main.c | 25 +++++++++-----
linux-user/qemu.h | 3 ++
linux-user/signal.c | 22 ++++++++++++
linux-user/syscall.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 133 insertions(+), 11 deletions(-)
linux-user/syscall.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 130 insertions(+), 10 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 1cd8eb7..788ff98 100644
index dd340b2..503ecfa 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -818,15 +818,22 @@ void cpu_loop(CPUARMState *env)
@@ -848,15 +848,22 @@ void cpu_loop(CPUARMState *env)
break;
}
} else {
@ -27,7 +28,7 @@ index 1cd8eb7..788ff98 100644
- env->regs[4],
- env->regs[5],
- 0, 0);
+ TaskState *ts = ((CPUState*)env)->opaque;
+ TaskState *ts = ((CPUArchState*)env)->opaque;
+ target_ulong r;
+ r = do_syscall(env, n, env->regs[0], env->regs[1],
+ env->regs[2], env->regs[3], env->regs[4],
@ -47,10 +48,10 @@ index 1cd8eb7..788ff98 100644
} else {
goto error;
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index ef08d39..aa06acf 100644
index 7b299b7..dc12b23 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -136,6 +136,8 @@ typedef struct TaskState {
@@ -137,6 +137,8 @@ typedef struct TaskState {
struct sigqueue sigqueue_table[MAX_SIGQUEUE_SIZE]; /* siginfo queue */
struct sigqueue *first_free; /* first free siginfo queue entry */
int signal_pending; /* non zero if a signal may be pending */
@ -59,7 +60,7 @@ index ef08d39..aa06acf 100644
} __attribute__((aligned(16))) TaskState;
extern char *exec_path;
@@ -202,6 +204,7 @@ char *target_strerror(int err);
@@ -203,6 +205,7 @@ char *target_strerror(int err);
int get_osversion(void);
void fork_start(void);
void fork_end(int child);
@ -68,7 +69,7 @@ index ef08d39..aa06acf 100644
/* Return true if the proposed guest_base is suitable for the guest.
* The guest code may leave a page mapped and populate it if the
diff --git a/linux-user/signal.c b/linux-user/signal.c
index cfa92b9..b7b8bd8 100644
index 0d6cb7b..c00cf75 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -25,6 +25,7 @@
@ -79,7 +80,7 @@ index cfa92b9..b7b8bd8 100644
#include "qemu.h"
#include "qemu-common.h"
@@ -481,6 +482,11 @@ int queue_signal(CPUState *env, int sig, target_siginfo_t *info)
@@ -481,6 +482,11 @@ int queue_signal(CPUArchState *env, int sig, target_siginfo_t *info)
k->pending = 1;
/* signal that a new signal is pending */
ts->signal_pending = 1;
@ -91,7 +92,7 @@ index cfa92b9..b7b8bd8 100644
return 1; /* indicates that the signal was queued */
}
}
@@ -613,8 +619,24 @@ int do_sigaction(int sig, const struct target_sigaction *act,
@@ -621,8 +627,24 @@ int do_sigaction(int sig, const struct target_sigaction *act,
if (host_sig != SIGSEGV && host_sig != SIGBUS) {
sigfillset(&act1.sa_mask);
act1.sa_flags = SA_SIGINFO;
@ -117,10 +118,10 @@ index cfa92b9..b7b8bd8 100644
ignore state to avoid getting unexpected interrupted
syscalls */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4af0edb..97c3303 100644
index 20d2a74..2a210e7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4758,6 +4758,87 @@ static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
@@ -5031,6 +5031,87 @@ static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
return get_errno(open(path(pathname), flags, mode));
}
@ -208,11 +209,11 @@ index 4af0edb..97c3303 100644
/* do_syscall() should always have a single exit point at the end so
that actions, such as logging of syscall results, can be performed.
All errnos that do_syscall() returns must be -TARGET_<errcode>. */
@@ -4770,6 +4851,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
@@ -5043,6 +5124,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
struct stat st;
struct statfs stfs;
void *p;
+ TaskState *ts = ((CPUState*)cpu_env)->opaque;
+ TaskState *ts = ((CPUArchState*)cpu_env)->opaque;
+
+ if (!ts->signal_restart) {
+ /* remember syscall info for restart */
@ -221,20 +222,16 @@ index 4af0edb..97c3303 100644
#ifdef DEBUG
gemu_log("syscall %d", num);
@@ -7679,8 +7766,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif
@@ -7988,7 +8075,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
cmd = target_to_host_fcntl_cmd(arg2);
- if (cmd == -TARGET_EINVAL)
- return cmd;
+ if (cmd == -TARGET_EINVAL) {
+ ret = cmd;
+ goto fail;
+ }
if (cmd == -TARGET_EINVAL) {
ret = cmd;
- break;
+ goto fail;
}
switch(arg2) {
case TARGET_F_GETLK64:
@@ -8312,6 +8401,7 @@ fail:
@@ -8733,6 +8820,7 @@ fail:
#endif
if(do_strace)
print_syscall_ret(num, ret);

View File

@ -1,85 +0,0 @@
From e968f21cebfd85c10405e5d4c8cc8f70361590ad Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:22 +0000
Subject: [PATCH] linux-user: save auxv length
We create our own AUXV segment on stack and save a pointer to it.
However we don't save the length of it, so any code that wants to
do anything useful with it later on has to walk it again.
Instead, let's remember the length of our AUXV segment. This
simplifies later uses by a lot.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/elfload.c | 15 ++++-----------
linux-user/qemu.h | 1 +
2 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 4635bb2..62bb543 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1245,6 +1245,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
struct image_info *interp_info)
{
abi_ulong sp;
+ abi_ulong sp_auxv;
int size;
int i;
abi_ulong u_rand_bytes;
@@ -1316,6 +1317,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
sp -= n; put_user_ual(id, sp); \
} while(0)
+ sp_auxv = sp;
NEW_AUX_ENT (AT_NULL, 0);
/* There must be exactly DLINFO_ITEMS entries here. */
@@ -1346,6 +1348,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
#undef NEW_AUX_ENT
info->saved_auxv = sp;
+ info->auxv_len = sp_auxv - sp;
sp = loader_build_argptr(envc, argc, sp, p, 0);
return sp;
@@ -2329,9 +2332,8 @@ static void fill_auxv_note(struct memelfnote *note, const TaskState *ts)
{
elf_addr_t auxv = (elf_addr_t)ts->info->saved_auxv;
elf_addr_t orig_auxv = auxv;
- abi_ulong val;
void *ptr;
- int i, len;
+ int len = ts->info->auxv_len;
/*
* Auxiliary vector is stored in target process stack. It contains
@@ -2339,15 +2341,6 @@ static void fill_auxv_note(struct memelfnote *note, const TaskState *ts)
* strictly necessary but we do it here for sake of completeness.
*/
- /* find out lenght of the vector, AT_NULL is terminator */
- i = len = 0;
- do {
- get_user_ual(val, auxv);
- i += 2;
- auxv += 2 * sizeof (elf_addr_t);
- } while (val != AT_NULL);
- len = i * sizeof (elf_addr_t);
-
/* read in whole auxv vector and copy it to memelfnote */
ptr = lock_user(VERIFY_READ, orig_auxv, len, 0);
if (ptr != NULL) {
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index 55ad9d8..ef08d39 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -48,6 +48,7 @@ struct image_info {
abi_ulong code_offset;
abi_ulong data_offset;
abi_ulong saved_auxv;
+ abi_ulong auxv_len;
abi_ulong arg_start;
abi_ulong arg_end;
int personality;

View File

@ -1,85 +0,0 @@
From a1508f441692e958ee11ac10648ed7941c242be8 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:23 +0000
Subject: [PATCH] linux-user: add open() hijack infrastructure
There are a number of files in /proc that expose host information
to the guest program. This patch adds infrastructure to override
the open() syscall for guest programs to enable us to on the fly
generate guest sensible files.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f170724..1ecc0e1 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4603,6 +4603,52 @@ int get_osversion(void)
return osversion;
}
+static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
+{
+ struct fake_open {
+ const char *filename;
+ int (*fill)(void *cpu_env, int fd);
+ };
+ const struct fake_open *fake_open;
+ static const struct fake_open fakes[] = {
+ { NULL, NULL }
+ };
+
+ for (fake_open = fakes; fake_open->filename; fake_open++) {
+ if (!strncmp(pathname, fake_open->filename,
+ strlen(fake_open->filename))) {
+ break;
+ }
+ }
+
+ if (fake_open->filename) {
+ const char *tmpdir;
+ char filename[PATH_MAX];
+ int fd, r;
+
+ /* create temporary file to map stat to */
+ tmpdir = getenv("TMPDIR");
+ if (!tmpdir)
+ tmpdir = "/tmp";
+ snprintf(filename, sizeof(filename), "%s/qemu-open.XXXXXX", tmpdir);
+ fd = mkstemp(filename);
+ if (fd < 0) {
+ return fd;
+ }
+ unlink(filename);
+
+ if ((r = fake_open->fill(cpu_env, fd))) {
+ close(fd);
+ return r;
+ }
+ lseek(fd, 0, SEEK_SET);
+
+ return fd;
+ }
+
+ return get_errno(open(path(pathname), flags, mode));
+}
+
/* do_syscall() should always have a single exit point at the end so
that actions, such as logging of syscall results, can be performed.
All errnos that do_syscall() returns must be -TARGET_<errcode>. */
@@ -4688,9 +4734,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_open:
if (!(p = lock_user_string(arg1)))
goto efault;
- ret = get_errno(open(path(p),
- target_to_host_bitmask(arg2, fcntl_flags_tbl),
- arg3));
+ ret = get_errno(do_open(cpu_env, p,
+ target_to_host_bitmask(arg2, fcntl_flags_tbl),
+ arg3));
unlock_user(p, arg1, 0);
break;
#if defined(TARGET_NR_openat) && defined(__NR_openat)

View File

@ -1,4 +1,4 @@
From 68c582bd8f27e48828c3ea90aceb4bbead37382b Mon Sep 17 00:00:00 2001
From 9fd07e26c8f291c88767bb87554fd87dd8a25cef Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:18:44 +0200
Subject: [PATCH] qemu-0.9.0.cvs-binfmt
@ -14,10 +14,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 83a44d8..d0fe4e1 100644
index 0da2618..dc652f0 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -27,42 +27,45 @@ case "$cpu" in
@@ -27,43 +27,46 @@ case "$cpu" in
armv[4-9]*)
cpu="arm"
;;
@ -76,6 +76,7 @@ index 83a44d8..d0fe4e1 100644
- echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
+ echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
+ echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "s390x" ] ; then
- echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register
+ echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register

View File

@ -1,50 +0,0 @@
From a28f243a16b5e2e13645fba6d26c8ce26e9b399b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:24 +0000
Subject: [PATCH] linux-user: fake /proc/self/maps
glibc's pthread_attr_getstack tries to find the stack range from
/proc/self/maps. Unfortunately, /proc is usually the host's /proc
which means linux-user guests see qemu's stack there.
Fake the file with a constructed maps entry that exposes the guest's
stack range.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1ecc0e1..8727249 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4603,6 +4603,20 @@ int get_osversion(void)
return osversion;
}
+
+static int open_self_maps(void *cpu_env, int fd)
+{
+ TaskState *ts = ((CPUState *)cpu_env)->opaque;
+
+ dprintf(fd, "%08llx-%08llx rw-p %08llx 00:00 0 [stack]\n",
+ (unsigned long long)ts->info->stack_limit,
+ (unsigned long long)(ts->stack_base + (TARGET_PAGE_SIZE - 1))
+ & TARGET_PAGE_MASK,
+ (unsigned long long)ts->stack_base);
+
+ return 0;
+}
+
static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -4611,6 +4625,7 @@ static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
};
const struct fake_open *fake_open;
static const struct fake_open fakes[] = {
+ { "/proc/self/maps", open_self_maps },
{ NULL, NULL }
};

View File

@ -1,4 +1,4 @@
From dafb3a450b28740afb77a503af84c4217cf47f49 Mon Sep 17 00:00:00 2001
From 9d68e3cb751e959153d871dcec5ad1f886310fbb Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:20:50 +0200
Subject: [PATCH] qemu-cvs-alsa_bitfield
@ -13,7 +13,7 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/thunk.c b/thunk.c
index 0657188..34bc7d1 100644
index 8ebbbb4..bf43985 100644
--- a/thunk.c
+++ b/thunk.c
@@ -41,6 +41,7 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
@ -24,7 +24,7 @@ index 0657188..34bc7d1 100644
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
case TYPE_LONG:
@@ -139,6 +140,26 @@ const argtype *thunk_convert(void *dst, const void *src,
@@ -140,6 +141,26 @@ const argtype *thunk_convert(void *dst, const void *src,
case TYPE_INT:
*(uint32_t *)dst = tswap32(*(uint32_t *)src);
break;
@ -52,18 +52,18 @@ index 0657188..34bc7d1 100644
case TYPE_ULONGLONG:
*(uint64_t *)dst = tswap64(*(uint64_t *)src);
diff --git a/thunk.h b/thunk.h
index 109c541..55890f3 100644
index 87025c3..6c35e64 100644
--- a/thunk.h
+++ b/thunk.h
@@ -37,6 +37,7 @@ typedef enum argtype {
TYPE_PTR,
@@ -38,6 +38,7 @@ typedef enum argtype {
TYPE_ARRAY,
TYPE_STRUCT,
TYPE_OLDDEVT,
+ 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)
@@ -91,6 +92,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
case TYPE_SHORT:
return 2;
case TYPE_INT:
@ -71,7 +71,7 @@ index 109c541..55890f3 100644
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)
@@ -153,6 +155,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
case TYPE_SHORT:
return 2;
case TYPE_INT:

View File

@ -1,61 +0,0 @@
From ddbcc8e3bf832386832322146235e251bc7bc0d7 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:25 +0000
Subject: [PATCH] linux-user: fake /proc/self/stat
The boehm gc finds the program's stack starting pointer by
checking /proc/self/stat. Unfortunately, so far it reads
qemu's stack pointer which clearly is wrong.
So let's instead fake the file so the guest program sees the
right address.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8727249..5eefd01 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4617,6 +4617,31 @@ static int open_self_maps(void *cpu_env, int fd)
return 0;
}
+static int open_self_stat(void *cpu_env, int fd)
+{
+ TaskState *ts = ((CPUState *)cpu_env)->opaque;
+ abi_ulong start_stack = ts->info->start_stack;
+ int i;
+
+ for (i = 0; i < 44; i++) {
+ char buf[128];
+ int len;
+ uint64_t val = 0;
+
+ if (i == 27) {
+ /* stack bottom */
+ val = start_stack;
+ }
+ snprintf(buf, sizeof(buf), "%"PRId64 "%c", val, i == 43 ? '\n' : ' ');
+ len = strlen(buf);
+ if (write(fd, buf, len) != len) {
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -4626,6 +4651,7 @@ static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
const struct fake_open *fake_open;
static const struct fake_open fakes[] = {
{ "/proc/self/maps", open_self_maps },
+ { "/proc/self/stat", open_self_stat },
{ NULL, NULL }
};

View File

@ -1,4 +1,4 @@
From 5808e2a35680dd98d356f81d1d3e5a5375883c54 Mon Sep 17 00:00:00 2001
From 7e7282a1d286a0f74ec68aa71045d38bc621d432 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:23:27 +0200
Subject: [PATCH] qemu-cvs-alsa_ioctl
@ -20,10 +20,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
create mode 100644 linux-user/syscall_types_alsa.h
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 6514502..224dbc6 100644
index eb96a08..e8c1c69 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -314,6 +314,11 @@
@@ -316,6 +316,11 @@
IOCTL(VFAT_IOCTL_READDIR_BOTH, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
IOCTL(VFAT_IOCTL_READDIR_SHORT, IOC_R, MK_PTR(MK_ARRAY(MK_STRUCT(STRUCT_dirent), 2)))
@ -2255,17 +2255,17 @@ index 0000000..e09a30d
+ unsigned char *code;
+};
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index 9dd1b8e..f0acc72 100644
index a79b67d..be8760c 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2336,3 +2336,5 @@ struct target_rlimit64 {
uint64_t rlim_cur;
uint64_t rlim_max;
@@ -2362,3 +2362,5 @@ struct target_ucred {
uint32_t uid;
uint32_t gid;
};
+
+#include "ioctls_alsa_structs.h"
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index c370125..8fde25c 100644
index 601618d..ad2ee7e 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -80,6 +80,11 @@ STRUCT(count_info,

View File

@ -1,65 +0,0 @@
From 53bd82c12dac42df6c602aee6a93b3ea39e134da Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:26 +0000
Subject: [PATCH] linux-user: fake /proc/self/auxv
Gtk tries to read /proc/self/auxv to find its auxv table instead of
taking it from its own program memory space.
However, when running with linux-user, we see the host's auxv which
clearly exposes wrong information. so let's instead expose the guest
memory backed auxv tables via /proc/self/auxv as well.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 30 ++++++++++++++++++++++++++++++
1 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5eefd01..3e6f3bd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4642,6 +4642,35 @@ static int open_self_stat(void *cpu_env, int fd)
return 0;
}
+static int open_self_auxv(void *cpu_env, int fd)
+{
+ TaskState *ts = ((CPUState *)cpu_env)->opaque;
+ abi_ulong auxv = ts->info->saved_auxv;
+ abi_ulong len = ts->info->auxv_len;
+ char *ptr;
+
+ /*
+ * Auxiliary vector is stored in target process stack.
+ * read in whole auxv vector and copy it to file
+ */
+ ptr = lock_user(VERIFY_READ, auxv, len, 0);
+ if (ptr != NULL) {
+ while (len > 0) {
+ ssize_t r;
+ r = write(fd, ptr, len);
+ if (r <= 0) {
+ break;
+ }
+ len -= r;
+ ptr += r;
+ }
+ lseek(fd, 0, SEEK_SET);
+ unlock_user(ptr, auxv, len);
+ }
+
+ return 0;
+}
+
static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
{
struct fake_open {
@@ -4652,6 +4681,7 @@ static int do_open(void *cpu_env, const char *pathname, int flags, mode_t mode)
static const struct fake_open fakes[] = {
{ "/proc/self/maps", open_self_maps },
{ "/proc/self/stat", open_self_stat },
+ { "/proc/self/auxv", open_self_auxv },
{ NULL, NULL }
};

View File

@ -1,4 +1,4 @@
From 361d8917165009c3897a5116a5b6e87c2db2dd68 Mon Sep 17 00:00:00 2001
From 4fd0317f52777ae9aa0e8a4014dda2b865bd4fea Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:24:15 +0200
Subject: [PATCH] qemu-cvs-alsa_mmap
@ -12,10 +12,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 46e8bf8..e4db455 100644
index 7125d1c..2a1e4a1 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -364,6 +364,9 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
@@ -377,6 +377,9 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
}
}
@ -25,7 +25,7 @@ index 46e8bf8..e4db455 100644
/* 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)
@@ -399,6 +402,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
@@ -412,6 +415,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
}
#endif

View File

@ -1,4 +1,4 @@
From 58ab3b92c4406b87b2ef2dbd230b397e2bec9f18 Mon Sep 17 00:00:00 2001
From c458eaeb60abb6559db9d8bfbe094971465f8e7f Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:25:41 +0200
Subject: [PATCH] qemu-cvs-gettimeofday
@ -9,10 +9,10 @@ No clue what this is for.
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9fabcba..cd120a4 100644
index 2a210e7..13721c5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5901,6 +5901,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
@@ -6182,6 +6182,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_gettimeofday:
{
struct timeval tv;

View File

@ -1,52 +0,0 @@
From c2c3a707453bc853b73cf2d3f2663ff2277b6563 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 22 Nov 2011 17:53:40 +0100
Subject: [PATCH] linux-user: fix wait* syscall status returns
When calling wait4 or waitpid with a status pointer and WNOHANG, the
syscall can potentially not modify the status pointer input. Now if we
have guest code like:
int status = 0;
waitpid(pid, &status, WNOHANG);
if (status)
<breakage>
then we have to make sure that in case status did not change we actually
return the guest's initialized status variable instead of our own uninitialized.
We fail to do so today, as we proxy everything through an uninitialized status
variable which for me ended up always containing the last error code.
This patch fixes some test cases when building yast2-core in OBS for ARM.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3e6f3bd..f86fe4a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4833,7 +4833,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#ifdef TARGET_NR_waitpid
case TARGET_NR_waitpid:
{
- int status;
+ int status = 0;
+ if (arg2) {
+ get_user_s32(status, arg2);
+ }
ret = get_errno(waitpid(arg1, &status, arg3));
if (!is_error(ret) && arg2
&& put_user_s32(host_to_target_waitstatus(status), arg2))
@@ -6389,6 +6392,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
rusage_ptr = &rusage;
else
rusage_ptr = NULL;
+ if (status_ptr) {
+ get_user_s32(status, status_ptr);
+ }
ret = get_errno(wait4(arg1, &status, arg3, rusage_ptr));
if (!is_error(ret)) {
if (status_ptr) {

View File

@ -1,4 +1,4 @@
From c73ada0bb889ac958c21dafd410ff8210ca92850 Mon Sep 17 00:00:00 2001
From 4926e0a44e1792a71affae93a4d2c09e4142730f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:26:33 +0200
Subject: [PATCH] qemu-cvs-ioctl_debug
@ -12,10 +12,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index cd120a4..4f1a5b4 100644
index 13721c5..c16c11a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3343,7 +3343,12 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
@@ -3603,7 +3603,12 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
ie = ioctl_entries;
for(;;) {
if (ie->target_cmd == 0) {

View File

@ -1,36 +0,0 @@
From e300580980d4ac564a7c458717f7415f2528c41f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 24 Nov 2011 00:38:22 +0100
Subject: [PATCH] Revert "linux-user: fix wait* syscall status returns"
This reverts commit 93092792064d880eb91679004b4761639d754081.
---
linux-user/syscall.c | 8 +-------
1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f86fe4a..3e6f3bd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4833,10 +4833,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#ifdef TARGET_NR_waitpid
case TARGET_NR_waitpid:
{
- int status = 0;
- if (arg2) {
- get_user_s32(status, arg2);
- }
+ int status;
ret = get_errno(waitpid(arg1, &status, arg3));
if (!is_error(ret) && arg2
&& put_user_s32(host_to_target_waitstatus(status), arg2))
@@ -6392,9 +6389,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
rusage_ptr = &rusage;
else
rusage_ptr = NULL;
- if (status_ptr) {
- get_user_s32(status, status_ptr);
- }
ret = get_errno(wait4(arg1, &status, arg3, rusage_ptr));
if (!is_error(ret)) {
if (status_ptr) {

View File

@ -1,4 +1,4 @@
From a2ccdcc82fc7b094d8e23d9beb2dd3351bb43e23 Mon Sep 17 00:00:00 2001
From 39a37ac06abbe3a4e4e9156d2ec2c39034bf0979 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:27:36 +0200
Subject: [PATCH] qemu-cvs-ioctl_nodirection
@ -15,10 +15,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4f1a5b4..eabeee6 100644
index c16c11a..5c6e303 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3377,6 +3377,11 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
@@ -3637,6 +3637,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) {
@ -30,7 +30,7 @@ index 4f1a5b4..eabeee6 100644
case IOC_R:
ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
if (!is_error(ret)) {
@@ -3395,6 +3400,7 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
@@ -3655,6 +3660,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;

View File

@ -1,55 +0,0 @@
From d9e44fedae2abdc61ea12000719cc74dee54200c Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 24 Nov 2011 00:39:35 +0100
Subject: [PATCH] linux-user: fix wait* syscall status returns
When calling wait4 or waitpid with a status pointer and WNOHANG, the
syscall can potentially not modify the status pointer input. Now if we
have guest code like:
int status = 0;
waitpid(pid, &status, WNOHANG);
if (status)
<breakage>
then we have to make sure that in case status did not change we actually
return the guest's initialized status variable instead of our own uninitialized.
We fail to do so today, as we proxy everything through an uninitialized status
variable which for me ended up always containing the last error code.
This patch fixes some test cases when building yast2-core in OBS for ARM.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v1 -> v2:
- take Peter's comment into account and just not write status back when
wait*'s return value is 0
---
linux-user/syscall.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3e6f3bd..5810e2a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4835,7 +4835,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
{
int status;
ret = get_errno(waitpid(arg1, &status, arg3));
- if (!is_error(ret) && arg2
+ if (!is_error(ret) && arg2 && ret
&& put_user_s32(host_to_target_waitstatus(status), arg2))
goto efault;
}
@@ -6391,7 +6391,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
rusage_ptr = NULL;
ret = get_errno(wait4(arg1, &status, arg3, rusage_ptr));
if (!is_error(ret)) {
- if (status_ptr) {
+ if (status_ptr && ret) {
status = host_to_target_waitstatus(status);
if (put_user_s32(status, status_ptr))
goto efault;

View File

@ -1,4 +1,4 @@
From dca5711f3a271a3a0f41207e03f7bf5c7c24d08f Mon Sep 17 00:00:00 2001
From fa76f1e59154356590a2a6250ea83426523efff5 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:37:42 +0200
Subject: [PATCH] qemu-img-vmdk-scsi
@ -14,10 +14,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index d015887..4b9f81d 100644
index ee7d8f2..72d0d83 100644
--- a/block.c
+++ b/block.c
@@ -3151,7 +3151,7 @@ int bdrv_img_create(const char *filename, const char *fmt,
@@ -3984,7 +3984,7 @@ int bdrv_img_create(const char *filename, const char *fmt,
char *options, uint64_t img_size, int flags)
{
QEMUOptionParameter *param = NULL, *create_options = NULL;
@ -26,7 +26,7 @@ index d015887..4b9f81d 100644
BlockDriverState *bs = NULL;
BlockDriver *drv, *proto_drv;
BlockDriver *backing_drv = NULL;
@@ -3261,6 +3261,9 @@ int bdrv_img_create(const char *filename, const char *fmt,
@@ -4094,6 +4094,9 @@ int bdrv_img_create(const char *filename, const char *fmt,
printf("Formatting '%s', fmt=%s ", filename, fmt);
print_option_parameters(param);
@ -37,10 +37,10 @@ index d015887..4b9f81d 100644
ret = bdrv_create(drv, filename, param);
diff --git a/block/vmdk.c b/block/vmdk.c
index f544159..2b9531d 100644
index 18e9b4c..c153617 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1375,7 +1375,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
@@ -1377,7 +1377,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"
@ -49,7 +49,7 @@ index f544159..2b9531d 100644
if (filename_decompose(filename, path, prefix, postfix, PATH_MAX)) {
return -EINVAL;
@@ -1390,6 +1390,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
@@ -1392,6 +1392,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
flags |= options->value.n ? BLOCK_FLAG_COMPAT6 : 0;
} else if (!strcmp(options->name, BLOCK_OPT_SUBFMT)) {
fmt = options->value.s;
@ -58,7 +58,7 @@ index f544159..2b9531d 100644
}
options++;
}
@@ -1480,7 +1482,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
@@ -1482,7 +1484,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
parent_desc_line,
ext_desc_lines,
(flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
@ -68,7 +68,7 @@ index f544159..2b9531d 100644
if (split || flat) {
fd = open(
filename,
@@ -1583,6 +1586,11 @@ static QEMUOptionParameter vmdk_create_options[] = {
@@ -1585,6 +1588,11 @@ static QEMUOptionParameter vmdk_create_options[] = {
"VMDK flat extent format, can be one of "
"{monolithicSparse (default) | monolithicFlat | twoGbMaxExtentSparse | twoGbMaxExtentFlat | streamOptimized} "
},
@ -81,15 +81,18 @@ index f544159..2b9531d 100644
};
diff --git a/block_int.h b/block_int.h
index 77c0187..b79ab4b 100644
index 086832a..446a89b 100644
--- a/block_int.h
+++ b/block_int.h
@@ -33,10 +33,12 @@
@@ -33,6 +33,7 @@
#define BLOCK_FLAG_ENCRYPT 1
#define BLOCK_FLAG_COMPAT6 4
+#define BLOCK_FLAG_SCSI 8
#define BLOCK_IO_LIMIT_READ 0
#define BLOCK_IO_LIMIT_WRITE 1
@@ -44,6 +45,7 @@
#define BLOCK_OPT_SIZE "size"
#define BLOCK_OPT_ENCRYPT "encryption"
#define BLOCK_OPT_COMPAT6 "compat6"
@ -98,10 +101,10 @@ index 77c0187..b79ab4b 100644
#define BLOCK_OPT_BACKING_FMT "backing_fmt"
#define BLOCK_OPT_CLUSTER_SIZE "cluster_size"
diff --git a/qemu-img.c b/qemu-img.c
index 01cc0d3..21f3544 100644
index 0ae543c..f781e74 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -661,7 +661,7 @@ static int img_convert(int argc, char **argv)
@@ -636,7 +636,7 @@ static int img_convert(int argc, char **argv)
const uint8_t *buf1;
BlockDriverInfo bdi;
QEMUOptionParameter *param = NULL, *create_options = NULL;
@ -110,7 +113,7 @@ index 01cc0d3..21f3544 100644
char *options = NULL;
const char *snapshot_name = NULL;
float local_progress;
@@ -852,6 +852,12 @@ static int img_convert(int argc, char **argv)
@@ -827,6 +827,12 @@ static int img_convert(int argc, char **argv)
}
}

View File

@ -1,66 +0,0 @@
From 1e34dbb17e1ce60d2c2afd7803dd6b9af8043140 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 28 Nov 2011 17:05:24 +0100
Subject: [PATCH] XXX linux-user: fake /proc/self/maps even more
---
linux-user/syscall.c | 40 +++++++++++++++++++++++++++++++++++++++-
1 files changed, 39 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5810e2a..4af0edb 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4606,13 +4606,51 @@ int get_osversion(void)
static int open_self_maps(void *cpu_env, int fd)
{
+#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
TaskState *ts = ((CPUState *)cpu_env)->opaque;
+#endif
+ FILE *fp;
+ char *line = NULL;
+ size_t len = 0;
+ ssize_t read;
+
+ fp = fopen("/proc/self/maps", "r");
+ if (fp == NULL) {
+ return -EACCES;
+ }
+ while ((read = getline(&line, &len, fp)) != -1) {
+ int fields, dev_maj, dev_min, inode;
+ uint64_t min, max, offset;
+ char flag_r, flag_w, flag_x, flag_p;
+ char path[512] = "";
+ fields = sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %d:%d %d"
+ " %512s", &min, &max, &flag_r, &flag_w, &flag_x,
+ &flag_p, &offset, &dev_maj, &dev_min, &inode, path);
+
+ if ((fields < 10) || (fields > 11)) {
+ continue;
+ }
+ if (!strncmp(path, "[stack]", 7)) {
+ continue;
+ }
+ if (h2g_valid(min) && h2g_valid(max)) {
+ dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx " %c%c%c%c %08" PRIx64
+ " %02d:%02d %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
+ flag_x, flag_p, offset, dev_maj, dev_min, inode,
+ path[0] ? " " : "", path);
+ }
+ }
+
+ free(line);
+
+#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
dprintf(fd, "%08llx-%08llx rw-p %08llx 00:00 0 [stack]\n",
(unsigned long long)ts->info->stack_limit,
(unsigned long long)(ts->stack_base + (TARGET_PAGE_SIZE - 1))
& TARGET_PAGE_MASK,
- (unsigned long long)ts->stack_base);
+ (unsigned long long)0);
+#endif
return 0;
}

View File

@ -0,0 +1,24 @@
From 21649a6fc2f9587ecdd517f1b56534e1c8d2c991 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 25 Aug 2010 14:23:43 +0200
Subject: [PATCH] configure: Enable mipsn32*-linux-user builds
Signed-off-by: Ulrich Hecht <uli@suse.de>
[AF: Merged default-configs upstream]
---
configure | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 491109d..179f5a4 100755
--- a/configure
+++ b/configure
@@ -950,6 +950,8 @@ microblaze-linux-user \
microblazeel-linux-user \
mips-linux-user \
mipsel-linux-user \
+mipsn32-linux-user \
+mipsn32el-linux-user \
ppc-linux-user \
ppc64-linux-user \
ppc64abi32-linux-user \

View File

@ -1,4 +1,4 @@
From e8b8530dd87efb4bbbb9819af1d2019c49a4b58a Mon Sep 17 00:00:00 2001
From 00ecaa54b1109b0b1cc3107e853b17010904a3c2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 30 Sep 2011 19:40:36 +0200
Subject: [PATCH] linux-user: add binfmt wrapper for argv[0] handling
@ -22,18 +22,18 @@ we're currently creating a new binary for each target archictecture.
CC: Reinhard Max <max@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
Makefile.target | 8 ++++++++
Makefile.target | 9 +++++++++
linux-user/binfmt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
scripts/qemu-binfmt-conf.sh | 34 +++++++++++++++++-----------------
3 files changed, 67 insertions(+), 17 deletions(-)
3 files changed, 68 insertions(+), 17 deletions(-)
create mode 100644 linux-user/binfmt.c
diff --git a/Makefile.target b/Makefile.target
index a111521..4287960 100644
index 1582904..101c0d6 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -33,6 +33,10 @@ endif
PROGS=$(QEMU_PROG)
@@ -42,6 +42,10 @@ PROGS+=$(QEMU_PROGW)
endif
STPFILES=
+ifdef CONFIG_LINUX_USER
@ -43,7 +43,7 @@ index a111521..4287960 100644
ifndef CONFIG_HAIKU
LIBS+=-lm
endif
@@ -139,6 +143,8 @@ obj-y += $(addprefix ../libuser/, $(user-obj-y))
@@ -150,6 +154,8 @@ obj-y += $(addprefix ../libuser/, $(user-obj-y))
obj-y += $(addprefix ../libdis-user/, $(libdis-y))
obj-y += $(libobj-y)
@ -52,15 +52,16 @@ index a111521..4287960 100644
endif #CONFIG_LINUX_USER
#########################################################
@@ -416,6 +422,8 @@ obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
@@ -423,6 +429,9 @@ $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
$(call LINK,$^)
endif
+$(QEMU_PROG)-binfmt: $(obj-binfmt-y)
+ $(call LINK,$^)
+
gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES)," GEN $(TARGET_DIR)$@")
diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c
new file mode 100644
index 0000000..cd1f513
@ -110,10 +111,10 @@ index 0000000..cd1f513
+ return execve(new_argv[0], new_argv, envp);
+}
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index d0fe4e1..c20fb61 100644
index dc652f0..37d03f3 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -34,38 +34,38 @@ esac
@@ -34,39 +34,39 @@ esac
# register the interpreter for each cpu except for the native one
if [ $cpu != "i386" ] ; then
@ -165,6 +166,7 @@ index d0fe4e1..c20fb61 100644
- echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
+ echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P' > /proc/sys/fs/binfmt_misc/register
+ echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "s390x" ] ; then
- echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x:' > /proc/sys/fs/binfmt_misc/register
+ echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x-binfmt:P' > /proc/sys/fs/binfmt_misc/register

View File

@ -1,22 +0,0 @@
From 4c1134246f3bd0af9b9b512a2094010ed12e7895 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 5 Dec 2011 23:37:52 +0100
Subject: [PATCH] XXX move qemu binary lower in address space so we have space for guest stuff
---
x86_64.ld | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/x86_64.ld b/x86_64.ld
index b7a9f4e..1151d8c 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -5,7 +5,7 @@ ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = 0x60000000 + SIZEOF_HEADERS;
+ . = 0x8000000 + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }

View File

@ -1,4 +1,4 @@
From a4f0bf51a11607d4ab025719b1c13fc402aac9b7 Mon Sep 17 00:00:00 2001
From f2eab091930486a05e28182d1df48d660139106d Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 11 Dec 2011 01:19:24 +0100
Subject: [PATCH] linux-user: Ignore timer_create syscall
@ -12,10 +12,10 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index eabeee6..fd6ff1f 100644
index 5c6e303..403f943 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8036,6 +8036,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
@@ -8449,6 +8449,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#endif

View File

@ -1,4 +1,4 @@
From 853112747ffa9a9747c670d36508b8f51fbaf798 Mon Sep 17 00:00:00 2001
From 54d3ffeae985c6a3b3d1a309793fb11ed3fc6f69 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 11 Dec 2011 01:21:51 +0100
Subject: [PATCH] linux-user: be silent about capget failures
@ -13,10 +13,10 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index fd6ff1f..9ba51bf 100644
index 403f943..39d02f8 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7165,7 +7165,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
@@ -7471,7 +7471,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
unlock_user(p, arg1, ret);
break;
case TARGET_NR_capget:

View File

@ -1,31 +0,0 @@
From b2e723019225ba03cef46b204dbfc51102f83259 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 6 Dec 2011 00:39:50 +0100
Subject: [PATCH] linux-user: map lower in address space
While trying to compile Java I can into situations where there was simply
no virtual address space left for a 32-bit guest to take. For example when
Java tried to allocate 1GB of heap.
Part of the problem is that we're starting to map things at 0x40000000.
This is a bit high. Taking that number down would give us a lot of free
virtual address space which means we'd be able to squeeze more stuff in.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/mmap.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 994c02b..505254f 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -210,7 +210,7 @@ static int mmap_frag(abi_ulong real_start,
/* Cygwin doesn't have a whole lot of address space. */
# define TASK_UNMAPPED_BASE 0x18000000
#else
-# define TASK_UNMAPPED_BASE 0x40000000
+# define TASK_UNMAPPED_BASE 0x10000000
#endif
static abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;

View File

@ -1,4 +1,4 @@
From c81d26928073f06432c701a28d745dffacc69c98 Mon Sep 17 00:00:00 2001
From 77c18bad3637faeae838e920d94a4c84df2d8fbc Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 6 Jan 2012 01:05:55 +0100
Subject: [PATCH] PPC: KVM: Disable mmu notifier check
@ -13,10 +13,10 @@ KVM guests work there, even if possibly racy in some odd circumstances.
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/exec.c b/exec.c
index bb221cf..e71a82d 100644
index 455e0bb..14b1074 100644
--- a/exec.c
+++ b/exec.c
@@ -2831,10 +2831,12 @@ static void *file_ram_alloc(RAMBlock *block,
@@ -2486,10 +2486,12 @@ static void *file_ram_alloc(RAMBlock *block,
return NULL;
}

View File

@ -1,21 +0,0 @@
From 8132af006535df8bbf5c4f23c9f37b7d45851950 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 8 Dec 2011 23:19:32 +0100
Subject: [PATCH] XXX fake /proc/self/maps: also fclose real file
---
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 97c3303..9fabcba 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4643,6 +4643,7 @@ static int open_self_maps(void *cpu_env, int fd)
}
free(line);
+ fclose(fp);
#if defined(TARGET_ARM) || defined(TARGET_M68K) || defined(TARGET_UNICORE32)
dprintf(fd, "%08llx-%08llx rw-p %08llx 00:00 0 [stack]\n",

View File

@ -1,36 +0,0 @@
From 1021c91ed33c597aec0665501c1bfef96386046b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sat, 10 Dec 2011 00:03:56 +0100
Subject: [PATCH] XXX map qemu higher again so we have space for brk
---
linux-user/mmap.c | 2 +-
x86_64.ld | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 505254f..46e8bf8 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -210,7 +210,7 @@ static int mmap_frag(abi_ulong real_start,
/* Cygwin doesn't have a whole lot of address space. */
# define TASK_UNMAPPED_BASE 0x18000000
#else
-# define TASK_UNMAPPED_BASE 0x10000000
+# define TASK_UNMAPPED_BASE 0x18000000
#endif
static abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
diff --git a/x86_64.ld b/x86_64.ld
index 1151d8c..dc31aba 100644
--- a/x86_64.ld
+++ b/x86_64.ld
@@ -5,7 +5,7 @@ ENTRY(_start)
SECTIONS
{
/* Read-only sections, merged into text segment: */
- . = 0x8000000 + SIZEOF_HEADERS;
+ . = 0x10000000 + SIZEOF_HEADERS;
.interp : { *(.interp) }
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }

View File

@ -1,4 +1,4 @@
From 1e747ef08ad5f5901e183cfd2151ae2988fb06ea Mon Sep 17 00:00:00 2001
From 0760e24b52ff20a328f168ed23b52c9b9c0fd28f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Fri, 13 Jan 2012 17:05:41 +0100
Subject: [PATCH] linux-user: fix segfault deadlock
@ -48,10 +48,10 @@ index a72edda..e460e12 100644
+
#endif
diff --git a/user-exec.c b/user-exec.c
index abf6885..2826bd1 100644
index d8c2ad9..36d29b4 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -96,6 +96,10 @@ static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
@@ -96,6 +96,10 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
qemu_printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
pc, address, is_write, *(unsigned long *)old_set);
#endif
@ -60,5 +60,5 @@ index abf6885..2826bd1 100644
+ spin_unlock_safe(&tb_lock);
+
/* XXX: locking issue */
if (is_write && page_unprotect(h2g(address), pc, puc)) {
return 1;
if (is_write && h2g_valid(address)
&& page_unprotect(h2g(address), pc, puc)) {

View File

@ -1,4 +1,4 @@
From 69a6177e055dcb4978a22e78971ff2d047534afa Mon Sep 17 00:00:00 2001
From 67fe8224f47230a5392e7653c7362ac5035cdd3f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 2 Feb 2012 18:02:33 +0100
Subject: [PATCH] linux-user: binfmt: support host binaries

View File

@ -1,4 +1,4 @@
From 43526150fac8e7d36739e948cb3ca2f433e4e607 Mon Sep 17 00:00:00 2001
From 5e2f7416ec737a581f861a9799b8aa5a75235b25 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 7 May 2012 11:23:02 +0200
Subject: [PATCH] linux-user: Fix stale tbs after mmap
@ -19,6 +19,7 @@ avoiding the whole issue.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
[AF: Adapted to cputlb split-out]
---
exec-all.h | 2 ++
exec.c | 17 +++++++++++++++++
@ -26,23 +27,23 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/exec-all.h b/exec-all.h
index c211242..7fcd76f 100644
index c1b7e1f..9bda7f7 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -96,6 +96,8 @@ void QEMU_NORETURN cpu_loop_exit(CPUState *env1);
int page_unprotect(target_ulong address, unsigned long pc, void *puc);
@@ -96,6 +96,8 @@ void QEMU_NORETURN cpu_loop_exit(CPUArchState *env1);
int page_unprotect(target_ulong address, uintptr_t pc, void *puc);
void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end,
int is_cpu_write_access);
+void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end,
+ int is_cpu_write_access);
void tlb_flush_page(CPUState *env, target_ulong addr);
void tlb_flush(CPUState *env, int flush_global);
#if !defined(CONFIG_USER_ONLY)
/* cputlb.c */
void tlb_flush_page(CPUArchState *env, target_ulong addr);
diff --git a/exec.c b/exec.c
index e71a82d..532b00c 100644
index 14b1074..9ba4409 100644
--- a/exec.c
+++ b/exec.c
@@ -1016,6 +1016,23 @@ TranslationBlock *tb_gen_code(CPUState *env,
@@ -1077,6 +1077,23 @@ TranslationBlock *tb_gen_code(CPUArchState *env,
return tb;
}
@ -67,7 +68,7 @@ index e71a82d..532b00c 100644
starting in range [start;end[. NOTE: start and end must refer to
the same physical page. 'is_cpu_write_access' should be true if called
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 2620f88..3611deb 100644
index 2a1e4a1..e3fb6b5 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -587,6 +587,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,

View File

@ -1,37 +0,0 @@
From 04b073cd49c1e86a663978d5bca1610456afc80c Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:38:20 +0200
Subject: [PATCH] qemu-nonvoid_return
Squelches GCC warnings about undefined return values.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
hw/mpcore.c | 1 +
target-m68k/translate.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hw/mpcore.c b/hw/mpcore.c
index d6175cf..58dfd09 100644
--- a/hw/mpcore.c
+++ b/hw/mpcore.c
@@ -106,6 +106,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 0e7f1fe..bfaf116 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -436,6 +436,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

View File

@ -1,55 +0,0 @@
From c376a21e31202c85164b247ba6332efddfcb9c3b Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 25 Aug 2010 14:23:43 +0200
Subject: [PATCH] fix mipsn32*-linux-user builds
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
configure | 2 ++
default-configs/mipsn32-linux-user.mak | 1 +
default-configs/mipsn32el-linux-user.mak | 1 +
linux-user/mipsn32/syscall.h | 3 ++-
4 files changed, 6 insertions(+), 1 deletions(-)
create mode 100644 default-configs/mipsn32-linux-user.mak
create mode 100644 default-configs/mipsn32el-linux-user.mak
diff --git a/configure b/configure
index b113f60..a21b1e6 100755
--- a/configure
+++ b/configure
@@ -915,6 +915,8 @@ microblaze-linux-user \
microblazeel-linux-user \
mips-linux-user \
mipsel-linux-user \
+mipsn32-linux-user \
+mipsn32el-linux-user \
ppc-linux-user \
ppc64-linux-user \
ppc64abi32-linux-user \
diff --git a/default-configs/mipsn32-linux-user.mak b/default-configs/mipsn32-linux-user.mak
new file mode 100644
index 0000000..31df570
--- /dev/null
+++ b/default-configs/mipsn32-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for mips-linux-user
diff --git a/default-configs/mipsn32el-linux-user.mak b/default-configs/mipsn32el-linux-user.mak
new file mode 100644
index 0000000..4d0e4af
--- /dev/null
+++ b/default-configs/mipsn32el-linux-user.mak
@@ -0,0 +1 @@
+# Default configuration for mipsel-linux-user
diff --git a/linux-user/mipsn32/syscall.h b/linux-user/mipsn32/syscall.h
index 4ec506c..beeeb3c 100644
--- a/linux-user/mipsn32/syscall.h
+++ b/linux-user/mipsn32/syscall.h
@@ -216,6 +216,7 @@ struct target_pt_regs {
#undef TARGET_ENOTRECOVERABLE
#define TARGET_ENOTRECOVERABLE 166 /* State not recoverable */
-
+/* Nasty hack: define a fake errno value for use by sigreturn. */
+#define TARGET_QEMU_ESIGRETURN 255
#define UNAME_MACHINE "mips64"

View File

@ -1,348 +0,0 @@
From dbaddb35cf05035c5efe05a7272c3a4e8f29033b Mon Sep 17 00:00:00 2001
From: Benjamin <mlspirat42@gmail.com>
Date: Sat, 8 Oct 2011 07:31:33 +0000
Subject: [PATCH] Integrating Dynamips and GNS3 UDP tunnels (Patches)
On 10/07/11 10:35, Jan Kiszka wrote:
>
> You should send out the changes as proper patch series, rebased on
> current git head. See http://wiki.qemu.org/Contribute/SubmitAPatch for
> further requirements. And make sure that no patch breaks the build so
> that bisectability is preserved.
>
> Jan
>
Tested and used for several years by GNS3, it doesn't break the build.
I could not access http://git.qemu.org/qemu.git/plain/CODING_STYLE and
http://git.qemu.org/qemu.git/plain/HACKING (404) so these patches may
not be 100% conform. The script didn't report any error though.
Signed-off-by: Benjamin MARSILI <marsil_b@epitech.eu>
"-net tap[,vlan=n][,name=str],ifname=name\n"
" connect the host TAP network interface to VLAN 'n'\n"
----
[agraf] I combined the upstream submitted mail header with the 0.14 Uli
version of the patch. If this isn't upstream by 1.1, remove in
the next round!
---
Makefile.objs | 1 +
block/raw-win32.c | 4 +-
hw/e1000.c | 2 +-
net.c | 25 ++++++++++
net.h | 1 +
net/udp.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++
net/udp.h | 32 ++++++++++++
qemu-options.hx | 2 +
8 files changed, 202 insertions(+), 3 deletions(-)
create mode 100644 net/udp.c
create mode 100644 net/udp.h
diff --git a/Makefile.objs b/Makefile.objs
index 3a699ee..97c2b75 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -46,6 +46,7 @@ net-obj-y = net.o
net-nested-y = queue.o checksum.o util.o
net-nested-y += socket.o
net-nested-y += dump.o
+net-nested-y += udp.o
net-nested-$(CONFIG_POSIX) += tap.o
net-nested-$(CONFIG_LINUX) += tap-linux.o
net-nested-$(CONFIG_WIN32) += tap-win32.o
diff --git a/block/raw-win32.c b/block/raw-win32.c
index e4b0b75..09528ac 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -97,7 +97,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
if (!(flags & BDRV_O_CACHE_WB))
overlapped |= FILE_FLAG_WRITE_THROUGH;
s->hfile = CreateFile(filename, access_flags,
- FILE_SHARE_READ, NULL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, overlapped, NULL);
if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();
@@ -387,7 +387,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags)
if (!(flags & BDRV_O_CACHE_WB))
overlapped |= FILE_FLAG_WRITE_THROUGH;
s->hfile = CreateFile(filename, access_flags,
- FILE_SHARE_READ, NULL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
create_flags, overlapped, NULL);
if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();
diff --git a/hw/e1000.c b/hw/e1000.c
index e164d79..22a601a 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -580,7 +580,7 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
if (rctl & E1000_RCTL_UPE) // promiscuous
return 1;
- if ((buf[0] & 1) && (rctl & E1000_RCTL_MPE)) // promiscuous mcast
+ if ((buf[0] & 1)) //&& (rctl & E1000_RCTL_MPE)) // promiscuous mcast
return 1;
if ((rctl & E1000_RCTL_BAM) && !memcmp(buf, bcast, sizeof bcast))
diff --git a/net.c b/net.c
index cb52050..dc1689c 100644
--- a/net.c
+++ b/net.c
@@ -30,6 +30,7 @@
#include "net/dump.h"
#include "net/slirp.h"
#include "net/vde.h"
+#include "net/udp.h"
#include "net/util.h"
#include "monitor.h"
#include "qemu-common.h"
@@ -1031,6 +1032,29 @@ static const struct {
},
},
#endif
+
+ [NET_CLIENT_TYPE_UDP] = {
+ .type = "udp",
+ .init = net_init_udp,
+ .desc = {
+ NET_COMMON_PARAMS_DESC,
+ {
+ .name = "sport",
+ .type = QEMU_OPT_NUMBER,
+
+ .help = "source port number",
+ }, {
+ .name = "daddr",
+ .type = QEMU_OPT_STRING,
+ .help = "destination IP address",
+ }, {
+ .name = "dport",
+ .type = QEMU_OPT_NUMBER,
+ .help = "destination port number",
+ },
+ { /* end of list */ }
+ },
+ },
[NET_CLIENT_TYPE_DUMP] = {
.type = "dump",
.init = net_init_dump,
@@ -1348,6 +1372,7 @@ void net_check_clients(void)
case NET_CLIENT_TYPE_USER:
case NET_CLIENT_TYPE_TAP:
case NET_CLIENT_TYPE_SOCKET:
+ case NET_CLIENT_TYPE_UDP:
case NET_CLIENT_TYPE_VDE:
has_host_dev = 1;
break;
diff --git a/net.h b/net.h
index 9f633f8..ac6118c 100644
--- a/net.h
+++ b/net.h
@@ -35,6 +35,7 @@ typedef enum {
NET_CLIENT_TYPE_TAP,
NET_CLIENT_TYPE_SOCKET,
NET_CLIENT_TYPE_VDE,
+ NET_CLIENT_TYPE_UDP,
NET_CLIENT_TYPE_DUMP,
NET_CLIENT_TYPE_MAX
diff --git a/net/udp.c b/net/udp.c
new file mode 100644
index 0000000..d2a67e7
--- /dev/null
+++ b/net/udp.c
@@ -0,0 +1,138 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "net/udp.h"
+
+#include "config-host.h"
+
+#ifndef _WIN32
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/udp.h>
+#endif
+
+#include "net.h"
+#include "qemu-char.h"
+#include "qemu-common.h"
+#include "qemu-option.h"
+#include "qemu_socket.h"
+#include "sysemu.h"
+
+
+typedef struct UDPState {
+ VLANClientState nc;
+ int rfd;
+ struct sockaddr_in sender;
+} UDPState;
+
+static void udp_to_qemu(void *opaque)
+{
+ UDPState *s = opaque;
+ uint8_t buf[4096];
+ int size;
+
+ size = recvfrom(s->rfd, (char *)buf, sizeof(buf), 0, NULL, NULL);
+ if (size > 0) {
+ qemu_send_packet(&s->nc, buf, size);
+ }
+}
+
+static ssize_t udp_receive(VLANClientState *nc, const uint8_t *buf, size_t size)
+{
+ UDPState *s = DO_UPCAST(UDPState, nc, nc);
+ int ret;
+
+ do {
+ ret = sendto(s->rfd, (const char *)buf, size, 0, (struct sockaddr *)&s->sender, sizeof (s->sender));
+ } while (ret < 0 && errno == EINTR);
+
+ return ret;
+}
+
+static void udp_cleanup(VLANClientState *nc)
+{
+ UDPState *s = DO_UPCAST(UDPState, nc, nc);
+ qemu_set_fd_handler(s->rfd, NULL, NULL, NULL);
+ close(s->rfd);
+}
+
+static NetClientInfo net_udp_info = {
+ .type = NET_CLIENT_TYPE_UDP,
+ .size = sizeof(UDPState),
+ .receive = udp_receive,
+ .cleanup = udp_cleanup,
+};
+
+static int net_udp_init(VLANState *vlan, const char *model,
+ const char *name, int sport,
+ const char *daddr, int dport)
+{
+ VLANClientState *nc;
+ UDPState *s;
+ struct sockaddr_in receiver;
+ int ret;
+
+ nc = qemu_new_net_client(&net_udp_info, vlan, NULL, model, name);
+
+ snprintf(nc->info_str, sizeof(nc->info_str),"udp: %i->%s:%i",
+ sport, daddr, dport);
+
+ s = DO_UPCAST(UDPState, nc, nc);
+
+ s->rfd = socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
+ receiver.sin_family = AF_INET;
+ receiver.sin_addr.s_addr = INADDR_ANY;
+ receiver.sin_port = htons(sport);
+ ret = bind(s->rfd, (struct sockaddr *)&receiver, sizeof(receiver));
+
+ if (ret == -1) {
+ fprintf (stderr, "bind error:%s\n", strerror(errno));
+ return ret;
+ }
+
+ memset((char*)&s->sender, 0,sizeof(s->sender));
+ s->sender.sin_family = AF_INET;
+ s->sender.sin_port = htons(dport);
+ inet_aton(daddr, &s->sender.sin_addr);
+
+ qemu_set_fd_handler(s->rfd, udp_to_qemu, NULL, s);
+
+ return 0;
+}
+
+int net_init_udp(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan)
+{
+ const char *daddr;
+ int sport, dport;
+
+ daddr = qemu_opt_get(opts, "daddr");
+
+ sport = qemu_opt_get_number(opts, "sport", 0);
+ dport = qemu_opt_get_number(opts, "dport", 0);
+
+ if (net_udp_init(vlan, "udp", name, sport, daddr, dport) == -1) {
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/net/udp.h b/net/udp.h
new file mode 100644
index 0000000..9e92852
--- /dev/null
+++ b/net/udp.h
@@ -0,0 +1,32 @@
+/*
+ * QEMU System Emulator
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef QEMU_NET_UDP_H
+#define QEMU_NET_UDP_H
+
+#include "qemu-common.h"
+#include "qemu-option.h"
+
+int net_init_udp(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan);
+
+#endif /* QEMU_NET_UDP_H */
diff --git a/qemu-options.hx b/qemu-options.hx
index 83b1f38..94f946e 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1226,6 +1226,8 @@ DEF("net", HAS_ARG, QEMU_OPTION_net,
"-net socket[,vlan=n][,name=str][,fd=h][,mcast=maddr:port[,localaddr=addr]]\n"
" connect the vlan 'n' to multicast maddr and port\n"
" use 'localaddr=addr' to specify the host address to send packets from\n"
+ "-net udp[,vlan=n]sport=sport,dport=dport,daddr=host\n"
+ " connect the vlan 'n' to a UDP tunnel (for Dynamips/GNS3)\n"
#ifdef CONFIG_VDE
"-net vde[,vlan=n][,name=str][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
" connect the vlan 'n' to port 'n' of a vde switch running\n"

View File

@ -1,41 +0,0 @@
From 8954d20f70430ddd4f6add000fd8bf82d5ddcb27 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 14 Dec 2011 00:33:28 +0100
Subject: [PATCH] linux-user: reserve 4GB of vmem for 32-on-64
When running 32-on-64 bit guests, we should always reserve as much
virtual memory as we possibly can for the guest process, so it can
never overlap with QEMU address space.
Fortunately we already have the infrastructure for that. All that's
missing is some sane default value to also make use of it!
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/main.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 788ff98..3ffee40 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -48,8 +48,19 @@ unsigned long mmap_min_addr;
#if defined(CONFIG_USE_GUEST_BASE)
unsigned long guest_base;
int have_guest_base;
+#if (TARGET_LONG_BITS == 32) && (HOST_LONG_BITS == 64)
+/*
+ * When running 32-on-64 we should make sure we can fit all of the possible
+ * guest address space into a contiguous chunk of virtual host memory.
+ *
+ * This way we will never overlap with our own libraries or binaries or stack
+ * or anything else that QEMU maps.
+ */
+unsigned long reserved_va = 0xf7000000;
+#else
unsigned long reserved_va;
#endif
+#endif
static void usage(void);
extern int use_stopflag;

View File

@ -1,51 +0,0 @@
From 9a72708a58d7bcbc1ba036a44cea920a238b0312 Mon Sep 17 00:00:00 2001
From: Fabio Erculiani <lxnay@sabayon.org>
Date: Tue, 3 Jan 2012 09:38:34 +0000
Subject: [PATCH] linux-user: improve fake /proc/self/stat making `ps` not segfault.
With the current fake /proc/self/stat implementation `ps` is
segfaulting because it expects to read PID and argv[0] as first and
second field respectively, with the latter being enclosed between
backets.
Reproducing is as easy as running: `ps` inside qemu-user chroot
with /proc mounted.
Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9ba51bf..3e8e3dd 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4678,11 +4678,22 @@ static int open_self_stat(void *cpu_env, int fd)
int len;
uint64_t val = 0;
- if (i == 27) {
- /* stack bottom */
- val = start_stack;
+ if (i == 0) {
+ /* pid */
+ val = getpid();
+ snprintf(buf, sizeof(buf), "%"PRId64 " ", val);
+ } else if (i == 1) {
+ /* app name */
+ snprintf(buf, sizeof(buf), "(%s) ", ts->bprm->argv[0]);
+ } else if (i == 27) {
+ /* stack bottom */
+ val = start_stack;
+ snprintf(buf, sizeof(buf), "%"PRId64 " ", val);
+ } else {
+ /* for the rest, there is MasterCard */
+ snprintf(buf, sizeof(buf), "0%c", i == 43 ? '\n' : ' ');
}
- snprintf(buf, sizeof(buf), "%"PRId64 "%c", val, i == 43 ? '\n' : ' ');
+
len = strlen(buf);
if (write(fd, buf, len) != len) {
return -1;

View File

@ -1,34 +0,0 @@
From e8171f6d129e129fe632721ab603f800385b0609 Mon Sep 17 00:00:00 2001
From: Fabio Erculiani <lxnay@sabayon.org>
Date: Tue, 3 Jan 2012 09:38:35 +0000
Subject: [PATCH] linux-user: target_argv is placed on ts->bprm->argv and can't be freed()
TaskState contains linux_bprm struct which encapsulates argv among
other things.
argv might be used around the code and is expected to contain valid
data. Before this patch, ts->bprm->argv was NULL due to it being
freed right after loader_exec().
Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/main.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 3ffee40..6a5dfde 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3503,11 +3503,6 @@ int main(int argc, char **argv, char **envp)
_exit(1);
}
- for (i = 0; i < target_argc; i++) {
- free(target_argv[i]);
- }
- free(target_argv);
-
for (wrk = target_environ; *wrk; wrk++) {
free(*wrk);
}

View File

@ -1,30 +0,0 @@
From f0fd80de8f15efc091751f2e9bf4c2276ba058b3 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 10 Jan 2012 16:25:27 +0100
Subject: [PATCH] PPC: KVM: Ignore SET_ONE_REG failures
The SET_ONE_REG interface didn't make it upstream in the form that is used
in qemu-1.0, so the code won't work. Make the error a warning, so we can
at least use the HV target.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-ppc/kvm.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 0410901..6c6278a 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -759,7 +759,10 @@ void kvmppc_set_papr(CPUState *env)
reg.u.reg64 = env->spr[SPR_HIOR];
ret = kvm_vcpu_ioctl(env, KVM_SET_ONE_REG, &reg);
if (ret) {
- goto fail;
+ fprintf(stderr, "Couldn't set HIOR. Maybe you're running an old \n"
+ "kernel with support for HV KVM but no PAPR PR \n"
+ "KVM in which case things will work. If they don't \n"
+ "please update your host kernel!\n");
}
/* Set SDR1 so kernel space finds the HTAB */

View File

@ -1,26 +0,0 @@
From 351142c287c874f959828c6360cda977306dfa47 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 10 Jan 2012 17:03:02 +0100
Subject: [PATCH] PPC: KVM: Ignore ENABLE_PAPR to support very old HV KVM kernels
Very old kernels (3.1) didn't expose the PAPR capability yet, but still
did work with HV KVM. Make the error a warning so we can work on them.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-ppc/kvm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 6c6278a..2f39e77 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -745,7 +745,7 @@ void kvmppc_set_papr(CPUState *env)
ret = kvm_vcpu_ioctl(env, KVM_ENABLE_CAP, &cap);
if (ret) {
- goto fail;
+ fprintf(stderr, "You're running a very old kernel. Expect breakage!\n");
}
/*

View File

@ -1,376 +0,0 @@
From 0f7996403949df0249e833d7e0f250042eed3384 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 31 Jan 2012 18:42:06 +0100
Subject: [PATCH] linux-user: implement device mapper ioctls
This patch implements all ioctls currently implemented by device mapper,
enabling us to run dmsetup and kpartx inside of linux-user.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/ioctls.h | 32 ++++++
linux-user/syscall.c | 226 ++++++++++++++++++++++++++++++++++++++++++++
linux-user/syscall_defs.h | 18 ++++
linux-user/syscall_types.h | 36 +++++++
4 files changed, 312 insertions(+), 0 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 224dbc6..8647d64 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -350,3 +350,35 @@
IOCTL(VT_SETMODE, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_vt_mode)))
IOCTL(VT_RELDISP, 0, TYPE_INT)
IOCTL(VT_DISALLOCATE, 0, TYPE_INT)
+
+ IOCTL(DM_VERSION, IOC_RW, MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_REMOVE_ALL, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_LIST_DEVICES, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_CREATE, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_REMOVE, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_RENAME, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_SUSPEND, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_STATUS, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_WAIT, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_TABLE_LOAD, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_TABLE_CLEAR, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_TABLE_DEPS, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_TABLE_STATUS, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_LIST_VERSIONS,IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_TARGET_MSG, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
+ IOCTL_SPECIAL(DM_DEV_SET_GEOMETRY, IOC_RW, do_ioctl_dm,
+ MK_PTR(MK_STRUCT(STRUCT_dm_ioctl)))
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3e8e3dd..7a20af4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -95,6 +95,7 @@ int __clone2(int (*fn)(void *), void *child_stack_base,
#endif
#include <linux/fb.h>
#include <linux/vt.h>
+#include <linux/dm-ioctl.h>
#include "linux_loop.h"
#include "cpu-uname.h"
@@ -3320,6 +3321,231 @@ static abi_long do_ioctl_ifconf(const IOCTLEntry *ie, uint8_t *buf_temp,
return ret;
}
+static abi_long do_ioctl_dm(const IOCTLEntry *ie, uint8_t *buf_temp, int fd,
+ abi_long cmd, abi_long arg)
+{
+ void *argptr;
+ struct dm_ioctl *host_dm;
+ abi_long guest_data;
+ uint32_t guest_data_size;
+ int target_size;
+ const argtype *arg_type = ie->arg_type;
+ abi_long ret;
+ void *big_buf = NULL;
+ char *host_data;
+
+ arg_type++;
+ target_size = thunk_type_size(arg_type, 0);
+ argptr = lock_user(VERIFY_READ, arg, target_size, 1);
+ if (!argptr) {
+ ret = -TARGET_EFAULT;
+ goto out;
+ }
+ thunk_convert(buf_temp, argptr, arg_type, THUNK_HOST);
+ unlock_user(argptr, arg, 0);
+
+ /* buf_temp is too small, so fetch things into a bigger buffer */
+ big_buf = g_malloc0(((struct dm_ioctl*)buf_temp)->data_size * 2);
+ memcpy(big_buf, buf_temp, target_size);
+ buf_temp = big_buf;
+ host_dm = big_buf;
+
+ guest_data = arg + host_dm->data_start;
+ if ((guest_data - arg) < 0) {
+ ret = -EINVAL;
+ goto out;
+ }
+ guest_data_size = host_dm->data_size - host_dm->data_start;
+ host_data = (char*)host_dm + host_dm->data_start;
+
+ argptr = lock_user(VERIFY_READ, guest_data, guest_data_size, 1);
+ switch (ie->host_cmd) {
+ case DM_REMOVE_ALL:
+ case DM_LIST_DEVICES:
+ case DM_DEV_CREATE:
+ case DM_DEV_REMOVE:
+ case DM_DEV_SUSPEND:
+ case DM_DEV_STATUS:
+ case DM_DEV_WAIT:
+ case DM_TABLE_STATUS:
+ case DM_TABLE_CLEAR:
+ case DM_TABLE_DEPS:
+ case DM_LIST_VERSIONS:
+ /* no input data */
+ break;
+ case DM_DEV_RENAME:
+ case DM_DEV_SET_GEOMETRY:
+ /* data contains only strings */
+ memcpy(host_data, argptr, guest_data_size);
+ break;
+ case DM_TARGET_MSG:
+ memcpy(host_data, argptr, guest_data_size);
+ *(uint64_t*)host_data = tswap64(*(uint64_t*)argptr);
+ break;
+ case DM_TABLE_LOAD:
+ {
+ void *gspec = argptr;
+ void *cur_data = host_data;
+ const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) };
+ int spec_size = thunk_type_size(arg_type, 0);
+ int i;
+
+ for (i = 0; i < host_dm->target_count; i++) {
+ struct dm_target_spec *spec = cur_data;
+ uint32_t next;
+ int slen;
+
+ thunk_convert(spec, gspec, arg_type, THUNK_HOST);
+ slen = strlen((char*)gspec + spec_size) + 1;
+ next = spec->next;
+ spec->next = sizeof(*spec) + slen;
+ strcpy((char*)&spec[1], gspec + spec_size);
+ gspec += next;
+ cur_data += spec->next;
+ }
+ break;
+ }
+ default:
+ ret = -TARGET_EINVAL;
+ goto out;
+ }
+ unlock_user(argptr, guest_data, 0);
+
+ ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
+ if (!is_error(ret)) {
+ guest_data = arg + host_dm->data_start;
+ guest_data_size = host_dm->data_size - host_dm->data_start;
+ argptr = lock_user(VERIFY_WRITE, guest_data, guest_data_size, 0);
+ switch (ie->host_cmd) {
+ case DM_REMOVE_ALL:
+ case DM_DEV_CREATE:
+ case DM_DEV_REMOVE:
+ case DM_DEV_RENAME:
+ case DM_DEV_SUSPEND:
+ case DM_DEV_STATUS:
+ case DM_TABLE_LOAD:
+ case DM_TABLE_CLEAR:
+ case DM_TARGET_MSG:
+ case DM_DEV_SET_GEOMETRY:
+ /* no return data */
+ break;
+ case DM_LIST_DEVICES:
+ {
+ struct dm_name_list *nl = (void*)host_dm + host_dm->data_start;
+ uint32_t remaining_data = guest_data_size;
+ void *cur_data = argptr;
+ const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_name_list) };
+ int nl_size = 12; /* can't use thunk_size due to alignment */
+
+ while (1) {
+ uint32_t next = nl->next;
+ if (next) {
+ nl->next = nl_size + (strlen(nl->name) + 1);
+ }
+ if (remaining_data < nl->next) {
+ host_dm->flags |= DM_BUFFER_FULL_FLAG;
+ break;
+ }
+ thunk_convert(cur_data, nl, arg_type, THUNK_TARGET);
+ strcpy(cur_data + nl_size, nl->name);
+ cur_data += nl->next;
+ remaining_data -= nl->next;
+ if (!next) {
+ break;
+ }
+ nl = (void*)nl + next;
+ }
+ break;
+ }
+ case DM_DEV_WAIT:
+ case DM_TABLE_STATUS:
+ {
+ struct dm_target_spec *spec = (void*)host_dm + host_dm->data_start;
+ void *cur_data = argptr;
+ const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_spec) };
+ int spec_size = thunk_type_size(arg_type, 0);
+ int i;
+
+ for (i = 0; i < host_dm->target_count; i++) {
+ uint32_t next = spec->next;
+ int slen = strlen((char*)&spec[1]) + 1;
+ spec->next = (cur_data - argptr) + spec_size + slen;
+ if (guest_data_size < spec->next) {
+ host_dm->flags |= DM_BUFFER_FULL_FLAG;
+ break;
+ }
+ thunk_convert(cur_data, spec, arg_type, THUNK_TARGET);
+ strcpy(cur_data + spec_size, (char*)&spec[1]);
+ cur_data = argptr + spec->next;
+ spec = (void*)host_dm + host_dm->data_start + next;
+ }
+ break;
+ }
+ case DM_TABLE_DEPS:
+ {
+ void *hdata = (void*)host_dm + host_dm->data_start;
+ int count = *(uint32_t*)hdata;
+ uint64_t *hdev = hdata + 8;
+ uint64_t *gdev = argptr + 8;
+ int i;
+
+ *(uint32_t*)argptr = tswap32(count);
+ for (i = 0; i < count; i++) {
+ *gdev = tswap64(*hdev);
+ gdev++;
+ hdev++;
+ }
+ break;
+ }
+ case DM_LIST_VERSIONS:
+ {
+ struct dm_target_versions *vers = (void*)host_dm + host_dm->data_start;
+ uint32_t remaining_data = guest_data_size;
+ void *cur_data = argptr;
+ const argtype arg_type[] = { MK_STRUCT(STRUCT_dm_target_versions) };
+ int vers_size = thunk_type_size(arg_type, 0);
+
+ while (1) {
+ uint32_t next = vers->next;
+ if (next) {
+ vers->next = vers_size + (strlen(vers->name) + 1);
+ }
+ if (remaining_data < vers->next) {
+ host_dm->flags |= DM_BUFFER_FULL_FLAG;
+ break;
+ }
+ thunk_convert(cur_data, vers, arg_type, THUNK_TARGET);
+ strcpy(cur_data + vers_size, vers->name);
+ cur_data += vers->next;
+ remaining_data -= vers->next;
+ if (!next) {
+ break;
+ }
+ vers = (void*)vers + next;
+ }
+ break;
+ }
+ default:
+ ret = -TARGET_EINVAL;
+ goto out;
+ }
+ unlock_user(argptr, guest_data, guest_data_size);
+
+ argptr = lock_user(VERIFY_WRITE, arg, target_size, 0);
+ if (!argptr) {
+ ret = -TARGET_EFAULT;
+ goto out;
+ }
+ thunk_convert(argptr, buf_temp, arg_type, THUNK_TARGET);
+ unlock_user(argptr, arg, target_size);
+ }
+out:
+ if (big_buf) {
+ free(big_buf);
+ }
+ return ret;
+}
+
static IOCTLEntry ioctl_entries[] = {
#define IOCTL(cmd, access, ...) \
{ TARGET_ ## cmd, cmd, #cmd, access, 0, { __VA_ARGS__ } },
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index f0acc72..c8b57c9 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -989,6 +989,24 @@ struct target_pollfd {
#define TARGET_VT_RELDISP 0x5605
#define TARGET_VT_DISALLOCATE 0x5608
+/* device mapper */
+#define TARGET_DM_VERSION TARGET_IOWRU(0xfd, 0x00)
+#define TARGET_DM_REMOVE_ALL TARGET_IOWRU(0xfd, 0x01)
+#define TARGET_DM_LIST_DEVICES TARGET_IOWRU(0xfd, 0x02)
+#define TARGET_DM_DEV_CREATE TARGET_IOWRU(0xfd, 0x03)
+#define TARGET_DM_DEV_REMOVE TARGET_IOWRU(0xfd, 0x04)
+#define TARGET_DM_DEV_RENAME TARGET_IOWRU(0xfd, 0x05)
+#define TARGET_DM_DEV_SUSPEND TARGET_IOWRU(0xfd, 0x06)
+#define TARGET_DM_DEV_STATUS TARGET_IOWRU(0xfd, 0x07)
+#define TARGET_DM_DEV_WAIT TARGET_IOWRU(0xfd, 0x08)
+#define TARGET_DM_TABLE_LOAD TARGET_IOWRU(0xfd, 0x09)
+#define TARGET_DM_TABLE_CLEAR TARGET_IOWRU(0xfd, 0x0a)
+#define TARGET_DM_TABLE_DEPS TARGET_IOWRU(0xfd, 0x0b)
+#define TARGET_DM_TABLE_STATUS TARGET_IOWRU(0xfd, 0x0c)
+#define TARGET_DM_LIST_VERSIONS TARGET_IOWRU(0xfd, 0x0d)
+#define TARGET_DM_TARGET_MSG TARGET_IOWRU(0xfd, 0x0e)
+#define TARGET_DM_DEV_SET_GEOMETRY TARGET_IOWRU(0xfd, 0x0f)
+
/* from asm/termbits.h */
#define TARGET_NCC 8
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 8fde25c..dea520e 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -191,6 +191,42 @@ STRUCT(vt_mode,
TYPE_SHORT, /* acqsig */
TYPE_SHORT) /* frsig */
+STRUCT(dm_ioctl,
+ MK_ARRAY(TYPE_INT, 3), /* version */
+ TYPE_INT, /* data_size */
+ TYPE_INT, /* data_start */
+ TYPE_INT, /* target_count*/
+ TYPE_INT, /* open_count */
+ TYPE_INT, /* flags */
+ TYPE_INT, /* event_nr */
+ TYPE_INT, /* padding */
+ TYPE_ULONGLONG, /* dev */
+ MK_ARRAY(TYPE_CHAR, 128), /* name */
+ MK_ARRAY(TYPE_CHAR, 129), /* uuid */
+ MK_ARRAY(TYPE_CHAR, 7)) /* data */
+
+STRUCT(dm_target_spec,
+ TYPE_ULONGLONG, /* sector_start */
+ TYPE_ULONGLONG, /* length */
+ TYPE_INT, /* status */
+ TYPE_INT, /* next */
+ MK_ARRAY(TYPE_CHAR, 16)) /* target_type */
+
+STRUCT(dm_target_deps,
+ TYPE_INT, /* count */
+ TYPE_INT) /* padding */
+
+STRUCT(dm_name_list,
+ TYPE_ULONGLONG, /* dev */
+ TYPE_INT) /* next */
+
+STRUCT(dm_target_versions,
+ TYPE_INT, /* next */
+ MK_ARRAY(TYPE_INT, 3)) /* version*/
+
+STRUCT(dm_target_msg,
+ TYPE_ULONGLONG) /* sector */
+
STRUCT(fiemap_extent,
TYPE_ULONGLONG, /* fe_logical */
TYPE_ULONGLONG, /* fe_physical */

View File

@ -1,133 +0,0 @@
From 1c1448c93345613871dac849cfd6786cf4a394ae Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 31 Jan 2012 19:44:41 +0100
Subject: [PATCH] linux-user: add struct old_dev_t compat
The compat LOOP_SET_STATUS ioctl uses struct old_dev_t in its passed
struct. That variable type is vastly different between different
architectures. Implement wrapping around it so we can use it.
This fixes running arm kpartx on an x86_64 host for me.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall_types.h | 4 ++--
thunk.c | 28 ++++++++++++++++++++++++++++
thunk.h | 28 ++++++++++++++++++++++++++++
3 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index dea520e..ad2ee7e 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -88,9 +88,9 @@ STRUCT(mixer_info,
/* loop device ioctls */
STRUCT(loop_info,
TYPE_INT, /* lo_number */
- TYPE_SHORT, /* lo_device */
+ TYPE_OLDDEVT, /* lo_device */
TYPE_ULONG, /* lo_inode */
- TYPE_SHORT, /* lo_rdevice */
+ TYPE_OLDDEVT, /* lo_rdevice */
TYPE_INT, /* lo_offset */
TYPE_INT, /* lo_encrypt_type */
TYPE_INT, /* lo_encrypt_key_size */
diff --git a/thunk.c b/thunk.c
index 34bc7d1..bf43985 100644
--- a/thunk.c
+++ b/thunk.c
@@ -47,6 +47,7 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
case TYPE_LONG:
case TYPE_ULONG:
case TYPE_PTRVOID:
+ case TYPE_OLDDEVT:
return type_ptr;
case TYPE_PTR:
return thunk_type_next_ptr(type_ptr);
@@ -209,6 +210,33 @@ const argtype *thunk_convert(void *dst, const void *src,
#else
#warning unsupported conversion
#endif
+ case TYPE_OLDDEVT:
+ {
+ uint64_t val = 0;
+ switch (thunk_type_size(type_ptr - 1, !to_host)) {
+ case 2:
+ val = *(uint16_t *)src;
+ break;
+ case 4:
+ val = *(uint32_t *)src;
+ break;
+ case 8:
+ val = *(uint64_t *)src;
+ break;
+ }
+ switch (thunk_type_size(type_ptr - 1, to_host)) {
+ case 2:
+ *(uint16_t *)dst = tswap16(val);
+ break;
+ case 4:
+ *(uint32_t *)dst = tswap32(val);
+ break;
+ case 8:
+ *(uint64_t *)dst = tswap64(val);
+ break;
+ }
+ break;
+ }
case TYPE_ARRAY:
{
int array_length, i, dst_size, src_size;
diff --git a/thunk.h b/thunk.h
index 55890f3..ed65121 100644
--- a/thunk.h
+++ b/thunk.h
@@ -38,6 +38,7 @@ typedef enum argtype {
TYPE_ARRAY,
TYPE_STRUCT,
TYPE_INTBITFIELD,
+ TYPE_OLDDEVT,
} argtype;
#define MK_PTR(type) TYPE_PTR, type
@@ -106,6 +107,31 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host)
return TARGET_ABI_BITS / 8;
}
break;
+ case TYPE_OLDDEVT:
+ if (is_host) {
+#if defined(HOST_X86_64)
+ return 8;
+#elif defined(HOST_ALPHA) || defined(HOST_IA64) || defined(HOST_MIPS) || \
+ defined(HOST_PARISC) || defined(HOST_SPARC64)
+ return 4;
+#elif defined(HOST_PPC)
+ return HOST_LONG_SIZE;
+#else
+ return 2;
+#endif
+ } else {
+#if defined(TARGET_X86_64)
+ return 8;
+#elif defined(TARGET_ALPHA) || defined(TARGET_IA64) || defined(TARGET_MIPS) || \
+ defined(TARGET_PARISC) || defined(TARGET_SPARC64)
+ return 4;
+#elif defined(TARGET_PPC)
+ return TARGET_ABI_BITS / 8;
+#else
+ return 2;
+#endif
+ }
+ break;
case TYPE_ARRAY:
size = type_ptr[1];
return size * thunk_type_size_array(type_ptr + 2, is_host);
@@ -144,6 +170,8 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host)
return TARGET_ABI_BITS / 8;
}
break;
+ case TYPE_OLDDEVT:
+ return thunk_type_size(type_ptr, is_host);
case TYPE_ARRAY:
return thunk_type_align_array(type_ptr + 2, is_host);
case TYPE_STRUCT:

View File

@ -1,33 +0,0 @@
From e9c0b65bbf4f8df8dcddf619d8473afecac8166c Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 31 Jan 2012 20:10:20 +0100
Subject: [PATCH] linux-user: fix BLK ioctl arguments
Some BLK ioctls passed sizeof(x) into a macro that already did sizeof() on
the passed in argument, rendering the size information inside the ioctl be
the size of the host default integer type.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall_defs.h | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index c8b57c9..21b054c 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -832,9 +832,11 @@ struct target_pollfd {
#define TARGET_BLKSECTGET TARGET_IO(0x12,103)/* get max sectors per request (ll_rw_blk.c) */
#define TARGET_BLKSSZGET TARGET_IO(0x12,104)/* get block device sector size */
/* A jump here: 108-111 have been used for various private purposes. */
-#define TARGET_BLKBSZGET TARGET_IOR(0x12,112,sizeof(int))
-#define TARGET_BLKBSZSET TARGET_IOW(0x12,113,sizeof(int))
-#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,sizeof(uint64_t)) /* return device size in bytes (u64 *arg) */
+#define TARGET_BLKBSZGET TARGET_IOR(0x12,112,int)
+#define TARGET_BLKBSZSET TARGET_IOW(0x12,113,int)
+#define TARGET_BLKGETSIZE64 TARGET_IOR(0x12,114,abi_ulong)
+ /* return device size in bytes
+ (u64 *arg) */
#define TARGET_FIBMAP TARGET_IO(0x00,1) /* bmap access */
#define TARGET_FIGETBSZ TARGET_IO(0x00,2) /* get the block size used for bmap */
#define TARGET_FS_IOC_FIEMAP TARGET_IOWR('f',11,struct fiemap)

View File

@ -1,24 +0,0 @@
From 62783a25efd8a6c5e6272950e8fc7f2dd0fd28e5 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 31 Jan 2012 20:11:37 +0100
Subject: [PATCH] linux-user: add BLKSSZGET ioctl wrapper
This patch adds an ioctl definition for BLKSSZGET.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/ioctls.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 8647d64..07463d3 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -74,6 +74,7 @@
IOCTL(BLKFLSBUF, 0, TYPE_NULL)
IOCTL(BLKRASET, 0, TYPE_INT)
IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
+ IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_LONG))
#ifdef FIBMAP
IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
#endif

View File

@ -1,24 +0,0 @@
From cd606a848069e4adfbf65f33468ab1471b26d85e Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 2 Feb 2012 02:22:34 +0100
Subject: [PATCH] linux-user: Add ioctl for BLKBSZGET
This patch adds the ioctl wrapper definition for BLKBSZGET.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/ioctls.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index 07463d3..e8c1c69 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -75,6 +75,7 @@
IOCTL(BLKRASET, 0, TYPE_INT)
IOCTL(BLKRAGET, IOC_R, MK_PTR(TYPE_LONG))
IOCTL(BLKSSZGET, IOC_R, MK_PTR(TYPE_LONG))
+ IOCTL(BLKBSZGET, IOC_R, MK_PTR(TYPE_INT))
#ifdef FIBMAP
IOCTL(FIBMAP, IOC_W | IOC_R, MK_PTR(TYPE_LONG))
#endif

View File

@ -1,31 +0,0 @@
From e142d9e8baf58cd6f3ae688db188721d9207f8ca Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 2 Feb 2012 03:14:18 +0100
Subject: [PATCH] linux-user: take RESERVED_VA into account for g2h_valid()
When running with -R (RESERVED_VA > 0) all guest virtual addresses
are within the [0..RESERVED_VA] range. Reflect this with g2h_valid()
too so we can safely check for boundaries of our guest address space.
This is required to have the /proc/self/maps code not show maps that
aren't accessible from the guest process's point of view.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
cpu-all.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/cpu-all.h b/cpu-all.h
index 5f47ab8..ce3e78f 100644
--- a/cpu-all.h
+++ b/cpu-all.h
@@ -204,7 +204,8 @@ extern unsigned long reserved_va;
#else
#define h2g_valid(x) ({ \
unsigned long __guest = (unsigned long)(x) - GUEST_BASE; \
- __guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS); \
+ (__guest < (1ul << TARGET_VIRT_ADDR_SPACE_BITS)) && \
+ (!RESERVED_VA || (__guest < RESERVED_VA)); \
})
#endif

View File

@ -1,36 +0,0 @@
From 0a9d9af253f5ff946b86fc7e9d95f1a2a30a34d7 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 6 Feb 2012 21:37:07 +0100
Subject: [PATCH] linux-user: fix fallocate
Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
v1 -> v2:
- unbreak 64-bit guests
---
linux-user/syscall.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7a20af4..cbd37f6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8479,7 +8479,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif /* CONFIG_EVENTFD */
#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
case TARGET_NR_fallocate:
+#if TARGET_ABI_BITS == 32
+ ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
+ target_offset64(arg5, arg6)));
+#else
ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
+#endif
break;
#endif
#if defined(CONFIG_SYNC_FILE_RANGE)

View File

@ -1,116 +0,0 @@
From a6664afab4b925f8ae74b6fe20e3634f42690e90 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 4 Mar 2012 02:41:14 +0100
Subject: [PATCH] linux-user: resolve reserved_va vma downwards
After consulting with Paul Brook, we concluded that it's best to search
the VMA space downwards, so that we don't even get the chance to conflict
with the brk range.
This patch resolves a bunch of allocation conflicts when using -R.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
This replaces the other patches I sent out earlier today.
---
linux-user/main.c | 1 +
linux-user/mmap.c | 35 ++++++++++++++++++++++++-----------
linux-user/qemu.h | 1 +
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 6a5dfde..d61d731 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -3437,6 +3437,7 @@ int main(int argc, char **argv, char **envp)
guest_base = HOST_PAGE_ALIGN((unsigned long)p);
}
qemu_log("Reserved 0x%lx bytes of guest address space\n", reserved_va);
+ mmap_next_start = reserved_va;
}
if (reserved_va || have_guest_base) {
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index e4db455..2620f88 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -212,7 +212,7 @@ static int mmap_frag(abi_ulong real_start,
#else
# define TASK_UNMAPPED_BASE 0x18000000
#endif
-static abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
+abi_ulong mmap_next_start = TASK_UNMAPPED_BASE;
unsigned long last_brk;
@@ -222,7 +222,7 @@ unsigned long last_brk;
static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
{
abi_ulong addr;
- abi_ulong last_addr;
+ abi_ulong end_addr;
int prot;
int looped = 0;
@@ -230,25 +230,38 @@ static abi_ulong mmap_find_vma_reserved(abi_ulong start, abi_ulong size)
return (abi_ulong)-1;
}
- last_addr = start;
- for (addr = start; last_addr + size != addr; addr += qemu_host_page_size) {
- if (last_addr + size >= RESERVED_VA
- || (abi_ulong)(last_addr + size) < last_addr) {
+ size = HOST_PAGE_ALIGN(size);
+ end_addr = start + size;
+ if (end_addr > RESERVED_VA) {
+ end_addr = RESERVED_VA;
+ }
+ addr = end_addr - qemu_host_page_size;
+
+ while (1) {
+ if (addr > end_addr) {
if (looped) {
return (abi_ulong)-1;
}
- last_addr = qemu_host_page_size;
- addr = 0;
+ end_addr = RESERVED_VA;
+ addr = end_addr - qemu_host_page_size;
looped = 1;
continue;
}
prot = page_get_flags(addr);
if (prot) {
- last_addr = addr + qemu_host_page_size;
+ end_addr = addr;
+ }
+ if (addr + size == end_addr) {
+ break;
}
+ addr -= qemu_host_page_size;
+ }
+
+ if (start == mmap_next_start) {
+ mmap_next_start = addr;
}
- mmap_next_start = addr;
- return last_addr;
+
+ return addr;
}
#endif
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index aa06acf..5dc0720 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -254,6 +254,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
abi_ulong new_addr);
int target_msync(abi_ulong start, abi_ulong len, int flags);
extern unsigned long last_brk;
+extern abi_ulong mmap_next_start;
void mmap_lock(void);
void mmap_unlock(void);
abi_ulong mmap_find_vma(abi_ulong, abi_ulong);

View File

@ -1,31 +0,0 @@
From 9a860d428d123648b31780c238eacf9e606f7ff2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 12 Mar 2012 14:46:06 +0100
Subject: [PATCH] XXX fix prov/self/maps major/minor to read/write hex
---
linux-user/syscall.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index cbd37f6..f064484 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4861,7 +4861,7 @@ static int open_self_maps(void *cpu_env, int fd)
uint64_t min, max, offset;
char flag_r, flag_w, flag_x, flag_p;
char path[512] = "";
- fields = sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %d:%d %d"
+ fields = sscanf(line, "%"PRIx64"-%"PRIx64" %c%c%c%c %"PRIx64" %x:%x %d"
" %512s", &min, &max, &flag_r, &flag_w, &flag_x,
&flag_p, &offset, &dev_maj, &dev_min, &inode, path);
@@ -4873,7 +4873,7 @@ static int open_self_maps(void *cpu_env, int fd)
}
if (h2g_valid(min) && h2g_valid(max)) {
dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx " %c%c%c%c %08" PRIx64
- " %02d:%02d %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
+ " %02x:%02x %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
flag_x, flag_p, offset, dev_maj, dev_min, inode,
path[0] ? " " : "", path);
}

View File

@ -1,26 +0,0 @@
From 4f9265c70768aa4ad8bd13ad744a1a93ed536877 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 12 Mar 2012 16:04:21 +0100
Subject: [PATCH] XXX linux-user: /proc/self/maps: fix compile for ppc64abi32
---
linux-user/syscall.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index f064484..980f815 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4872,9 +4872,9 @@ static int open_self_maps(void *cpu_env, int fd)
continue;
}
if (h2g_valid(min) && h2g_valid(max)) {
- dprintf(fd, TARGET_FMT_lx "-" TARGET_FMT_lx " %c%c%c%c %08" PRIx64
- " %02x:%02x %d%s%s\n", h2g(min), h2g(max), flag_r, flag_w,
- flag_x, flag_p, offset, dev_maj, dev_min, inode,
+ dprintf(fd, TARGET_ABI_FMT_lx "-" TARGET_ABI_FMT_lx " %c%c%c%c %08"
+ PRIx64 " %02x:%02x %d%s%s\n", h2g(min), h2g(max), flag_r,
+ flag_w, flag_x, flag_p, offset, dev_maj, dev_min, inode,
path[0] ? " " : "", path);
}
}

View File

@ -1,21 +0,0 @@
From 9c1b7992362862c2b1f5721664154ddab46acb6f Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 May 2012 23:56:03 +0200
Subject: [PATCH] XXX fix syntax error in qemu-binfmt
---
scripts/qemu-binfmt-conf.sh | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index c20fb61..37d03f3 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -66,6 +66,7 @@ fi
if [ $cpu != "sh" ] ; then
echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P' > /proc/sys/fs/binfmt_misc/register
echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P' > /proc/sys/fs/binfmt_misc/register
+fi
if [ $cpu != "s390x" ] ; then
echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x-binfmt:P' > /proc/sys/fs/binfmt_misc/register
fi

View File

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

3
qemu-1.1-rc1.tar.gz Normal file
View File

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

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
Sun May 13 15:39:12 UTC 2012 - afaerber@suse.de
- Update to v1.1-rc1: see http://wiki.qemu.org/ChangeLog/1.1
* Add workaround for 11.4: add -lrt after -lglib-2.0
- Adapt update_git.sh script to new tag
-------------------------------------------------------------------
Tue May 8 00:15:18 UTC 2012 - afaerber@suse.de
- Update to v1.1-rc0; see http://wiki.qemu.org/ChangeLog/1.1
* Do not try to mv qemu, the executable is gone, there's a dir now
* Do not try to mv */qemu-*, there's a pc-bios/qemu-icon.bmp
* Be more specific in temporary copying of files to dynamic/
* Drop duplicate %_bindir/qemu_binfmt_misc.sh, only in sbin now
* Use dynamic version of new executable qemu-bridge-helper
- Update update_git.sh script to pull patches from suse-1.1 branch
-------------------------------------------------------------------
Mon May 7 19:49:40 UTC 2012 - afaerber@suse.de
- Update URL to project homepage
-------------------------------------------------------------------
Mon May 7 10:01:52 UTC 2012 - agraf@suse.com

130
qemu.spec
View File

@ -17,64 +17,32 @@
Name: qemu
Url: http://fabrice.bellard.free.fr/qemu/
Url: http://www.qemu.org/
Summary: Universal CPU emulator
License: BSD-3-Clause ; GPL-2.0+ ; LGPL-2.1+ ; MIT
Group: System/Emulators/PC
Version: 1.0.1
Version: 1.1rc1
Release: 0
Source: %name-%version.tar.bz2
Source: %name-1.1-rc1.tar.gz
Patch0001: 0001-Handle-CPU-interrupts-by-inline-che.patch
Patch0002: 0002-linux-user-fix-QEMU_STRACE-1-segfau.patch
Patch0003: 0003-linux-user-save-auxv-length.patch.patch
Patch0004: 0004-linux-user-add-open-hijack-infrastr.patch
Patch0005: 0005-linux-user-fake-proc-self-maps.patc.patch
Patch0006: 0006-linux-user-fake-proc-self-stat.patc.patch
Patch0007: 0007-linux-user-fake-proc-self-auxv.patc.patch
Patch0008: 0008-XXX-dont-dump-core-on-sigabort.patc.patch
Patch0009: 0009-linux-user-fix-wait-syscall-status-.patch
Patch0010: 0010-Revert-linux-user-fix-wait-syscall-.patch
Patch0011: 0011-linux-user-fix-wait-syscall-status-.patch
Patch0012: 0012-XXX-linux-user-fake-proc-self-maps-.patch
Patch0013: 0013-XXX-work-around-SA_RESTART-race-wit.patch
Patch0014: 0014-XXX-move-qemu-binary-lower-in-addre.patch
Patch0015: 0015-linux-user-map-lower-in-address-spa.patch
Patch0016: 0016-XXX-fake-proc-self-maps-also-fclose.patch
Patch0017: 0017-XXX-map-qemu-higher-again-so-we-hav.patch
Patch0018: 0018-qemu-0.9.0.cvs-binfmt.patch.patch
Patch0019: 0019-qemu-cvs-alsa_bitfield.patch.patch
Patch0020: 0020-qemu-cvs-alsa_ioctl.patch.patch
Patch0021: 0021-qemu-cvs-alsa_mmap.patch.patch
Patch0022: 0022-qemu-cvs-gettimeofday.patch.patch
Patch0023: 0023-qemu-cvs-ioctl_debug.patch.patch
Patch0024: 0024-qemu-cvs-ioctl_nodirection.patch.patch
Patch0025: 0025-qemu-img-vmdk-scsi.patch.patch
Patch0026: 0026-qemu-nonvoid_return.patch.patch
Patch0027: 0027-fix-mipsn32-linux-user-builds.patch.patch
Patch0028: 0028-Integrating-Dynamips-and-GNS3-UDP-t.patch
Patch0029: 0029-linux-user-add-binfmt-wrapper-for-a.patch
Patch0030: 0030-linux-user-Ignore-timer_create-sysc.patch
Patch0031: 0031-linux-user-be-silent-about-capget-f.patch
Patch0032: 0032-linux-user-reserve-4GB-of-vmem-for-.patch
Patch0033: 0033-PPC-KVM-Disable-mmu-notifier-check..patch
Patch0034: 0034-linux-user-improve-fake-proc-self-s.patch
Patch0035: 0035-linux-user-target_argv-is-placed-on.patch
Patch0036: 0036-PPC-KVM-Ignore-SET_ONE_REG-failures.patch
Patch0037: 0037-PPC-KVM-Ignore-ENABLE_PAPR-to-suppo.patch
Patch0038: 0038-linux-user-fix-segfault-deadlock.pa.patch
Patch0039: 0039-linux-user-implement-device-mapper-.patch
Patch0040: 0040-linux-user-add-struct-old_dev_t-com.patch
Patch0041: 0041-linux-user-fix-BLK-ioctl-arguments..patch
Patch0042: 0042-linux-user-add-BLKSSZGET-ioctl-wrap.patch
Patch0043: 0043-linux-user-Add-ioctl-for-BLKBSZGET..patch
Patch0044: 0044-linux-user-take-RESERVED_VA-into-ac.patch
Patch0045: 0045-linux-user-binfmt-support-host-bina.patch
Patch0046: 0046-linux-user-fix-fallocate.patch.patch
Patch0047: 0047-linux-user-resolve-reserved_va-vma-.patch
Patch0048: 0048-XXX-fix-prov-self-maps-major-minor-.patch
Patch0049: 0049-XXX-linux-user-proc-self-maps-fix-c.patch
Patch0050: 0050-XXX-fix-syntax-error-in-qemu-binfmt.patch
Patch0051: 0051-linux-user-Fix-stale-tbs-after-mmap.patch
Patch0002: 0002-XXX-dont-dump-core-on-sigabort.patc.patch
Patch0003: 0003-XXX-work-around-SA_RESTART-race-wit.patch
Patch0004: 0004-qemu-0.9.0.cvs-binfmt.patch.patch
Patch0005: 0005-qemu-cvs-alsa_bitfield.patch.patch
Patch0006: 0006-qemu-cvs-alsa_ioctl.patch.patch
Patch0007: 0007-qemu-cvs-alsa_mmap.patch.patch
Patch0008: 0008-qemu-cvs-gettimeofday.patch.patch
Patch0009: 0009-qemu-cvs-ioctl_debug.patch.patch
Patch0010: 0010-qemu-cvs-ioctl_nodirection.patch.patch
Patch0011: 0011-qemu-img-vmdk-scsi.patch.patch
Patch0012: 0012-configure-Enable-mipsn32-linux-user.patch
Patch0013: 0013-linux-user-add-binfmt-wrapper-for-a.patch
Patch0014: 0014-linux-user-Ignore-timer_create-sysc.patch
Patch0015: 0015-linux-user-be-silent-about-capget-f.patch
Patch0016: 0016-PPC-KVM-Disable-mmu-notifier-check..patch
Patch0017: 0017-linux-user-fix-segfault-deadlock.pa.patch
Patch0018: 0018-linux-user-binfmt-support-host-bina.patch
Patch0019: 0019-linux-user-Fix-stale-tbs-after-mmap.patch
# this is to make lint happy
Source300: rpmlintrc
Source400: update_git.sh
@ -104,6 +72,9 @@ BuildRequires: libfdt1-devel
%if 0%{?suse_version} >= 1140
BuildRequires: glib2-devel-static
%endif
%if 0%{?suse_version} >= 1220
BuildRequires: pcre-devel-static
%endif
%if 0%{?suse_version} >= 1130
%ifarch %ix86 x86_64
BuildRequires: libspice-server-devel
@ -141,7 +112,7 @@ emulations. This can be used together with the OBS build script to
run cross architectures builds
%prep
%setup -q
%setup -q -n qemu-1.1-rc1
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
@ -161,38 +132,6 @@ run cross architectures builds
%patch0017 -p1
%patch0018 -p1
%patch0019 -p1
%patch0020 -p1
%patch0021 -p1
%patch0022 -p1
%patch0023 -p1
%patch0024 -p1
%patch0025 -p1
%patch0026 -p1
%patch0027 -p1
%patch0028 -p1
%patch0029 -p1
%patch0030 -p1
%patch0031 -p1
%patch0032 -p1
%patch0033 -p1
%patch0034 -p1
%patch0035 -p1
%patch0036 -p1
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%build
# build QEMU
@ -218,7 +157,7 @@ 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-io dynamic || true
mv *-softmmu/qemu-system-* qemu-io qemu-bridge-helper dynamic || true
make clean
# build userland emus
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \
@ -227,18 +166,23 @@ make clean
--disable-system \
--static --disable-linux-aio \
--extra-cflags="$QEMU_OPT_FLAGS"
%if 0%{?suse_version} == 1140
# -lrt needs to come after -lglib-2.0 to avoid undefined clock_gettime
sed -i "s/-lglib-2.0/-lglib-2.0 -lrt/" config-host.mak
%endif
make %{?jobs:-j%jobs} V=1
%install
make install DESTDIR=$RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT libexecdir=%_libexecdir
rm -f $RPM_BUILD_ROOT/%_mandir/man1/qemu-img.1
rm -f $RPM_BUILD_ROOT/%_mandir/man8/qemu-nbd.8
rm -fr $RPM_BUILD_ROOT/%_datadir/doc
# otherwise we get: install: omitting directory `dynamic/qemu-palcode'
rm -fr dynamic/qemu-palcode
install -m 755 */qemu-*[^.]? $RPM_BUILD_ROOT/%_bindir
install -m 755 dynamic/qemu-system-* $RPM_BUILD_ROOT/%_bindir
install -m 755 dynamic/qemu-io $RPM_BUILD_ROOT/%_bindir
install -d -m 755 $RPM_BUILD_ROOT/%_sbindir
install -m 755 dynamic/qemu-binfmt-conf.sh $RPM_BUILD_ROOT/%_sbindir
install -m 755 scripts/qemu-binfmt-conf.sh $RPM_BUILD_ROOT/%_sbindir
install -d -m 755 $RPM_BUILD_ROOT/%_libexecdir
install -m 755 dynamic/qemu-bridge-helper $RPM_BUILD_ROOT/%_libexecdir
%ifnarch %ix86 x86_64
ln -sf ../../../emul/ia32-linux $RPM_BUILD_ROOT/usr/share/qemu/qemu-i386
%endif
@ -255,6 +199,7 @@ rm -rf ${RPM_BUILD_ROOT}
%doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html qemu-tech.html
%_bindir/qemu-io
%_bindir/qemu-system-*
%_libexecdir/qemu-bridge-helper
%doc %_mandir/man[18]/qemu*.[18].gz
%_datadir/%name
%ifnarch %ix86 x86_64 ia64
@ -289,7 +234,6 @@ rm -rf ${RPM_BUILD_ROOT}
%_bindir/qemu-unicore32
%_bindir/qemu-x86_64
%_bindir/qemu-*-binfmt
%_bindir/qemu-binfmt-conf.sh
%_sbindir/qemu-binfmt-conf.sh
%changelog

View File

@ -17,13 +17,13 @@
Name: qemu
Url: http://fabrice.bellard.free.fr/qemu/
Url: http://www.qemu.org/
Summary: Universal CPU emulator
License: BSD-3-Clause ; GPL-2.0+ ; LGPL-2.1+ ; MIT
Group: System/Emulators/PC
Version: 1.0.1
Version: 1.1rc1
Release: 0
Source: %name-%version.tar.bz2
Source: %name-1.1-rc1.tar.gz
PATCH_FILES
# this is to make lint happy
Source300: rpmlintrc
@ -54,6 +54,9 @@ BuildRequires: libfdt1-devel
%if 0%{?suse_version} >= 1140
BuildRequires: glib2-devel-static
%endif
%if 0%{?suse_version} >= 1220
BuildRequires: pcre-devel-static
%endif
%if 0%{?suse_version} >= 1130
%ifarch %ix86 x86_64
BuildRequires: libspice-server-devel
@ -91,7 +94,7 @@ emulations. This can be used together with the OBS build script to
run cross architectures builds
%prep
%setup -q
%setup -q -n qemu-1.1-rc1
PATCH_EXEC
%build
@ -118,7 +121,7 @@ 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-io dynamic || true
mv *-softmmu/qemu-system-* qemu-io qemu-bridge-helper dynamic || true
make clean
# build userland emus
./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \
@ -127,18 +130,23 @@ make clean
--disable-system \
--static --disable-linux-aio \
--extra-cflags="$QEMU_OPT_FLAGS"
%if 0%{?suse_version} == 1140
# -lrt needs to come after -lglib-2.0 to avoid undefined clock_gettime
sed -i "s/-lglib-2.0/-lglib-2.0 -lrt/" config-host.mak
%endif
make %{?jobs:-j%jobs} V=1
%install
make install DESTDIR=$RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT libexecdir=%_libexecdir
rm -f $RPM_BUILD_ROOT/%_mandir/man1/qemu-img.1
rm -f $RPM_BUILD_ROOT/%_mandir/man8/qemu-nbd.8
rm -fr $RPM_BUILD_ROOT/%_datadir/doc
# otherwise we get: install: omitting directory `dynamic/qemu-palcode'
rm -fr dynamic/qemu-palcode
install -m 755 */qemu-*[^.]? $RPM_BUILD_ROOT/%_bindir
install -m 755 dynamic/qemu-system-* $RPM_BUILD_ROOT/%_bindir
install -m 755 dynamic/qemu-io $RPM_BUILD_ROOT/%_bindir
install -d -m 755 $RPM_BUILD_ROOT/%_sbindir
install -m 755 dynamic/qemu-binfmt-conf.sh $RPM_BUILD_ROOT/%_sbindir
install -m 755 scripts/qemu-binfmt-conf.sh $RPM_BUILD_ROOT/%_sbindir
install -d -m 755 $RPM_BUILD_ROOT/%_libexecdir
install -m 755 dynamic/qemu-bridge-helper $RPM_BUILD_ROOT/%_libexecdir
%ifnarch %ix86 x86_64
ln -sf ../../../emul/ia32-linux $RPM_BUILD_ROOT/usr/share/qemu/qemu-i386
%endif
@ -155,6 +163,7 @@ rm -rf ${RPM_BUILD_ROOT}
%doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html qemu-tech.html
%_bindir/qemu-io
%_bindir/qemu-system-*
%_libexecdir/qemu-bridge-helper
%doc %_mandir/man[18]/qemu*.[18].gz
%_datadir/%name
%ifnarch %ix86 x86_64 ia64
@ -189,7 +198,6 @@ rm -rf ${RPM_BUILD_ROOT}
%_bindir/qemu-unicore32
%_bindir/qemu-x86_64
%_bindir/qemu-*-binfmt
%_bindir/qemu-binfmt-conf.sh
%_sbindir/qemu-binfmt-conf.sh
%changelog

View File

@ -12,8 +12,8 @@
GIT_TREE=git://repo.or.cz/qemu/agraf.git
GIT_LOCAL_TREE=/suse/agraf/git/qemu
GIT_BRANCH=suse-1.0
GIT_UPSTREAM_TAG=v1.0.1
GIT_BRANCH=suse-1.1
GIT_UPSTREAM_TAG=v1.1-rc1
QEMU_TMP=/dev/shm/qemu-tmp
# clean up