SHA256
1
0
forked from pool/qemu

- update to 1.0 from upstream. for changelogs please see:

- 0.14 -> 0.15: http://wiki.qemu.org/ChangeLog/0.15
  - 0.15 -> 1.0:  http://wiki.qemu.org/ChangeLog/1.0
- the binary "qemu" is now called qemu-system-i386

OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=29
This commit is contained in:
Alexander Graf 2011-12-11 02:42:09 +00:00 committed by Git OBS Bridge
parent 0a351e77e8
commit 71c71b82ae
50 changed files with 1881 additions and 8737 deletions

View File

@ -0,0 +1,212 @@
From 4cc09e9530fb08123594be6c72dfc381df5dcddc 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 01/32] Handle CPU interrupts by inline checking of a flag
Fix the nasty TCG race conditions and crashes by implementing cpu_exit
as setting a flag which is checked at the start of each TB. This is
slightly slower than the attempt to have cpu_exit alter the graph of
TBs, but it doesn't crash if a thread or signal handler calls cpu_exit
while the execution thread is itself modifying the TB graph.
This version of the patch includes command line option "-no-stopflag"
which reverts to the previous racy behaviour. This is intended for
convenience in testing and comparative benchmarking and won't be
in the final patch.
It's probably worth experimenting with whether the flag-testing
code has the branch in a sense which confuses branch-prediction
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 :-)
---
cpu-exec.c | 11 ++++++++++-
exec.c | 14 ++++++++++++--
gen-icount.h | 16 ++++++++++++++++
linux-user/main.c | 8 ++++++++
qemu-options.hx | 9 +++++++++
vl.c | 5 +++++
6 files changed, 60 insertions(+), 3 deletions(-)
diff --git a/cpu-exec.c b/cpu-exec.c
index a9fa608..5f7982f 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -564,7 +564,16 @@ int cpu_exec(CPUState *env)
tc_ptr = tb->tc_ptr;
/* execute the generated code */
next_tb = tcg_qemu_tb_exec(env, tc_ptr);
- if ((next_tb & 3) == 2) {
+ if ((next_tb & 3) == 3) {
+ /* hit stopflag check */
+ tb = (TranslationBlock *)(long)(next_tb & ~3);
+ /* Restore PC. */
+ cpu_pc_from_tb(env, tb);
+ next_tb = 0;
+ env->exit_request = 0;
+ env->exception_index = EXCP_INTERRUPT;
+ cpu_loop_exit(env);
+ } else if ((next_tb & 3) == 2) {
/* Instruction counter expired. */
int insns_left;
tb = (TranslationBlock *)(long)(next_tb & ~3);
diff --git a/exec.c b/exec.c
index 6b92198..6c923f2 100644
--- a/exec.c
+++ b/exec.c
@@ -125,6 +125,8 @@ DEFINE_TLS(CPUState *,cpu_single_env);
1 = Precise instruction counting.
2 = Adaptive rate instruction counting. */
int use_icount = 0;
+/* 1 to do cpu_exit by inline flag check rather than tb link breaking */
+int use_stopflag = 1;
typedef struct PageDesc {
/* list of TBs intersecting this ram page */
@@ -1670,7 +1672,13 @@ static void tcg_handle_interrupt(CPUState *env, int mask)
cpu_abort(env, "Raised interrupt while not in I/O function");
}
} else {
- cpu_unlink_tb(env);
+ // XXX just call cpu_exit ?
+ if (use_stopflag) {
+ // XXX is this OK?
+ env->exit_request = 1;
+ } else {
+ cpu_unlink_tb(env);
+ }
}
}
@@ -1693,7 +1701,9 @@ void cpu_reset_interrupt(CPUState *env, int mask)
void cpu_exit(CPUState *env)
{
env->exit_request = 1;
- cpu_unlink_tb(env);
+ if (!use_stopflag) {
+ cpu_unlink_tb(env);
+ }
}
const CPULogItem cpu_log_items[] = {
diff --git a/gen-icount.h b/gen-icount.h
index 5fb3829..060f814 100644
--- a/gen-icount.h
+++ b/gen-icount.h
@@ -2,13 +2,25 @@
/* Helpers for instruction counting code generation. */
+extern int use_stopflag;
+
static TCGArg *icount_arg;
static int icount_label;
+static int stopflag_label;
static inline void gen_icount_start(void)
{
TCGv_i32 count;
+ if (use_stopflag) {
+ 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_brcondi_i32(TCG_COND_NE, flag, 0, stopflag_label);
+ tcg_temp_free_i32(flag);
+ }
+
if (!use_icount)
return;
@@ -26,6 +38,10 @@ static inline void gen_icount_start(void)
static void gen_icount_end(TranslationBlock *tb, int num_insns)
{
+ if (use_stopflag) {
+ gen_set_label(stopflag_label);
+ tcg_gen_exit_tb((long)tb + 3); // XXX
+ }
if (use_icount) {
*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
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -52,6 +52,7 @@ unsigned long reserved_va;
#endif
static void usage(void);
+extern int use_stopflag;
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)
}
#endif
+static void handle_arg_nostopflag(const char *arg)
+{
+ use_stopflag = 0;
+}
+
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,
"options", "activate log"},
+ {"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
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1112,6 +1112,15 @@ STEXI
Disable HPET support.
ETEXI
+DEF("no-stopflag", 0, QEMU_OPTION_no_stopflag,
+ "-no-stopflag use old behaviour, not inline stopflag checks\n", QEMU_ARCH_ALL)
+STEXI
+@item -no-stopflag
+@findex -no-stopflag
+Implement cpu-exit by the old tb link breaking method rather than inline checks
+(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"
diff --git a/vl.c b/vl.c
index a50842b..7fdd80f 100644
--- a/vl.c
+++ b/vl.c
@@ -174,6 +174,8 @@ int main(int argc, char **argv)
#define MAX_VIRTIO_CONSOLES 1
+extern int use_stopflag;
+
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;
break;
+ case QEMU_OPTION_no_stopflag:
+ use_stopflag = 0;
+ break;
case QEMU_OPTION_acpitable:
do_acpitable_option(optarg);
break;
--
1.6.0.2

View File

@ -1,34 +0,0 @@
From 4af9300d36f0975213b0fb967131629ad6b4c550 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:17:39 +0200
Subject: [PATCH 01/17] qemu-0.7.0-amd64
No clue why this is necessary or useful, nothing found in any changelogs.
---
x86_64.ld | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
Index: qemu-0.14.1/x86_64.ld
===================================================================
--- qemu-0.14.1.orig/x86_64.ld
+++ qemu-0.14.1/x86_64.ld
@@ -70,8 +70,6 @@ SECTIONS
.rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) }
.rodata1 : { *(.rodata1) }
.eh_frame_hdr : { *(.eh_frame_hdr) }
- .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RO { *(.gcc_except_table) }
/* Adjust the address for the data segment. We want to adjust up to
the same address within the page on the next page up. */
. = ALIGN (0x100000) - ((0x100000 - .) & (0x100000 - 1)); . = DATA_SEGMENT_ALIGN (0x100000, 0x1000);
@@ -97,8 +95,8 @@ SECTIONS
.data1 : { *(.data1) }
.tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
.tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
- .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
- .gcc_except_table : ONLY_IF_RW { *(.gcc_except_table) }
+ .eh_frame : { KEEP (*(.eh_frame)) }
+ .gcc_except_table : { *(.gcc_except_table) }
.dynamic : { *(.dynamic) }
.ctors :
{

View File

@ -0,0 +1,88 @@
From 0588bc446fd48bdb1965a6773d008c05a4ba16c1 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 20 Nov 2011 13:02:54 +0100
Subject: [PATCH 02/32] 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));
}
--
1.6.0.2

View File

@ -0,0 +1,88 @@
From 67c12998086c44ebef7f92a394154d6aba446178 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:22 +0000
Subject: [PATCH 03/32] 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;
--
1.6.0.2

View File

@ -0,0 +1,88 @@
From 99590488e94b6b7f10ecf9a99398fd24a69a7039 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:23 +0000
Subject: [PATCH 04/32] 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)
--
1.6.0.2

View File

@ -0,0 +1,53 @@
From 059e727a9a4be00de949769105e9e0ea876fc64b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:24 +0000
Subject: [PATCH 05/32] 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 }
};
--
1.6.0.2

View File

@ -0,0 +1,64 @@
From 7ee3fd47eed19e4dfa26a8d0176ed3550b8d0ccf Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:25 +0000
Subject: [PATCH 06/32] 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 }
};
--
1.6.0.2

View File

@ -0,0 +1,68 @@
From ddf0d4037b10c07d9e5b168f9f96e60a1601c75b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Wed, 2 Nov 2011 09:23:26 +0000
Subject: [PATCH 07/32] 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 }
};
--
1.6.0.2

View File

@ -0,0 +1,36 @@
From 4bc96d88f91417aa2bb029da2e8343456fe86631 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 21 Nov 2011 23:50:36 +0100
Subject: [PATCH 08/32] XXX dont dump core on sigabort
---
linux-user/signal.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 78e3380..cfa92b9 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -373,6 +373,10 @@ static void QEMU_NORETURN force_sig(int target_sig)
host_sig = target_to_host_signal(target_sig);
gdb_signalled(thread_env, target_sig);
+ if (target_sig == 6) {
+ goto no_core;
+ }
+
/* dump core if supported by target binary format */
if (core_dump_signal(target_sig) && (ts->bprm->core_dump != NULL)) {
stop_all_tasks();
@@ -390,6 +394,8 @@ static void QEMU_NORETURN force_sig(int target_sig)
target_sig, strsignal(host_sig), "core dumped" );
}
+no_core:
+
/* The proper exit code for dying from an uncaught signal is
* -<signal>. The kernel doesn't allow exit() or _exit() to pass
* a negative value. To get the proper exit code we need to
--
1.6.0.2

View File

@ -0,0 +1,55 @@
From ee5137d38109fdcb55a58be447c2c27be2b16eb0 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 22 Nov 2011 17:53:40 +0100
Subject: [PATCH 09/32] 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) {
--
1.6.0.2

View File

@ -1,56 +0,0 @@
From 026ee1029cfeb6c802ee715372992fb3c847bd27 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:30:16 +0200
Subject: [PATCH 09/17] qemu-cvs-sched_getaffinity
Implements sched_getaffinity syscall.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b51634b..81bf1f0 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -164,6 +164,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
}
+#define __NR_sys_sched_getaffinity __NR_sched_getaffinity
#define __NR_sys_uname __NR_uname
#define __NR_sys_faccessat __NR_faccessat
#define __NR_sys_fchmodat __NR_fchmodat
@@ -223,6 +224,9 @@ _syscall3(int,sys_tgkill,int,tgid,int,pid,int,sig)
#if defined(TARGET_NR_tkill) && defined(__NR_tkill)
_syscall2(int,sys_tkill,int,tid,int,sig)
#endif
+#ifdef __NR_sys_sched_getaffinity
+_syscall3(int,sys_sched_getaffinity,pid_t,pid,unsigned int,cpusetsize,void*,mask)
+#endif
#ifdef __NR_exit_group
_syscall1(int,exit_group,int,error_code)
#endif
@@ -7505,6 +7509,18 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
break;
#endif
#endif
+
+#ifdef TARGET_NR_sched_getaffinity
+ case TARGET_NR_sched_getaffinity:
+ {
+ cpu_set_t *mask;
+ lock_user_struct(VERIFY_READ, mask, arg3, 1);
+ ret = get_errno(sys_sched_getaffinity((pid_t)arg1, (unsigned int)arg2, mask));
+ unlock_user_struct(mask, arg3, 0);
+ break;
+ }
+#endif
+
default:
unimplemented:
gemu_log("qemu: Unsupported syscall: %d\n", num);
--
1.7.1

View File

@ -0,0 +1,39 @@
From 5cfce885dd1b3a229cd2ea7a94dfe2445ec29417 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 24 Nov 2011 00:38:22 +0100
Subject: [PATCH 10/32] 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) {
--
1.6.0.2

View File

@ -1,74 +0,0 @@
From: Alexander Graf <agraf@suse.de>
When executing 32-bit guest binaries on 64-bit hosts, mmap() can return
a 64-bit pointer. Tell mmap() to always map in 32-bit address space, so
we make 32-bit guest applications happy.
This is a hack and should not go upstream in its current form!
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/mmap.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 994c02b..e24b63a 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -169,7 +169,7 @@ static int mmap_frag(abi_ulong real_start,
if (prot1 == 0) {
/* no page was there, so we allocate one */
void *p = mmap(host_start, qemu_host_page_size, prot,
- flags | MAP_ANONYMOUS, -1, 0);
+ flags | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (p == MAP_FAILED)
return -1;
prot1 = prot;
@@ -292,7 +292,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
* - shmat() with SHM_REMAP flag
*/
ptr = mmap(g2h(addr), size, PROT_NONE,
- MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
+ MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE|MAP_32BIT, -1, 0);
/* ENOMEM, if host address space has no memory */
if (ptr == MAP_FAILED) {
@@ -454,14 +454,14 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
especially important if qemu_host_page_size >
qemu_real_host_page_size */
p = mmap(g2h(mmap_start),
- host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
+ host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (p == MAP_FAILED)
goto fail;
/* update start so that it points to the file position at 'offset' */
host_start = (unsigned long)p;
if (!(flags & MAP_ANONYMOUS)) {
p = mmap(g2h(mmap_start), len, prot,
- flags | MAP_FIXED, fd, host_offset);
+ flags | MAP_FIXED | MAP_32BIT, fd, host_offset);
host_start += offset - host_offset;
}
start = h2g(host_start);
@@ -547,7 +547,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
else
offset1 = offset + real_start - start;
p = mmap(g2h(real_start), real_end - real_start,
- prot, flags, fd, offset1);
+ prot, flags | MAP_32BIT, fd, offset1);
if (p == MAP_FAILED)
goto fail;
}
@@ -603,7 +603,7 @@ static void mmap_reserve(abi_ulong start, abi_ulong size)
}
if (real_start != real_end) {
mmap(g2h(real_start), real_end - real_start, PROT_NONE,
- MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE,
+ MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE | MAP_32BIT,
-1, 0);
}
}
--
1.6.0.2

View File

@ -0,0 +1,58 @@
From b71ee7a063f7cffdf8a2cf73fcbc1d461fbbb80e Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 24 Nov 2011 00:39:35 +0100
Subject: [PATCH 11/32] 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;
--
1.6.0.2

View File

@ -0,0 +1,124 @@
From 52a4e3af8ca37d895bcff2ede1073ebb2cb2dd29 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sat, 19 Nov 2011 22:57:55 +0100
Subject: [PATCH 12/32] linux-user: Fix 32-on-64 mmap for x86_64
When running a 32 bit guest on a 64 bit host, we can run into trouble while
calling the host's mmap() because it could potentially give us a 64 bit
return value which the guest can't interpret.
There are 2 ways of dealing with this:
1) Only do MAP_FIXED mmap calls and implement our own vm management in QEMU
2) Tell the kernel that we only want mappings in the lower 32 bits
Way 1 is very involved and hard to do. It's been advocated forever now but
nobody sat down to actually implement it.
Way 2 is easy. It's what this patch does. However, it only works on x86_64
because that's the only platform implementing the MAP_32BIT flag. Since most
people are on x86_64 though, I think it's a good enough compromise for now
though
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/mmap.c | 35 ++++++++++++++++++++++++++---------
1 files changed, 26 insertions(+), 9 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 994c02b..7d846f3 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -33,6 +33,22 @@
//#define DEBUG_MMAP
+/*
+ * On x86_64 we can tell mmap that we only want to map within the first 32
+ * bits to not get pointers that potentially exceed the return size. Without
+ * this flag set mmap will eventually break for users when running 32-on-64.
+ *
+ * However, Linux doesn't implement this for non-x86_64 systems. So we have
+ * to safeguard the bit with an empty flag which will be ignore on other
+ * architectures. At least we fixed the "common case" this way :).
+ *
+ * - agraf
+ */
+#if !defined(MAP_32BIT) || !defined(__x86_64__) || (TARGET_LONG_BITS != 32)
+#undef MAP_32BIT
+#define MAP_32BIT 0
+#endif
+
#if defined(CONFIG_USE_NPTL)
static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
static __thread int mmap_lock_count;
@@ -169,7 +185,7 @@ static int mmap_frag(abi_ulong real_start,
if (prot1 == 0) {
/* no page was there, so we allocate one */
void *p = mmap(host_start, qemu_host_page_size, prot,
- flags | MAP_ANONYMOUS, -1, 0);
+ flags | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
if (p == MAP_FAILED)
return -1;
prot1 = prot;
@@ -292,7 +308,7 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
* - shmat() with SHM_REMAP flag
*/
ptr = mmap(g2h(addr), size, PROT_NONE,
- MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE, -1, 0);
+ MAP_ANONYMOUS|MAP_PRIVATE|MAP_NORESERVE|MAP_32BIT, -1, 0);
/* ENOMEM, if host address space has no memory */
if (ptr == MAP_FAILED) {
@@ -454,14 +470,15 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
especially important if qemu_host_page_size >
qemu_real_host_page_size */
p = mmap(g2h(mmap_start),
- host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
+ host_len, prot, flags | MAP_FIXED | MAP_ANONYMOUS | MAP_32BIT,
+ -1, 0);
if (p == MAP_FAILED)
goto fail;
/* update start so that it points to the file position at 'offset' */
host_start = (unsigned long)p;
if (!(flags & MAP_ANONYMOUS)) {
p = mmap(g2h(mmap_start), len, prot,
- flags | MAP_FIXED, fd, host_offset);
+ flags | MAP_FIXED | MAP_32BIT, fd, host_offset);
host_start += offset - host_offset;
}
start = h2g(host_start);
@@ -495,8 +512,8 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
goto fail;
}
retaddr = target_mmap(start, len, prot | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS,
- -1, 0);
+ MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS |
+ MAP_32BIT, -1, 0);
if (retaddr == -1)
goto fail;
if (pread(fd, g2h(start), len, offset) == -1)
@@ -547,7 +564,7 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
else
offset1 = offset + real_start - start;
p = mmap(g2h(real_start), real_end - real_start,
- prot, flags, fd, offset1);
+ prot, flags | MAP_32BIT, fd, offset1);
if (p == MAP_FAILED)
goto fail;
}
@@ -603,8 +620,8 @@ static void mmap_reserve(abi_ulong start, abi_ulong size)
}
if (real_start != real_end) {
mmap(g2h(real_start), real_end - real_start, PROT_NONE,
- MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE,
- -1, 0);
+ MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE |
+ MAP_32BIT, -1, 0);
}
}
--
1.6.0.2

View File

@ -0,0 +1,69 @@
From 7e9ebc1d459247bd91f39a7489f1627874731533 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 28 Nov 2011 17:05:24 +0100
Subject: [PATCH 13/32] 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;
}
--
1.6.0.2

View File

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

View File

@ -0,0 +1,247 @@
From e45be60a8f2e6148b40f358922a4f472fa0b2f8b Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 1 Dec 2011 19:00:01 +0100
Subject: [PATCH 14/32] XXX work around SA_RESTART race with boehm-gc (ARM only)
---
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(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 1cd8eb7..788ff98 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -818,15 +818,22 @@ void cpu_loop(CPUARMState *env)
break;
}
} else {
- env->regs[0] = do_syscall(env,
- n,
- env->regs[0],
- env->regs[1],
- env->regs[2],
- env->regs[3],
- env->regs[4],
- env->regs[5],
- 0, 0);
+ TaskState *ts = ((CPUState*)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],
+ env->regs[5], 0, 0);
+ if ((r == -EINTR) && ts->signal_restart &&
+ syscall_restartable(n)) {
+ if (env->thumb) {
+ env->regs[15] -= 2;
+ } else {
+ env->regs[15] -= 4;
+ }
+ } else {
+ env->regs[0] = r;
+ }
+ ts->signal_restart = 0;
}
} else {
goto error;
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index ef08d39..aa06acf 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -136,6 +136,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 */
+ int signal_in_syscall; /* non zero if we are in do_syscall() */
+ int signal_restart; /* non zero if we need to restart a syscall */
} __attribute__((aligned(16))) TaskState;
extern char *exec_path;
@@ -202,6 +204,7 @@ char *target_strerror(int err);
int get_osversion(void);
void fork_start(void);
void fork_end(int child);
+int syscall_restartable(int syscall_nr);
/* 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
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -25,6 +25,7 @@
#include <assert.h>
#include <sys/ucontext.h>
#include <sys/resource.h>
+#include <sched.h>
#include "qemu.h"
#include "qemu-common.h"
@@ -481,6 +482,11 @@ int queue_signal(CPUState *env, int sig, target_siginfo_t *info)
k->pending = 1;
/* signal that a new signal is pending */
ts->signal_pending = 1;
+ /* check if we have to restart the current syscall */
+ if ((sigact_table[sig - 1].sa_flags & SA_RESTART) &&
+ ts->signal_in_syscall) {
+ ts->signal_restart = 1;
+ }
return 1; /* indicates that the signal was queued */
}
}
@@ -613,8 +619,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;
+#ifdef TARGET_ARM
+ /* Breaks boehm-gc, we have to do this manually */
+ /*
+ * Unfortunately our hacks only work as long as we don't do parallel
+ * signal delivery and futexes, so let's do a dirty hack here to
+ * pin our guest process to a single host CPU if we're using the
+ * boehm-gc.
+ */
+ if ((k->sa_flags & TARGET_SA_RESTART) && host_sig == SIGPWR) {
+ cpu_set_t mask;
+ CPU_ZERO(&mask);
+ CPU_SET(0, &mask);
+ sched_setaffinity(0, sizeof(mask), &mask);
+ }
+#else
if (k->sa_flags & TARGET_SA_RESTART)
act1.sa_flags |= SA_RESTART;
+#endif
/* NOTE: it is important to update the host kernel signal
ignore state to avoid getting unexpected interrupted
syscalls */
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 4af0edb..97c3303 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)
return get_errno(open(path(pathname), flags, mode));
}
+int syscall_restartable(int syscall_nr)
+{
+ switch (syscall_nr) {
+#ifdef TARGET_NR_sigsuspend
+ case TARGET_NR_sigsuspend:
+#endif
+#ifdef TARGET_NR_pause
+ case TARGET_NR_pause:
+#endif
+#ifdef TARGET_NR_setsockopt
+ case TARGET_NR_setsockopt:
+#endif
+#ifdef TARGET_NR_accept
+ case TARGET_NR_accept:
+#endif
+#ifdef TARGET_NR_recv
+ case TARGET_NR_recv:
+#endif
+#ifdef TARGET_NR_recvfrom
+ case TARGET_NR_recvfrom:
+#endif
+#ifdef TARGET_NR_recvmsg
+ case TARGET_NR_recvmsg:
+#endif
+#ifdef TARGET_NR_socketcall
+ case TARGET_NR_socketcall:
+#endif
+#ifdef TARGET_NR_connect
+ case TARGET_NR_connect:
+#endif
+#ifdef TARGET_NR_send
+ case TARGET_NR_send:
+#endif
+#ifdef TARGET_NR_sendmsg
+ case TARGET_NR_sendmsg:
+#endif
+#ifdef TARGET_NR_sendto
+ case TARGET_NR_sendto:
+#endif
+#ifdef TARGET_NR_poll
+ case TARGET_NR_poll:
+#endif
+#ifdef TARGET_NR_ppoll
+ case TARGET_NR_ppoll:
+#endif
+#if defined(TARGET_NR_select)
+ case TARGET_NR_select:
+#endif
+#ifdef TARGET_NR_pselect6
+ case TARGET_NR_pselect6:
+#endif
+#ifdef TARGET_NR__newselect
+ case TARGET_NR__newselect:
+#endif
+#ifdef TARGET_NR_msgrcv
+ case TARGET_NR_msgrcv:
+#endif
+#ifdef TARGET_NR_msgsnd
+ case TARGET_NR_msgsnd:
+#endif
+#ifdef TARGET_NR_semop
+ case TARGET_NR_semop:
+#endif
+#ifdef TARGET_NR_ipc
+ case TARGET_NR_ipc:
+#endif
+#ifdef TARGET_NR_clock_nanosleep
+ case TARGET_NR_clock_nanosleep:
+#endif
+ case TARGET_NR_rt_sigsuspend:
+ case TARGET_NR_rt_sigtimedwait:
+ case TARGET_NR_nanosleep:
+ case TARGET_NR_close:
+ /* can not be restarted */
+ return 0;
+ }
+
+ /* every other syscall can be restarted */
+ return 1;
+}
+
/* 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,
struct stat st;
struct statfs stfs;
void *p;
+ TaskState *ts = ((CPUState*)cpu_env)->opaque;
+
+ if (!ts->signal_restart) {
+ /* remember syscall info for restart */
+ ts->signal_in_syscall = 1;
+ }
#ifdef DEBUG
gemu_log("syscall %d", num);
@@ -7679,8 +7766,10 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#endif
cmd = target_to_host_fcntl_cmd(arg2);
- if (cmd == -TARGET_EINVAL)
- return cmd;
+ if (cmd == -TARGET_EINVAL) {
+ ret = cmd;
+ goto fail;
+ }
switch(arg2) {
case TARGET_F_GETLK64:
@@ -8312,6 +8401,7 @@ fail:
#endif
if(do_strace)
print_syscall_ret(num, ret);
+ ts->signal_in_syscall = 0;
return ret;
efault:
ret = -TARGET_EFAULT;
--
1.6.0.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
From bf5ca70551e87671e84a81d103db32ed6918a109 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Mon, 5 Dec 2011 23:37:52 +0100
Subject: [PATCH 15/32] 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) }
--
1.6.0.2

View File

@ -0,0 +1,34 @@
From a8631179ca4a90670923fd9acce05b0e109eae01 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 6 Dec 2011 00:39:50 +0100
Subject: [PATCH 16/32] 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 7d846f3..8453c0d 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -226,7 +226,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;
--
1.6.0.2

View File

@ -1,126 +0,0 @@
From 024f781ab4af31ba5e14882b5661d4586ae26988 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 9 Feb 2011 18:35:21 +0100
Subject: [PATCH 17/17] S/390 build fix
---
target-s390x/op_helper.c | 22 +++++++++++-----------
target-s390x/translate.c | 2 +-
2 files changed, 12 insertions(+), 12 deletions(-)
Index: qemu-0.14.1/target-s390x/op_helper.c
===================================================================
--- qemu-0.14.1.orig/target-s390x/op_helper.c
+++ qemu-0.14.1/target-s390x/op_helper.c
@@ -738,7 +738,7 @@ uint32_t HELPER(tmxx)(uint64_t val, uint
uint32_t HELPER(abs_i32)(uint32_t reg, int32_t val)
{
uint32_t cc;
- if (val == 0x80000000UL) cc = 3;
+ if ((uint32_t)val == 0x80000000UL) cc = 3;
else if (val) cc = 1;
else cc = 0;
@@ -996,7 +996,7 @@ uint32_t HELPER(slbg)(uint32_t cc, uint3
/* condition codes for binary FP ops */
static uint32_t set_cc_f32(float32 v1, float32 v2)
{
- if (float32_is_nan(v1) || float32_is_nan(v2)) return 3;
+ if (float32_is_any_nan(v1) || float32_is_any_nan(v2)) return 3;
else if (float32_eq(v1, v2, &env->fpu_status)) return 0;
else if (float32_lt(v1, v2, &env->fpu_status)) return 1;
else return 2;
@@ -1004,7 +1004,7 @@ static uint32_t set_cc_f32(float32 v1, f
static uint32_t set_cc_f64(float64 v1, float64 v2)
{
- if (float64_is_nan(v1) || float64_is_nan(v2)) return 3;
+ if (float64_is_any_nan(v1) || float64_is_any_nan(v2)) return 3;
else if (float64_eq(v1, v2, &env->fpu_status)) return 0;
else if (float64_lt(v1, v2, &env->fpu_status)) return 1;
else return 2;
@@ -1013,7 +1013,7 @@ static uint32_t set_cc_f64(float64 v1, f
/* condition codes for unary FP ops */
static uint32_t set_cc_nz_f32(float32 v)
{
- if (float32_is_nan(v)) return 3;
+ if (float32_is_any_nan(v)) return 3;
else if (float32_is_zero(v)) return 0;
else if (float32_is_neg(v)) return 1;
else return 2;
@@ -1021,7 +1021,7 @@ static uint32_t set_cc_nz_f32(float32 v)
static uint32_t set_cc_nz_f64(float64 v)
{
- if (float64_is_nan(v)) return 3;
+ if (float64_is_any_nan(v)) return 3;
else if (float64_is_zero(v)) return 0;
else if (float64_is_neg(v)) return 1;
else return 2;
@@ -1029,7 +1029,7 @@ static uint32_t set_cc_nz_f64(float64 v)
static uint32_t set_cc_nz_f128(float128 v)
{
- if (float128_is_nan(v)) return 3;
+ if (float128_is_any_nan(v)) return 3;
else if (float128_is_zero(v)) return 0;
else if (float128_is_neg(v)) return 1;
else return 2;
@@ -1350,7 +1350,7 @@ uint32_t HELPER(cxbr)(uint32_t f1, uint3
CPU_QuadU v2;
v2.ll.upper = env->fregs[f2].ll;
v2.ll.lower = env->fregs[f2 + 2].ll;
- if (float128_is_nan(v1.q) || float128_is_nan(v2.q)) return 3;
+ if (float128_is_any_nan(v1.q) || float128_is_any_nan(v2.q)) return 3;
else if (float128_eq(v1.q, v2.q, &env->fpu_status)) return 0;
else if (float128_lt(v1.q, v2.q, &env->fpu_status)) return 1;
else return 2;
@@ -1463,7 +1463,7 @@ uint32_t HELPER(cgxbr)(uint32_t r1, uint
v2.ll.lower = env->fregs[f2 + 2].ll;
set_round_mode(m3);
env->regs[r1] = float128_to_int64(v2.q, &env->fpu_status);
- if (float128_is_nan(v2.q)) return 3;
+ if (float128_is_any_nan(v2.q)) return 3;
else if (float128_is_zero(v2.q)) return 0;
else if (float128_is_neg(v2.q)) return 1;
else return 2;
@@ -1611,7 +1611,7 @@ uint32_t HELPER(tceb)(uint32_t f1, uint6
HELPER_LOG("%s: v1 0x%lx m2 0x%lx neg %d\n", __FUNCTION__, v1, m2, neg);
if (float32_is_zero(v1) && (m2 & (1 << (11-neg)))) cc = 1;
else if (float32_is_infinity(v1) && (m2 & (1 << (5-neg)))) cc = 1;
- else if (float32_is_nan(v1) && (m2 & (1 << (3-neg)))) cc = 1;
+ else if (float32_is_quiet_nan(v1) && (m2 & (1 << (3-neg)))) cc = 1;
else if (float32_is_signaling_nan(v1) && (m2 & (1 << (1-neg)))) cc = 1;
else /* assume normalized number */ if (m2 & (1 << (9-neg))) cc = 1;
/* FIXME: denormalized? */
@@ -1627,7 +1627,7 @@ uint32_t HELPER(tcdb)(uint32_t f1, uint6
HELPER_LOG("%s: v1 0x%lx m2 0x%lx neg %d\n", __FUNCTION__, v1, m2, neg);
if (float64_is_zero(v1) && (m2 & (1 << (11-neg)))) cc = 1;
else if (float64_is_infinity(v1) && (m2 & (1 << (5-neg)))) cc = 1;
- else if (float64_is_nan(v1) && (m2 & (1 << (3-neg)))) cc = 1;
+ else if (float64_is_quiet_nan(v1) && (m2 & (1 << (3-neg)))) cc = 1;
else if (float64_is_signaling_nan(v1) && (m2 & (1 << (1-neg)))) cc = 1;
else /* assume normalized number */ if (m2 & (1 << (9-neg))) cc = 1;
/* FIXME: denormalized? */
@@ -1645,7 +1645,7 @@ uint32_t HELPER(tcxb)(uint32_t f1, uint6
int neg = float128_is_neg(v1.q);
if (float128_is_zero(v1.q) && (m2 & (1 << (11-neg)))) cc = 1;
else if (float128_is_infinity(v1.q) && (m2 & (1 << (5-neg)))) cc = 1;
- else if (float128_is_nan(v1.q) && (m2 & (1 << (3-neg)))) cc = 1;
+ else if (float128_is_quiet_nan(v1.q) && (m2 & (1 << (3-neg)))) cc = 1;
else if (float128_is_signaling_nan(v1.q) && (m2 & (1 << (1-neg)))) cc = 1;
else /* assume normalized number */ if (m2 & (1 << (9-neg))) cc = 1;
/* FIXME: denormalized? */
Index: qemu-0.14.1/target-s390x/translate.c
===================================================================
--- qemu-0.14.1.orig/target-s390x/translate.c
+++ qemu-0.14.1/target-s390x/translate.c
@@ -67,7 +67,7 @@ void cpu_dump_state(CPUState *env, FILE
}
}
for (i = 0; i < 16; i++) {
- cpu_fprintf(f, "F%02d=%016lx", i, (long)env->fregs[i].i);
+ cpu_fprintf(f, "F%02d=%016lx", i, (long)env->fregs[i].ll);
if ((i % 4) == 3) {
cpu_fprintf(f, "\n");
} else {

View File

@ -0,0 +1,24 @@
From f2bd85fd0ebe444677f22e28ab12b966937207e2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Thu, 8 Dec 2011 23:19:32 +0100
Subject: [PATCH 17/32] 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",
--
1.6.0.2

View File

@ -0,0 +1,39 @@
From f8d469421d92e3abe854e565bdf4ee62b86846b6 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sat, 10 Dec 2011 00:03:56 +0100
Subject: [PATCH 18/32] 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 8453c0d..1e8cc38 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -226,7 +226,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) }
--
1.6.0.2

View File

@ -1,52 +0,0 @@
From 39c6bee3d5023a3e339bafd8073bc2c920cd79c5 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 25 Sep 2011 06:21:28 +0200
Subject: [PATCH] linux-user: fix openat
When running openat using qemu-arm, we stumbled over invalid permissions
on the created files. The reason for this is that the mode parameter gets
treates as an O_... flag, which it isn't - it's a permission bitmask.
This patch removes the needless translation of the mode parameter,
rendering permission passing of openat() to work with linux-user.
Reported-by: Dirk Mueller <dmueller@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 14 +-------------
1 files changed, 1 insertions(+), 13 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 6b73769..27970a4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -376,25 +376,13 @@ static int sys_mknodat(int dirfd, const char *pathname, mode_t mode,
}
#endif
#ifdef TARGET_NR_openat
-static int sys_openat(int dirfd, const char *pathname, int flags, ...)
+static int sys_openat(int dirfd, const char *pathname, int flags, mode_t mode)
{
/*
* open(2) has extra parameter 'mode' when called with
* flag O_CREAT.
*/
if ((flags & O_CREAT) != 0) {
- va_list ap;
- mode_t mode;
-
- /*
- * Get the 'mode' parameter and translate it to
- * host bits.
- */
- va_start(ap, flags);
- mode = va_arg(ap, mode_t);
- mode = target_to_host_bitmask(mode, fcntl_flags_tbl);
- va_end(ap);
-
return (openat(dirfd, pathname, flags, mode));
}
return (openat(dirfd, pathname, flags));
--
1.6.0.2

View File

@ -1,7 +1,7 @@
From 8f16efecc00d3ee4615dcd2d5381b23df4465698 Mon Sep 17 00:00:00 2001
From 4d016e72b0d6b81115100217614aba990fcb505e Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:18:44 +0200
Subject: [PATCH 02/17] qemu-0.9.0.cvs-binfmt
Subject: [PATCH 19/32] qemu-0.9.0.cvs-binfmt
Fixes binfmt_misc setup script:
- x86_64 is i386-compatible
@ -10,14 +10,14 @@ Fixes binfmt_misc setup script:
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
scripts/qemu-binfmt-conf.sh | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
scripts/qemu-binfmt-conf.sh | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index c50beb7..335ab05 100644
index 83a44d8..d0fe4e1 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -27,40 +27,43 @@ case "$cpu" in
@@ -27,42 +27,45 @@ case "$cpu" in
armv[4-9]*)
cpu="arm"
;;
@ -54,7 +54,7 @@ index c50beb7..335ab05 100644
if [ $cpu != "m68k" ] ; then
echo 'Please check cpu value and header information for m68k!'
- echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
+ echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
+ echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "mips" ] ; then
# FIXME: We could use the other endianness on a MIPS host.
@ -76,7 +76,10 @@ index c50beb7..335ab05 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
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
fi
--
1.7.1
1.6.0.2

View File

@ -1,40 +0,0 @@
From: Alexander Graf <agraf@suse.de>
For OBS, we're running a full cross-guest inside of a VM. When a build
is done there, we reboot the guest as shutdown mechanism.
Unfortunately, reboot is not implemented in linux-user. So this mechanism
fails, spilling unpretty warnings. This patch implements sys_reboot()
emulation.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
Index: qemu-0.14.1/linux-user/syscall.c
===================================================================
--- qemu-0.14.1.orig/linux-user/syscall.c
+++ qemu-0.14.1/linux-user/syscall.c
@@ -239,6 +239,8 @@ _syscall6(int,sys_futex,int *,uaddr,int,
const struct timespec *,timeout,int *,uaddr2,int,val3)
#endif
#endif
+_syscall4(int, reboot, int, magic1, int, magic2, unsigned int, cmd,
+ void *, arg);
static bitmask_transtbl fcntl_flags_tbl[] = {
{ TARGET_O_ACCMODE, TARGET_O_WRONLY, O_ACCMODE, O_WRONLY, },
@@ -5536,7 +5538,11 @@ abi_long do_syscall(void *cpu_env, int n
break;
#endif
case TARGET_NR_reboot:
- goto unimplemented;
+ if (!(p = lock_user_string(arg4)))
+ goto efault;
+ ret = reboot(arg1, arg2, arg3, p);
+ unlock_user(p, arg4, 0);
+ break;
#ifdef TARGET_NR_readdir
case TARGET_NR_readdir:
goto unimplemented;

View File

@ -1,10 +1,11 @@
From 8a88b86cc9a3ad0bb6da52fb0f938fe5a085c027 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
From 923b1531de681940198e2c1d28c735da1efe29e2 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:20:50 +0200
Subject: [PATCH 03/17] qemu-cvs-alsa_bitfield
Subject: [PATCH 20/32] qemu-cvs-alsa_bitfield
Implements TYPE_INTBITFIELD partially. (required for ALSA support)
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
thunk.c | 21 +++++++++++++++++++++
@ -12,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..5638b2c 100644
index 0657188..34bc7d1 100644
--- a/thunk.c
+++ b/thunk.c
@@ -41,6 +41,7 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr)
@ -29,7 +30,7 @@ index 0657188..5638b2c 100644
break;
+ case TYPE_INTBITFIELD:
+#if defined(TARGET_I386) && defined(__powerpc__)
+ /* powerpc uses the MSB, whereas i386 uses the LSB
+ /* powerpc uses the MSB, whereas i386 uses the LSB
+ * to store the first bit in a field */
+ {
+ unsigned char byte = *(uint8_t *)src;
@ -79,5 +80,5 @@ index 109c541..55890f3 100644
case TYPE_LONGLONG:
case TYPE_ULONGLONG:
--
1.7.1
1.6.0.2

View File

@ -1,117 +0,0 @@
From agraf@suse.de Thu, 29 Sep 2011 11:00:25 +0200
Return-Path: <agraf@suse.de>
Received: from imap.suse.de ([unix socket])
by imap-int (Cyrus v2.2.12) with LMTPA;
Thu, 29 Sep 2011 11:07:10 +0200
X-Sieve: CMU Sieve 2.2
Received: from relay2.suse.de (relay2.suse.de [149.44.160.134])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "relay.suse.de", Issuer "CAcert Class 3 Root" (verified OK))
by imap.suse.de (Postfix) with ESMTPS id AF8563C539A9
for <adrian@imap.suse.de>; Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
Received: by relay2.suse.de (Postfix)
id A639118552E6; Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
Received: from imap.suse.de (loadbalancer1.suse.de [149.44.160.248])
(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
(No client certificate requested)
by relay2.suse.de (Postfix) with ESMTPS id A573518552E1;
Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
Received: from localhost.localdomain (charybdis-ext.suse.de [195.135.221.2])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client did not present a certificate)
by imap.suse.de (Postfix) with ESMTPSA id 7AD993C539A9;
Thu, 29 Sep 2011 11:07:10 +0200 (CEST)
From: Alexander Graf <agraf@suse.de>
To: adrian@suse.de
Cc: Peter Maydell <peter.maydell@linaro.org>, Riku Voipio <riku.voipio@linaro.org>
Subject: [PATCH] linux-user: Implement prlimit64 syscall
Date: Thu, 29 Sep 2011 11:00:25 +0200
Message-Id: <1317286825-2033-1-git-send-email-agraf@suse.de>
X-Mailer: git-send-email 1.6.0.2
From: Peter Maydell <peter.maydell@linaro.org>
Implement the prlimit64 syscall.
Slightly modified to apply upstream -Riku
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Index: qemu-0.14.1/linux-user/syscall.c
===================================================================
--- qemu-0.14.1.orig/linux-user/syscall.c
+++ qemu-0.14.1/linux-user/syscall.c
@@ -524,6 +524,21 @@ static int sys_inotify_init1(int flags)
#endif /* CONFIG_INOTIFY */
+#if defined(TARGET_NR_prlimit64)
+#ifndef __NR_prlimit64
+# define __NR_prlimit64 -1
+#endif
+#define __NR_sys_prlimit64 __NR_prlimit64
+/* The glibc rlimit structure may not be that used by the underlying syscall */
+struct host_rlimit64 {
+ uint64_t rlim_cur;
+ uint64_t rlim_max;
+};
+_syscall4(int, sys_prlimit64, pid_t, pid, int, resource,
+ const struct host_rlimit64 *, new_limit,
+ struct host_rlimit64 *, old_limit)
+#endif
+
extern int personality(int);
extern int flock(int, int);
extern int setfsuid(int);
@@ -7620,6 +7635,34 @@ abi_long do_syscall(void *cpu_env, int n
break;
}
#endif
+#ifdef TARGET_NR_prlimit64
+ case TARGET_NR_prlimit64:
+ {
+ /* args: pid, resource number, ptr to new rlimit, ptr to old rlimit */
+ struct target_rlimit64 *target_rnew, *target_rold;
+ struct host_rlimit64 rnew, rold, *rnewp = 0;
+ if (arg3) {
+ if (!lock_user_struct(VERIFY_READ, target_rnew, arg3, 1)) {
+ goto efault;
+ }
+ rnew.rlim_cur = tswap64(target_rnew->rlim_cur);
+ rnew.rlim_max = tswap64(target_rnew->rlim_max);
+ unlock_user_struct(target_rnew, arg3, 0);
+ rnewp = &rnew;
+ }
+
+ ret = get_errno(sys_prlimit64(arg1, arg2, rnewp, arg4 ? &rold : 0));
+ if (!is_error(ret) && arg4) {
+ if (!lock_user_struct(VERIFY_WRITE, target_rold, arg4, 1)) {
+ goto efault;
+ }
+ target_rold->rlim_cur = tswap64(rold.rlim_cur);
+ target_rold->rlim_max = tswap64(rold.rlim_max);
+ unlock_user_struct(target_rold, arg4, 1);
+ }
+ break;
+ }
+#endif
default:
unimplemented:
Index: qemu-0.14.1/linux-user/syscall_defs.h
===================================================================
--- qemu-0.14.1.orig/linux-user/syscall_defs.h
+++ qemu-0.14.1/linux-user/syscall_defs.h
@@ -2237,6 +2237,11 @@ struct target_mq_attr {
abi_long mq_curmsgs;
};
+struct target_rlimit64 {
+ uint64_t rlim_cur;
+ uint64_t rlim_max;
+};
+
#include "socket.h"
#include "errno_defs.h"

View File

@ -1,28 +1,29 @@
From c5b614579d85877cfa39dfea8989040e43f9ba56 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
From b732ecf6a05f837368ab6c2413b206e0e2715e73 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:23:27 +0200
Subject: [PATCH 04/17] qemu-cvs-alsa_ioctl
Subject: [PATCH 21/32] qemu-cvs-alsa_ioctl
Implements ALSA ioctls on PPC hosts.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/ioctls.h | 5 +
linux-user/ioctls_alsa.h | 467 ++++++++++
linux-user/ioctls_alsa_structs.h | 1740 ++++++++++++++++++++++++++++++++++++++
linux-user/syscall_defs.h | 1 +
linux-user/syscall_defs.h | 2 +
linux-user/syscall_types.h | 5 +
linux-user/syscall_types_alsa.h | 1337 +++++++++++++++++++++++++++++
6 files changed, 3555 insertions(+), 0 deletions(-)
6 files changed, 3556 insertions(+), 0 deletions(-)
create mode 100644 linux-user/ioctls_alsa.h
create mode 100644 linux-user/ioctls_alsa_structs.h
create mode 100644 linux-user/syscall_types_alsa.h
diff --git a/linux-user/ioctls.h b/linux-user/ioctls.h
index acff781..13ff54f 100644
index 6514502..224dbc6 100644
--- a/linux-user/ioctls.h
+++ b/linux-user/ioctls.h
@@ -308,6 +308,11 @@
@@ -314,6 +314,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)))
@ -509,7 +510,7 @@ index 0000000..c2aa542
+IOCTL( SND_SSCAPE_LOAD_MCODE , IOC_W, MK_PTR(MK_STRUCT(STRUCT_sscape_microcode)) )
diff --git a/linux-user/ioctls_alsa_structs.h b/linux-user/ioctls_alsa_structs.h
new file mode 100644
index 0000000..3de8614
index 0000000..e09a30d
--- /dev/null
+++ b/linux-user/ioctls_alsa_structs.h
@@ -0,0 +1,1740 @@
@ -629,7 +630,7 @@ index 0000000..3de8614
+ unsigned char vibrato_depth;
+ unsigned short scale_frequency;
+ unsigned short scale_factor; /* 0-2048 or 0-2 */
+
+
+ struct gf1_wave *next;
+} gf1_wave_t;
+
@ -674,12 +675,12 @@ index 0000000..3de8614
+ __u8 vibrato_rate;
+ __u8 vibrato_depth;
+ __u16 scale_frequency;
+ __u16 scale_factor; /* 0-2048 or 0-2 */
+ __u16 scale_factor; /* 0-2048 or 0-2 */
+} gf1_xwave_t;
+
+typedef struct gf1_xinstrument {
+ __u32 stype;
+
+
+ __u16 exclusion;
+ __u16 exclusion_group; /* 0 - none, 1-65535 */
+
@ -717,7 +718,7 @@ index 0000000..3de8614
+ unsigned char low_note; /* lower frequency range for this waveform */
+ unsigned char high_note; /* higher frequency range for this waveform */
+ unsigned char pad;
+
+
+ struct iwffff_wave *next;
+} iwffff_wave_t;
+
@ -749,8 +750,8 @@ index 0000000..3de8614
+
+typedef struct iwffff_env {
+ unsigned char flags;
+ unsigned char mode;
+ unsigned char index;
+ unsigned char mode;
+ unsigned char index;
+ unsigned char pad;
+ struct iwffff_env_record *record;
+} iwffff_env_t;
@ -758,7 +759,7 @@ index 0000000..3de8614
+typedef struct iwffff_layer {
+ unsigned char flags;
+ unsigned char velocity_mode;
+ unsigned char layer_event;
+ unsigned char layer_event;
+ unsigned char low_range; /* range for layer based */
+ unsigned char high_range; /* on either velocity or frequency */
+ unsigned char pan; /* pan offset from CC1 (0 left - 127 right) */
@ -837,8 +838,8 @@ index 0000000..3de8614
+
+typedef struct iwffff_xenv {
+ __u8 flags;
+ __u8 mode;
+ __u8 index;
+ __u8 mode;
+ __u8 index;
+ __u8 pad;
+} iwffff_xenv_t;
+
@ -846,7 +847,7 @@ index 0000000..3de8614
+ __u32 stype;
+ __u8 flags;
+ __u8 velocity_mode;
+ __u8 layer_event;
+ __u8 layer_event;
+ __u8 low_range; /* range for layer based */
+ __u8 high_range; /* on either velocity or frequency */
+ __u8 pan; /* pan offset from CC1 (0 left - 127 right) */
@ -863,7 +864,7 @@ index 0000000..3de8614
+
+typedef struct iwffff_xinstrument {
+ __u32 stype;
+
+
+ __u16 exclusion;
+ __u16 layer_type;
+ __u16 exclusion_group; /* 0 - none, 1-65535 */
@ -936,7 +937,7 @@ index 0000000..3de8614
+ __u32 loop_start; /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
+ __u32 loop_end; /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
+ __u16 loop_repeat; /* loop repeat - 0 = forever */
+
+
+ __u8 effect1; /* effect 1 */
+ __u8 effect1_depth; /* 0-127 */
+ __u8 effect2; /* effect 2 */
@ -1111,7 +1112,7 @@ index 0000000..3de8614
+ sndrv_seq_event_type_t type; /* event type */
+ unsigned char flags; /* event flags */
+ char tag;
+
+
+ unsigned char queue; /* schedule queue */
+ union sndrv_seq_timestamp time; /* schedule time */
+
@ -1169,7 +1170,7 @@ index 0000000..3de8614
+ USER_CLIENT = 1,
+ KERNEL_CLIENT = 2
+};
+
+
+struct sndrv_seq_client_info {
+ int client; /* client number to inquire */
+ int type; /* client type */
@ -1332,7 +1333,7 @@ index 0000000..3de8614
+};
+
+struct sndrv_seq_instr_format_info {
+ char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
+ char format[16]; /* format identifier - SNDRV_SEQ_INSTR_ID_* */
+ unsigned int len; /* max data length (without this structure) */
+};
+
@ -1460,7 +1461,7 @@ index 0000000..3de8614
+ SNDRV_HWDEP_IFACE_VX, /* Digigram VX cards */
+ SNDRV_HWDEP_IFACE_MIXART, /* Digigram miXart cards */
+ SNDRV_HWDEP_IFACE_USX2Y, /* Tascam US122, US224 & US428 usb */
+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
+ SNDRV_HWDEP_IFACE_EMUX_WAVETABLE, /* EmuX wavetable */
+ SNDRV_HWDEP_IFACE_BLUETOOTH, /* Bluetooth audio */
+ SNDRV_HWDEP_IFACE_USX2Y_PCM, /* Tascam US122, US224 & US428 rawusb pcm */
+ SNDRV_HWDEP_IFACE_PCXHR, /* Digigram PCXHR */
@ -1680,7 +1681,7 @@ index 0000000..3de8614
+
+struct sndrv_pcm_hw_params {
+ unsigned int flags;
+ struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
+ struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
+ SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
+ struct sndrv_mask mres[5]; /* reserved masks */
+ struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
@ -2076,7 +2077,7 @@ index 0000000..3de8614
+ int iface; /* interface identifier */
+ unsigned int device; /* device/client number */
+ unsigned int subdevice; /* subdevice (substream) number */
+ unsigned char name[44]; /* ASCII name of item */
+ unsigned char name[44]; /* ASCII name of item */
+ unsigned int index; /* index of item */
+} emu10k1_ctl_elem_id_t;
+
@ -2180,7 +2181,7 @@ index 0000000..3de8614
+ unsigned char clock_source;
+ unsigned char autosync_ref;
+ unsigned char line_out;
+ unsigned char passthru;
+ unsigned char passthru;
+ unsigned char da_gain;
+ unsigned char ad_gain;
+ unsigned char phone_gain;
@ -2254,16 +2255,17 @@ index 0000000..3de8614
+ unsigned char *code;
+};
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
index d02a9bf..be612ce 100644
index 9dd1b8e..f0acc72 100644
--- a/linux-user/syscall_defs.h
+++ b/linux-user/syscall_defs.h
@@ -2205,3 +2205,4 @@ struct target_mq_attr {
#define FUTEX_CLOCK_REALTIME 256
#define FUTEX_CMD_MASK ~(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME)
@@ -2336,3 +2336,5 @@ struct target_rlimit64 {
uint64_t rlim_cur;
uint64_t rlim_max;
};
+
+#include "ioctls_alsa_structs.h"
diff --git a/linux-user/syscall_types.h b/linux-user/syscall_types.h
index 0e67cd8..635fdef 100644
index c370125..8fde25c 100644
--- a/linux-user/syscall_types.h
+++ b/linux-user/syscall_types.h
@@ -80,6 +80,11 @@ STRUCT(count_info,
@ -2280,7 +2282,7 @@ index 0e67cd8..635fdef 100644
TYPE_INT, /* lo_number */
diff --git a/linux-user/syscall_types_alsa.h b/linux-user/syscall_types_alsa.h
new file mode 100644
index 0000000..6dbc964
index 0000000..a0ae752
--- /dev/null
+++ b/linux-user/syscall_types_alsa.h
@@ -0,0 +1,1337 @@
@ -2400,7 +2402,7 @@ index 0000000..6dbc964
+ TYPE_CHAR,
+ TYPE_SHORT,
+ TYPE_SHORT, /* 0-2048 or 0-2 */
+
+
+ TYPE_PTRVOID
+)
+
@ -2445,12 +2447,12 @@ index 0000000..6dbc964
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_SHORT,
+ TYPE_SHORT /* 0-2048 or 0-2 */
+ TYPE_SHORT /* 0-2048 or 0-2 */
+)
+
+STRUCT( gf1_xinstrument,
+ TYPE_INT,
+
+
+ TYPE_SHORT,
+ TYPE_SHORT, /* 0 - none, 1-65535 */
+
@ -2486,7 +2488,7 @@ index 0000000..6dbc964
+ TYPE_CHAR, /* lower frequency range for this waveform */
+ TYPE_CHAR, /* higher frequency range for this waveform */
+ TYPE_CHAR,
+
+
+ TYPE_PTRVOID
+)
+
@ -2516,8 +2518,8 @@ index 0000000..6dbc964
+
+STRUCT( iwffff_env,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_PTRVOID // MK_STRUCT(STRUCT_iwffff_env_record)
+)
@ -2525,7 +2527,7 @@ index 0000000..6dbc964
+STRUCT( iwffff_layer,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR, /* range for layer based */
+ TYPE_CHAR, /* on either velocity or frequency */
+ TYPE_CHAR, /* pan offset from CC1 (0 left - 127 right) */
@ -2602,8 +2604,8 @@ index 0000000..6dbc964
+
+STRUCT( iwffff_xenv,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR
+)
+
@ -2611,7 +2613,7 @@ index 0000000..6dbc964
+ TYPE_INT,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR, /* range for layer based */
+ TYPE_CHAR, /* on either velocity or frequency */
+ TYPE_CHAR, /* pan offset from CC1 (0 left - 127 right) */
@ -2628,7 +2630,7 @@ index 0000000..6dbc964
+
+STRUCT( iwffff_xinstrument,
+ TYPE_INT,
+
+
+ TYPE_SHORT,
+ TYPE_SHORT,
+ TYPE_SHORT, /* 0 - none, 1-65535 */
@ -2699,7 +2701,7 @@ index 0000000..6dbc964
+ TYPE_INT, /* bits loop start offset in samples * 16 (lowest 4 bits - fraction) */
+ TYPE_INT, /* loop start offset in samples * 16 (lowest 4 bits - fraction) */
+ TYPE_SHORT, /* loop repeat - 0 = forever */
+
+
+ TYPE_CHAR, /* effect 1 */
+ TYPE_CHAR, /* 0-127 */
+ TYPE_CHAR, /* effect 2 */
@ -2788,8 +2790,8 @@ index 0000000..6dbc964
+
+STRUCT( sndrv_seq_ev_sample_control,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR, /* pad */
+ MK_ARRAY(TYPE_INT, 2)
+)
@ -2837,7 +2839,7 @@ index 0000000..6dbc964
+ TYPE_CHAR, /* event type */
+ TYPE_CHAR, /* event flags */
+ TYPE_CHAR,
+
+
+ TYPE_CHAR, /* schedule queue */
+ MK_STRUCT(STRUCT_sndrv_seq_real_time), /* schedule time */
+
@ -3031,7 +3033,7 @@ index 0000000..6dbc964
+)
+
+STRUCT( sndrv_seq_instr_format_info,
+ MK_ARRAY(TYPE_CHAR, 16), /* format identifier - SNDRV_SEQ_INSTR_ID_* */
+ MK_ARRAY(TYPE_CHAR, 16), /* format identifier - SNDRV_SEQ_INSTR_ID_* */
+ TYPE_INT /* max data length (without this structure) */
+)
+
@ -3170,7 +3172,7 @@ index 0000000..6dbc964
+ TYPE_INT,
+ TYPE_INT,
+ MK_ARRAY(TYPE_INT, 4),
+
+
+ MK_ARRAY(TYPE_CHAR, 64) /* reserved for future... */
+)
+
@ -3254,7 +3256,7 @@ index 0000000..6dbc964
+ // FIXME: does not work with 64-bit target
+ MK_STRUCT(STRUCT_sndrv_pcm_mmap_status), // 28 bytes on 32-bit target
+ MK_ARRAY(TYPE_CHAR, 64 - 24), // so we pad to 64 bytes (was a union)
+
+
+ MK_STRUCT(STRUCT_sndrv_pcm_mmap_control), // 8 bytes on 32-bit target
+ MK_ARRAY(TYPE_CHAR, 64 - 8) // so we pad to 64 bytes (was a union))
+)
@ -3461,7 +3463,7 @@ index 0000000..6dbc964
+ TYPE_INT, /* interface identifier */
+ TYPE_INT, /* device/client number */
+ TYPE_INT, /* subdevice (substream) number */
+ MK_ARRAY(TYPE_CHAR, 44), /* ASCII name of item */
+ MK_ARRAY(TYPE_CHAR, 44), /* ASCII name of item */
+ TYPE_INT /* index of item */
+)
+
@ -3557,7 +3559,7 @@ index 0000000..6dbc964
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
+ TYPE_CHAR,
@ -3622,5 +3624,5 @@ index 0000000..6dbc964
+)
+
--
1.7.1
1.6.0.2

View File

@ -1,34 +0,0 @@
From: Alexander Graf <agraf@suse.de>
fixes some SMP races
---
cpu-all.h | 2 +-
exec.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: qemu-0.14.1/cpu-all.h
===================================================================
--- qemu-0.14.1.orig/cpu-all.h
+++ qemu-0.14.1/cpu-all.h
@@ -775,7 +775,7 @@ void cpu_dump_statistics(CPUState *env,
void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
extern CPUState *first_cpu;
-extern CPUState *cpu_single_env;
+extern __thread CPUState *cpu_single_env;
#define CPU_INTERRUPT_HARD 0x02 /* hardware interrupt pending */
#define CPU_INTERRUPT_EXITTB 0x04 /* exit the current TB (use for x86 a20 case) */
Index: qemu-0.14.1/exec.c
===================================================================
--- qemu-0.14.1.orig/exec.c
+++ qemu-0.14.1/exec.c
@@ -112,7 +112,7 @@ RAMList ram_list = { .blocks = QLIST_HEA
CPUState *first_cpu;
/* current CPU in the current thread. It is only valid inside
cpu_exec() */
-CPUState *cpu_single_env;
+__thread CPUState *cpu_single_env;
/* 0 = Do not count executed instructions.
1 = Precise instruction counting.
2 = Adaptive rate instruction counting. */

View File

@ -1,20 +1,21 @@
From 3848cba4ed22ebef70e59cbb542e71a37fe74d1d Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
From 3ea2fa480d730990c427d4a2924168f2b6f42dba Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:24:15 +0200
Subject: [PATCH 05/17] qemu-cvs-alsa_mmap
Subject: [PATCH 22/32] qemu-cvs-alsa_mmap
Hack to prevent ALSA from using mmap() interface to simplify emulation.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/mmap.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index abf21f6..e18c228 100644
index 1e8cc38..1e5ba51 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -360,6 +360,9 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
@@ -380,6 +380,9 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong size)
}
}
@ -24,12 +25,12 @@ index abf21f6..e18c228 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)
@@ -395,6 +398,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
@@ -415,6 +418,17 @@ abi_long target_mmap(abi_ulong start, abi_ulong len, int prot,
}
#endif
+ /* Alsa tries to communcate with the kernel via mmap. This usually
+ * is a good idea when user- and kernelspace are running on the
+ * is a good idea when user- and kernelspace are running on the
+ * same architecture but does not work out when not. To make alsa
+ * not to use mmap, we can just have it fail on the mmap calls that
+ * would initiate this.
@ -43,5 +44,5 @@ index abf21f6..e18c228 100644
errno = EINVAL;
goto fail;
--
1.7.1
1.6.0.2

View File

@ -1,7 +1,7 @@
From da6cdca6cdbfccb4936f5df5e297a87fe1e4baa8 Mon Sep 17 00:00:00 2001
From 2c1ea2bd2c59d70ca63c1d42230588b4bdeed6fd Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:25:41 +0200
Subject: [PATCH 06/17] qemu-cvs-gettimeofday
Subject: [PATCH 23/32] qemu-cvs-gettimeofday
No clue what this is for.
---
@ -9,18 +9,18 @@ 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 499c4d7..92f2aa6 100644
index 9fabcba..cd120a4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5399,6 +5399,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
@@ -5901,6 +5901,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
case TARGET_NR_gettimeofday:
{
struct timeval tv;
+ if(copy_from_user_timeval(&tv, arg1))
+ goto efault;
+ goto efault;
ret = get_errno(gettimeofday(&tv, NULL));
if (!is_error(ret)) {
if (copy_to_user_timeval(arg1, &tv))
--
1.7.1
1.6.0.2

View File

@ -1,460 +0,0 @@
From bf858897b76926b56e948dbe7a1a491b68dccda7 Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@twiddle.net>
Date: Tue, 27 Jul 2010 17:25:38 +0000
Subject: linux-user: Re-use load_elf_image for the main binary.
This requires moving the PT_INTERP extraction and GUEST_BASE
handling into load_elf_image. Key this off a non-null pointer
argument to receive the interpreter name.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 0a3d084..a53285a 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -829,9 +829,6 @@ struct exec
#define ZMAGIC 0413
#define QMAGIC 0314
-/* max code+data+bss+brk space allocated to ET_DYN executables */
-#define ET_DYN_MAP_SIZE (128 * 1024 * 1024)
-
/* Necessary parameters */
#define TARGET_ELF_EXEC_PAGESIZE TARGET_PAGE_SIZE
#define TARGET_ELF_PAGESTART(_v) ((_v) & ~(unsigned long)(TARGET_ELF_EXEC_PAGESIZE-1))
@@ -1169,7 +1166,7 @@ static abi_ulong create_elf_tables(abi_ulong p, int argc, int envc,
On return: INFO values will be filled in, as necessary or available. */
static void load_elf_image(const char *image_name, int image_fd,
- struct image_info *info,
+ struct image_info *info, char **pinterp_name,
char bprm_buf[BPRM_BUF_SIZE])
{
struct elfhdr *ehdr = (struct elfhdr *)bprm_buf;
@@ -1229,6 +1226,67 @@ static void load_elf_image(const char *image_name, int image_fd,
if (load_addr == -1) {
goto exit_perror;
}
+ } else if (pinterp_name != NULL) {
+ /* This is the main executable. Make sure that the low
+ address does not conflict with MMAP_MIN_ADDR or the
+ QEMU application itself. */
+#if defined(CONFIG_USE_GUEST_BASE)
+ /*
+ * In case where user has not explicitly set the guest_base, we
+ * probe here that should we set it automatically.
+ */
+ if (!have_guest_base && !reserved_va) {
+ unsigned long host_start, real_start, host_size;
+
+ /* Round addresses to page boundaries. */
+ loaddr &= qemu_host_page_mask;
+ hiaddr = HOST_PAGE_ALIGN(hiaddr);
+
+ if (loaddr < mmap_min_addr) {
+ host_start = HOST_PAGE_ALIGN(mmap_min_addr);
+ } else {
+ host_start = loaddr;
+ if (host_start != loaddr) {
+ errmsg = "Address overflow loading ELF binary";
+ goto exit_errmsg;
+ }
+ }
+ host_size = hiaddr - loaddr;
+ while (1) {
+ /* Do not use mmap_find_vma here because that is limited to the
+ guest address space. We are going to make the
+ guest address space fit whatever we're given. */
+ real_start = (unsigned long)
+ mmap((void *)host_start, host_size, PROT_NONE,
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
+ if (real_start == (unsigned long)-1) {
+ goto exit_perror;
+ }
+ if (real_start == host_start) {
+ break;
+ }
+ /* That address didn't work. Unmap and try a different one.
+ The address the host picked because is typically right at
+ the top of the host address space and leaves the guest with
+ no usable address space. Resort to a linear search. We
+ already compensated for mmap_min_addr, so this should not
+ happen often. Probably means we got unlucky and host
+ address space randomization put a shared library somewhere
+ inconvenient. */
+ munmap((void *)real_start, host_size);
+ host_start += qemu_host_page_size;
+ if (host_start == loaddr) {
+ /* Theoretically possible if host doesn't have any suitably
+ aligned areas. Normally the first mmap will fail. */
+ errmsg = "Unable to find space for application";
+ goto exit_errmsg;
+ }
+ }
+ qemu_log("Relocating guest address space from 0x"
+ TARGET_ABI_FMT_lx " to 0x%lx\n", loaddr, real_start);
+ guest_base = real_start - loaddr;
+ }
+#endif
}
load_bias = load_addr - loaddr;
@@ -1290,6 +1348,33 @@ static void load_elf_image(const char *image_name, int image_fd,
info->brk = vaddr_em;
}
}
+ } else if (eppnt->p_type == PT_INTERP && pinterp_name) {
+ char *interp_name;
+
+ if (*pinterp_name) {
+ errmsg = "Multiple PT_INTERP entries";
+ goto exit_errmsg;
+ }
+ interp_name = malloc(eppnt->p_filesz);
+ if (!interp_name) {
+ goto exit_perror;
+ }
+
+ if (eppnt->p_offset + eppnt->p_filesz <= BPRM_BUF_SIZE) {
+ memcpy(interp_name, bprm_buf + eppnt->p_offset,
+ eppnt->p_filesz);
+ } else {
+ retval = pread(image_fd, interp_name, eppnt->p_filesz,
+ eppnt->p_offset);
+ if (retval != eppnt->p_filesz) {
+ goto exit_perror;
+ }
+ }
+ if (interp_name[eppnt->p_filesz - 1] != 0) {
+ errmsg = "Invalid PT_INTERP entry";
+ goto exit_errmsg;
+ }
+ *pinterp_name = interp_name;
}
}
@@ -1336,7 +1421,7 @@ static void load_elf_interp(const char *filename, struct image_info *info,
memset(bprm_buf + retval, 0, BPRM_BUF_SIZE - retval);
}
- load_elf_image(filename, fd, info, bprm_buf);
+ load_elf_image(filename, fd, info, NULL, bprm_buf);
return;
exit_perror:
@@ -1480,291 +1565,31 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
{
struct image_info interp_info;
struct elfhdr elf_ex;
- abi_ulong load_addr, load_bias;
- int load_addr_set = 0;
- int i;
- struct elf_phdr * elf_ppnt;
- struct elf_phdr *elf_phdata;
- abi_ulong k, elf_brk;
- int retval;
char *elf_interpreter = NULL;
- abi_ulong elf_entry;
- int status;
- abi_ulong start_code, end_code, start_data, end_data;
- abi_ulong elf_stack;
- status = 0;
- load_addr = 0;
- load_bias = 0;
- elf_ex = *((struct elfhdr *) bprm->buf); /* exec-header */
+ info->start_mmap = (abi_ulong)ELF_START_MMAP;
+ info->mmap = 0;
+ info->rss = 0;
- /* First of all, some simple consistency checks */
- if (!elf_check_ident(&elf_ex)) {
- return -ENOEXEC;
- }
- bswap_ehdr(&elf_ex);
- if (!elf_check_ehdr(&elf_ex)) {
- return -ENOEXEC;
- }
+ load_elf_image(bprm->filename, bprm->fd, info,
+ &elf_interpreter, bprm->buf);
+
+ /* ??? We need a copy of the elf header for passing to create_elf_tables.
+ If we do nothing, we'll have overwritten this when we re-use bprm->buf
+ when we load the interpreter. */
+ elf_ex = *(struct elfhdr *)bprm->buf;
bprm->p = copy_elf_strings(1, &bprm->filename, bprm->page, bprm->p);
bprm->p = copy_elf_strings(bprm->envc,bprm->envp,bprm->page,bprm->p);
bprm->p = copy_elf_strings(bprm->argc,bprm->argv,bprm->page,bprm->p);
if (!bprm->p) {
- retval = -E2BIG;
- }
-
- /* Now read in all of the header information */
- elf_phdata = (struct elf_phdr *)
- malloc(elf_ex.e_phnum * sizeof(struct elf_phdr));
- if (elf_phdata == NULL) {
- return -ENOMEM;
- }
-
- i = elf_ex.e_phnum * sizeof(struct elf_phdr);
- if (elf_ex.e_phoff + i <= BPRM_BUF_SIZE) {
- memcpy(elf_phdata, bprm->buf + elf_ex.e_phoff, i);
- } else {
- retval = pread(bprm->fd, (char *) elf_phdata, i, elf_ex.e_phoff);
- if (retval != i) {
- perror("load_elf_binary");
- exit(-1);
- }
- }
- bswap_phdr(elf_phdata, elf_ex.e_phnum);
-
- elf_brk = 0;
- elf_stack = ~((abi_ulong)0UL);
- start_code = ~((abi_ulong)0UL);
- end_code = 0;
- start_data = 0;
- end_data = 0;
-
- elf_ppnt = elf_phdata;
- for(i=0;i < elf_ex.e_phnum; i++) {
- if (elf_ppnt->p_type == PT_INTERP) {
- if (elf_ppnt->p_offset + elf_ppnt->p_filesz <= BPRM_BUF_SIZE) {
- elf_interpreter = bprm->buf + elf_ppnt->p_offset;
- } else {
- elf_interpreter = alloca(elf_ppnt->p_filesz);
- retval = pread(bprm->fd, elf_interpreter, elf_ppnt->p_filesz,
- elf_ppnt->p_offset);
- if (retval != elf_ppnt->p_filesz) {
- perror("load_elf_binary");
- exit(-1);
- }
- }
- }
- elf_ppnt++;
- }
-
- /* OK, This is the point of no return */
- info->end_data = 0;
- info->end_code = 0;
- info->start_mmap = (abi_ulong)ELF_START_MMAP;
- info->mmap = 0;
- elf_entry = (abi_ulong) elf_ex.e_entry;
-
-#if defined(CONFIG_USE_GUEST_BASE)
- /*
- * In case where user has not explicitly set the guest_base, we
- * probe here that should we set it automatically.
- */
- if (!(have_guest_base || reserved_va)) {
- /*
- * Go through ELF program header table and find the address
- * range used by loadable segments. Check that this is available on
- * the host, and if not find a suitable value for guest_base. */
- abi_ulong app_start = ~0;
- abi_ulong app_end = 0;
- abi_ulong addr;
- unsigned long host_start;
- unsigned long real_start;
- unsigned long host_size;
- for (i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum;
- i++, elf_ppnt++) {
- if (elf_ppnt->p_type != PT_LOAD)
- continue;
- addr = elf_ppnt->p_vaddr;
- if (addr < app_start) {
- app_start = addr;
- }
- addr += elf_ppnt->p_memsz;
- if (addr > app_end) {
- app_end = addr;
- }
- }
-
- /* If we don't have any loadable segments then something
- is very wrong. */
- assert(app_start < app_end);
-
- /* Round addresses to page boundaries. */
- app_start = app_start & qemu_host_page_mask;
- app_end = HOST_PAGE_ALIGN(app_end);
- if (app_start < mmap_min_addr) {
- host_start = HOST_PAGE_ALIGN(mmap_min_addr);
- } else {
- host_start = app_start;
- if (host_start != app_start) {
- fprintf(stderr, "qemu: Address overflow loading ELF binary\n");
- abort();
- }
- }
- host_size = app_end - app_start;
- while (1) {
- /* Do not use mmap_find_vma here because that is limited to the
- guest address space. We are going to make the
- guest address space fit whatever we're given. */
- real_start = (unsigned long)mmap((void *)host_start, host_size,
- PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
- if (real_start == (unsigned long)-1) {
- fprintf(stderr, "qemu: Virtual memory exausted\n");
- abort();
- }
- if (real_start == host_start) {
- break;
- }
- /* That address didn't work. Unmap and try a different one.
- The address the host picked because is typically
- right at the top of the host address space and leaves the
- guest with no usable address space. Resort to a linear search.
- We already compensated for mmap_min_addr, so this should not
- happen often. Probably means we got unlucky and host address
- space randomization put a shared library somewhere
- inconvenient. */
- munmap((void *)real_start, host_size);
- host_start += qemu_host_page_size;
- if (host_start == app_start) {
- /* Theoretically possible if host doesn't have any
- suitably aligned areas. Normally the first mmap will
- fail. */
- fprintf(stderr, "qemu: Unable to find space for application\n");
- abort();
- }
- }
- qemu_log("Relocating guest address space from 0x" TARGET_ABI_FMT_lx
- " to 0x%lx\n", app_start, real_start);
- guest_base = real_start - app_start;
+ fprintf(stderr, "%s: %s\n", bprm->filename, strerror(E2BIG));
+ exit(-1);
}
-#endif /* CONFIG_USE_GUEST_BASE */
/* Do this so that we can load the interpreter, if need be. We will
change some of these later */
- info->rss = 0;
bprm->p = setup_arg_pages(bprm->p, bprm, info);
- info->start_stack = bprm->p;
-
- /* Now we do a little grungy work by mmaping the ELF image into
- * the correct location in memory. At this point, we assume that
- * the image should be loaded at fixed address, not at a variable
- * address.
- */
-
- for(i = 0, elf_ppnt = elf_phdata; i < elf_ex.e_phnum; i++, elf_ppnt++) {
- int elf_prot = 0;
- int elf_flags = 0;
- abi_ulong error;
-
- if (elf_ppnt->p_type != PT_LOAD)
- continue;
-
- if (elf_ppnt->p_flags & PF_R) elf_prot |= PROT_READ;
- if (elf_ppnt->p_flags & PF_W) elf_prot |= PROT_WRITE;
- if (elf_ppnt->p_flags & PF_X) elf_prot |= PROT_EXEC;
- elf_flags = MAP_PRIVATE | MAP_DENYWRITE;
- if (elf_ex.e_type == ET_EXEC || load_addr_set) {
- elf_flags |= MAP_FIXED;
- } else if (elf_ex.e_type == ET_DYN) {
- /* Try and get dynamic programs out of the way of the default mmap
- base, as well as whatever program they might try to exec. This
- is because the brk will follow the loader, and is not movable. */
- /* NOTE: for qemu, we do a big mmap to get enough space
- without hardcoding any address */
- error = target_mmap(0, ET_DYN_MAP_SIZE,
- PROT_NONE, MAP_PRIVATE | MAP_ANON,
- -1, 0);
- if (error == -1) {
- perror("mmap");
- exit(-1);
- }
- load_bias = TARGET_ELF_PAGESTART(error - elf_ppnt->p_vaddr);
- }
-
- error = target_mmap(TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr),
- (elf_ppnt->p_filesz +
- TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)),
- elf_prot,
- (MAP_FIXED | MAP_PRIVATE | MAP_DENYWRITE),
- bprm->fd,
- (elf_ppnt->p_offset -
- TARGET_ELF_PAGEOFFSET(elf_ppnt->p_vaddr)));
- if (error == -1) {
- perror("mmap");
- exit(-1);
- }
-
-#ifdef LOW_ELF_STACK
- if (TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr) < elf_stack)
- elf_stack = TARGET_ELF_PAGESTART(elf_ppnt->p_vaddr);
-#endif
-
- if (!load_addr_set) {
- load_addr_set = 1;
- load_addr = elf_ppnt->p_vaddr - elf_ppnt->p_offset;
- if (elf_ex.e_type == ET_DYN) {
- load_bias += error -
- TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr);
- load_addr += load_bias;
- }
- }
- k = elf_ppnt->p_vaddr;
- if (k < start_code)
- start_code = k;
- if (start_data < k)
- start_data = k;
- k = elf_ppnt->p_vaddr + elf_ppnt->p_filesz;
- if ((elf_ppnt->p_flags & PF_X) && end_code < k)
- end_code = k;
- if (end_data < k)
- end_data = k;
- k = elf_ppnt->p_vaddr + elf_ppnt->p_memsz;
- if (k > elf_brk) {
- elf_brk = TARGET_PAGE_ALIGN(k);
- }
-
- /* If the load segment requests extra zeros (e.g. bss), map it. */
- if (elf_ppnt->p_filesz < elf_ppnt->p_memsz) {
- abi_ulong base = load_bias + elf_ppnt->p_vaddr;
- zero_bss(base + elf_ppnt->p_filesz,
- base + elf_ppnt->p_memsz, elf_prot);
- }
- }
-
- elf_entry += load_bias;
- elf_brk += load_bias;
- start_code += load_bias;
- end_code += load_bias;
- start_data += load_bias;
- end_data += load_bias;
-
- info->load_bias = load_bias;
- info->load_addr = load_addr;
- info->entry = elf_entry;
- info->start_brk = info->brk = elf_brk;
- info->end_code = end_code;
- info->start_code = start_code;
- info->start_data = start_data;
- info->end_data = end_data;
- info->personality = PER_LINUX;
-
- free(elf_phdata);
-
- if (qemu_log_enabled()) {
- load_symbols(&elf_ex, bprm->fd, load_bias);
- }
-
- close(bprm->fd);
if (elf_interpreter) {
load_elf_interp(elf_interpreter, &interp_info, bprm->buf);
@@ -1796,6 +1621,7 @@ int load_elf_binary(struct linux_binprm * bprm, struct target_pt_regs * regs,
if (elf_interpreter) {
info->load_addr = interp_info.load_addr;
info->entry = interp_info.entry;
+ free(elf_interpreter);
}
#ifdef USE_ELF_CORE_DUMP
--
cgit v0.8.3.4

View File

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

View File

@ -1,385 +0,0 @@
Removed s390x pieces.
commit d979e8eb544da31df78bc76358a73f0d1c823c17
Author: Peter Maydell <peter.maydell@linaro.org>
Date: Mon Jun 27 17:44:51 2011 +0100
linux-user: Add syscall numbers from kernel 2.6.39.2
Add syscall numbers for new syscall numbers; this brings us
into line with Linux 2.6.39.2.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Index: qemu-0.14.1/linux-user/alpha/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/alpha/syscall_nr.h
+++ qemu-0.14.1/linux-user/alpha/syscall_nr.h
@@ -411,6 +411,28 @@
#define TARGET_NR_signalfd 476
#define TARGET_NR_timerfd 477
#define TARGET_NR_eventfd 478
+#define TARGET_NR_recvmmsg 479
+#define TARGET_NR_fallocate 480
+#define TARGET_NR_timerfd_create 481
+#define TARGET_NR_timerfd_settime 482
+#define TARGET_NR_timerfd_gettime 483
+#define TARGET_NR_signalfd4 484
+#define TARGET_NR_eventfd2 485
+#define TARGET_NR_epoll_create1 486
+#define TARGET_NR_dup3 487
+#define TARGET_NR_pipe2 488
+#define TARGET_NR_inotify_init1 489
+#define TARGET_NR_preadv 490
+#define TARGET_NR_pwritev 491
+#define TARGET_NR_rt_tgsigqueueinfo 492
+#define TARGET_NR_perf_event_open 493
+#define TARGET_NR_fanotify_init 494
+#define TARGET_NR_fanotify_mark 495
+#define TARGET_NR_prlimit64 496
+#define TARGET_NR_name_to_handle_at 497
+#define TARGET_NR_open_by_handle_at 498
+#define TARGET_NR_clock_adjtime 499
+#define TARGET_NR_syncfs 500
/* The following aliases are defined in order to match up with the
standard i386 syscalls implemented in syscalls.c. */
Index: qemu-0.14.1/linux-user/arm/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/arm/syscall_nr.h
+++ qemu-0.14.1/linux-user/arm/syscall_nr.h
@@ -365,3 +365,16 @@
#define TARGET_NR_dup3 (358)
#define TARGET_NR_pipe2 (359)
#define TARGET_NR_inotify_init1 (360)
+#define TARGET_NR_preadv (361)
+#define TARGET_NR_pwritev (362)
+#define TARGET_NR_rt_tgsigqueueinfo (363)
+#define TARGET_NR_perf_event_open (364)
+#define TARGET_NR_recvmmsg (365)
+#define TARGET_NR_accept4 (366)
+#define TARGET_NR_fanotify_init (367)
+#define TARGET_NR_fanotify_mark (368)
+#define TARGET_NR_prlimit64 (369)
+#define TARGET_NR_name_to_handle_at (370)
+#define TARGET_NR_open_by_handle_at (371)
+#define TARGET_NR_clock_adjtime (372)
+#define TARGET_NR_syncfs (373)
Index: qemu-0.14.1/linux-user/cris/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/cris/syscall_nr.h
+++ qemu-0.14.1/linux-user/cris/syscall_nr.h
@@ -333,3 +333,5 @@
#define TARGET_NR_dup3 330
#define TARGET_NR_pipe2 331
#define TARGET_NR_inotify_init1 332
+#define TARGET_NR_preadv 333
+#define TARGET_NR_pwritev 334
Index: qemu-0.14.1/linux-user/i386/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/i386/syscall_nr.h
+++ qemu-0.14.1/linux-user/i386/syscall_nr.h
@@ -335,3 +335,15 @@
#define TARGET_NR_dup3 330
#define TARGET_NR_pipe2 331
#define TARGET_NR_inotify_init1 332
+#define TARGET_NR_preadv 333
+#define TARGET_NR_pwritev 334
+#define TARGET_NR_rt_tgsigqueueinfo 335
+#define TARGET_NR_perf_event_open 336
+#define TARGET_NR_recvmmsg 337
+#define TARGET_NR_fanotify_init 338
+#define TARGET_NR_fanotify_mark 339
+#define TARGET_NR_prlimit64 340
+#define TARGET_NR_name_to_handle_at 341
+#define TARGET_NR_open_by_handle_at 342
+#define TARGET_NR_clock_adjtime 343
+#define TARGET_NR_syncfs 344
Index: qemu-0.14.1/linux-user/m68k/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/m68k/syscall_nr.h
+++ qemu-0.14.1/linux-user/m68k/syscall_nr.h
@@ -328,3 +328,19 @@
#define TARGET_NR_dup3 326
#define TARGET_NR_pipe2 327
#define TARGET_NR_inotify_init1 328
+#define TARGET_NR_inotify_init1 328
+#define TARGET_NR_preadv 329
+#define TARGET_NR_pwritev 330
+#define TARGET_NR_rt_tgsigqueueinfo 331
+#define TARGET_NR_perf_event_open 332
+#define TARGET_NR_get_thread_area 333
+#define TARGET_NR_set_thread_area 334
+#define TARGET_NR_atomic_cmpxchg_32 335
+#define TARGET_NR_atomic_barrier 336
+#define TARGET_NR_fanotify_init 337
+#define TARGET_NR_fanotify_mark 338
+#define TARGET_NR_prlimit64 339
+#define TARGET_NR_name_to_handle_at 340
+#define TARGET_NR_open_by_handle_at 341
+#define TARGET_NR_clock_adjtime 342
+#define TARGET_NR_syncfs 343
Index: qemu-0.14.1/linux-user/main.c
===================================================================
--- qemu-0.14.1.orig/linux-user/main.c
+++ qemu-0.14.1/linux-user/main.c
@@ -1922,6 +1922,33 @@ static const uint8_t mips_syscall_args[]
MIPS_SYS(sys_epoll_pwait, 6)
MIPS_SYS(sys_ioprio_set, 3)
MIPS_SYS(sys_ioprio_get, 2)
+ MIPS_SYS(sys_utimensat, 4)
+ MIPS_SYS(sys_signalfd, 3)
+ MIPS_SYS(sys_ni_syscall, 0) /* was timerfd */
+ MIPS_SYS(sys_eventfd, 1)
+ MIPS_SYS(sys_fallocate, 6) /* 4320 */
+ MIPS_SYS(sys_timerfd_create, 2)
+ MIPS_SYS(sys_timerfd_gettime, 2)
+ MIPS_SYS(sys_timerfd_settime, 4)
+ MIPS_SYS(sys_signalfd4, 4)
+ MIPS_SYS(sys_eventfd2, 2) /* 4325 */
+ MIPS_SYS(sys_epoll_create1, 1)
+ MIPS_SYS(sys_dup3, 3)
+ MIPS_SYS(sys_pipe2, 2)
+ MIPS_SYS(sys_inotify_init1, 1)
+ MIPS_SYS(sys_preadv, 6) /* 4330 */
+ MIPS_SYS(sys_pwritev, 6)
+ MIPS_SYS(sys_rt_tgsigqueueinfo, 4)
+ MIPS_SYS(sys_perf_event_open, 5)
+ MIPS_SYS(sys_accept4, 4)
+ MIPS_SYS(sys_recvmmsg, 5) /* 4335 */
+ MIPS_SYS(sys_fanotify_init, 2)
+ MIPS_SYS(sys_fanotify_mark, 6)
+ MIPS_SYS(sys_prlimit64, 4)
+ MIPS_SYS(sys_name_to_handle_at, 5)
+ MIPS_SYS(sys_open_by_handle_at, 3) /* 4340 */
+ MIPS_SYS(sys_clock_adjtime, 2)
+ MIPS_SYS(sys_syncfs, 1)
};
#undef MIPS_SYS
Index: qemu-0.14.1/linux-user/microblaze/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/microblaze/syscall_nr.h
+++ qemu-0.14.1/linux-user/microblaze/syscall_nr.h
@@ -364,6 +364,16 @@
#define TARGET_NR_sendmsg 360 /* new */
#define TARGET_NR_recvmsg 361 /* new */
#define TARGET_NR_accept04 362 /* new */
-
-#define TARGET_NR_syscalls 363
+#define TARGET_NR_preadv 363 /* new */
+#define TARGET_NR_pwritev 364 /* new */
+#define TARGET_NR_rt_tgsigqueueinfo 365 /* new */
+#define TARGET_NR_perf_event_open 366 /* new */
+#define TARGET_NR_recvmmsg 367 /* new */
+#define TARGET_NR_fanotify_init 368
+#define TARGET_NR_fanotify_mark 369
+#define TARGET_NR_prlimit64 370
+#define TARGET_NR_name_to_handle_at 371
+#define TARGET_NR_open_by_handle_at 372
+#define TARGET_NR_clock_adjtime 373
+#define TARGET_NR_syncfs 374
Index: qemu-0.14.1/linux-user/mips/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/mips/syscall_nr.h
+++ qemu-0.14.1/linux-user/mips/syscall_nr.h
@@ -332,3 +332,16 @@
#define TARGET_NR_dup3 (TARGET_NR_Linux + 327)
#define TARGET_NR_pipe2 (TARGET_NR_Linux + 328)
#define TARGET_NR_inotify_init1 (TARGET_NR_Linux + 329)
+#define TARGET_NR_preadv (TARGET_NR_Linux + 330)
+#define TARGET_NR_pwritev (TARGET_NR_Linux + 331)
+#define TARGET_NR_rt_tgsigqueueinfo (TARGET_NR_Linux + 332)
+#define TARGET_NR_perf_event_open (TARGET_NR_Linux + 333)
+#define TARGET_NR_accept4 (TARGET_NR_Linux + 334)
+#define TARGET_NR_recvmmsg (TARGET_NR_Linux + 335)
+#define TARGET_NR_fanotify_init (TARGET_NR_Linux + 336)
+#define TARGET_NR_fanotify_mark (TARGET_NR_Linux + 337)
+#define TARGET_NR_prlimit64 (TARGET_NR_Linux + 338)
+#define TARGET_NR_name_to_handle_at (TARGET_NR_Linux + 339)
+#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 340)
+#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 341)
+#define TARGET_NR_syncfs (TARGET_NR_Linux + 342)
Index: qemu-0.14.1/linux-user/mips64/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/mips64/syscall_nr.h
+++ qemu-0.14.1/linux-user/mips64/syscall_nr.h
@@ -291,3 +291,16 @@
#define TARGET_NR_dup3 (TARGET_NR_Linux + 286)
#define TARGET_NR_pipe2 (TARGET_NR_Linux + 287)
#define TARGET_NR_inotify_init1 (TARGET_NR_Linux + 288)
+#define TARGET_NR_preadv (TARGET_NR_Linux + 289)
+#define TARGET_NR_pwritev (TARGET_NR_Linux + 290)
+#define TARGET_NR_rt_tgsigqueueinfo (TARGET_NR_Linux + 291)
+#define TARGET_NR_perf_event_open (TARGET_NR_Linux + 292)
+#define TARGET_NR_accept4 (TARGET_NR_Linux + 293)
+#define TARGET_NR_recvmmsg (TARGET_NR_Linux + 294)
+#define TARGET_NR_fanotify_init (TARGET_NR_Linux + 295)
+#define TARGET_NR_fanotify_mark (TARGET_NR_Linux + 296)
+#define TARGET_NR_prlimit64 (TARGET_NR_Linux + 297)
+#define TARGET_NR_name_to_handle_at (TARGET_NR_Linux + 298)
+#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 299)
+#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 300)
+#define TARGET_NR_syncfs (TARGET_NR_Linux + 301)
Index: qemu-0.14.1/linux-user/mipsn32/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/mipsn32/syscall_nr.h
+++ qemu-0.14.1/linux-user/mipsn32/syscall_nr.h
@@ -295,3 +295,17 @@
#define TARGET_NR_dup3 (TARGET_NR_Linux + 290)
#define TARGET_NR_pipe2 (TARGET_NR_Linux + 291)
#define TARGET_NR_inotify_init1 (TARGET_NR_Linux + 292)
+#define TARGET_NR_preadv (TARGET_NR_Linux + 293)
+#define TARGET_NR_pwritev (TARGET_NR_Linux + 294)
+#define TARGET_NR_rt_tgsigqueueinfo (TARGET_NR_Linux + 295)
+#define TARGET_NR_perf_event_open (TARGET_NR_Linux + 296)
+#define TARGET_NR_accept4 (TARGET_NR_Linux + 297)
+#define TARGET_NR_recvmmsg (TARGET_NR_Linux + 298)
+#define TARGET_NR_getdents64 (TARGET_NR_Linux + 299)
+#define TARGET_NR_fanotify_init (TARGET_NR_Linux + 300)
+#define TARGET_NR_fanotify_mark (TARGET_NR_Linux + 301)
+#define TARGET_NR_prlimit64 (TARGET_NR_Linux + 302)
+#define TARGET_NR_name_to_handle_at (TARGET_NR_Linux + 303)
+#define TARGET_NR_open_by_handle_at (TARGET_NR_Linux + 304)
+#define TARGET_NR_clock_adjtime (TARGET_NR_Linux + 305)
+#define TARGET_NR_syncfs (TARGET_NR_Linux + 306)
Index: qemu-0.14.1/linux-user/ppc/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/ppc/syscall_nr.h
+++ qemu-0.14.1/linux-user/ppc/syscall_nr.h
@@ -332,3 +332,33 @@
#define TARGET_NR_dup3 316
#define TARGET_NR_pipe2 317
#define TARGET_NR_inotify_init1 318
+#define TARGET_NR_perf_event_open 319
+#define TARGET_NR_preadv 320
+#define TARGET_NR_pwritev 321
+#define TARGET_NR_rt_tgsigqueueinfo 322
+#define TARGET_NR_fanotify_init 323
+#define TARGET_NR_fanotify_mark 324
+#define TARGET_NR_prlimit64 325
+#define TARGET_NR_socket 326
+#define TARGET_NR_bind 327
+#define TARGET_NR_connect 328
+#define TARGET_NR_listen 329
+#define TARGET_NR_accept 330
+#define TARGET_NR_getsockname 331
+#define TARGET_NR_getpeername 332
+#define TARGET_NR_socketpair 333
+#define TARGET_NR_send 334
+#define TARGET_NR_sendto 335
+#define TARGET_NR_recv 336
+#define TARGET_NR_recvfrom 337
+#define TARGET_NR_shutdown 338
+#define TARGET_NR_setsockopt 339
+#define TARGET_NR_getsockopt 340
+#define TARGET_NR_sendmsg 341
+#define TARGET_NR_recvmsg 342
+#define TARGET_NR_recvmmsg 343
+#define TARGET_NR_accept4 344
+#define TARGET_NR_name_to_handle_at 345
+#define TARGET_NR_open_by_handle_at 346
+#define TARGET_NR_clock_adjtime 347
+#define TARGET_NR_syncfs 348
Index: qemu-0.14.1/linux-user/sh4/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/sh4/syscall_nr.h
+++ qemu-0.14.1/linux-user/sh4/syscall_nr.h
@@ -334,3 +334,35 @@
#define TARGET_NR_dup3 330
#define TARGET_NR_pipe2 331
#define TARGET_NR_inotify_init1 332
+#define TARGET_NR_preadv 333
+#define TARGET_NR_pwritev 334
+#define TARGET_NR_rt_tgsigqueueinfo 335
+#define TARGET_NR_perf_event_open 336
+#define TARGET_NR_fanotify_init 337
+#define TARGET_NR_fanotify_mark 338
+#define TARGET_NR_prlimit64 339
+
+/* Non-multiplexed socket family */
+#define TARGET_NR_socket 340
+#define TARGET_NR_bind 341
+#define TARGET_NR_connect 342
+#define TARGET_NR_listen 343
+#define TARGET_NR_accept 344
+#define TARGET_NR_getsockname 345
+#define TARGET_NR_getpeername 346
+#define TARGET_NR_socketpair 347
+#define TARGET_NR_send 348
+#define TARGET_NR_sendto 349
+#define TARGET_NR_recv 350
+#define TARGET_NR_recvfrom 351
+#define TARGET_NR_shutdown 352
+#define TARGET_NR_setsockopt 353
+#define TARGET_NR_getsockopt 354
+#define TARGET_NR_sendmsg 355
+#define TARGET_NR_recvmsg 356
+#define TARGET_NR_recvmmsg 357
+#define TARGET_NR_accept4 358
+#define TARGET_NR_name_to_handle_at 359
+#define TARGET_NR_open_by_handle_at 360
+#define TARGET_NR_clock_adjtime 361
+#define TARGET_NR_syncfs 362
Index: qemu-0.14.1/linux-user/sparc/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/sparc/syscall_nr.h
+++ qemu-0.14.1/linux-user/sparc/syscall_nr.h
@@ -285,3 +285,15 @@
#define TARGET_NR_pipe2 321
#define TARGET_NR_inotify_init1 322
#define TARGET_NR_accept4 323
+#define TARGET_NR_preadv 324
+#define TARGET_NR_pwritev 325
+#define TARGET_NR_rt_tgsigqueueinfo 326
+#define TARGET_NR_perf_event_open 327
+#define TARGET_NR_recvmmsg 328
+#define TARGET_NR_fanotify_init 329
+#define TARGET_NR_fanotify_mark 330
+#define TARGET_NR_prlimit64 331
+#define TARGET_NR_name_to_handle_at 332
+#define TARGET_NR_open_by_handle_at 333
+#define TARGET_NR_clock_adjtime 334
+#define TARGET_NR_syncfs 335
Index: qemu-0.14.1/linux-user/sparc64/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/sparc64/syscall_nr.h
+++ qemu-0.14.1/linux-user/sparc64/syscall_nr.h
@@ -322,3 +322,15 @@
#define TARGET_NR_pipe2 321
#define TARGET_NR_inotify_init1 322
#define TARGET_NR_accept4 323
+#define TARGET_NR_preadv 324
+#define TARGET_NR_pwritev 325
+#define TARGET_NR_rt_tgsigqueueinfo 326
+#define TARGET_NR_perf_event_open 327
+#define TARGET_NR_recvmmsg 328
+#define TARGET_NR_fanotify_init 329
+#define TARGET_NR_fanotify_mark 330
+#define TARGET_NR_prlimit64 331
+#define TARGET_NR_name_to_handle_at 332
+#define TARGET_NR_open_by_handle_at 333
+#define TARGET_NR_clock_adjtime 334
+#define TARGET_NR_syncfs 335
Index: qemu-0.14.1/linux-user/x86_64/syscall_nr.h
===================================================================
--- qemu-0.14.1.orig/linux-user/x86_64/syscall_nr.h
+++ qemu-0.14.1/linux-user/x86_64/syscall_nr.h
@@ -293,3 +293,15 @@
#define TARGET_NR_dup3 292
#define TARGET_NR_pipe2 293
#define TARGET_NR_inotify_init1 294
+#define TARGET_NR_preadv 295
+#define TARGET_NR_pwritev 296
+#define TARGET_NR_rt_tgsigqueueinfo 297
+#define TARGET_NR_perf_event_open 298
+#define TARGET_NR_recvmmsg 299
+#define TARGET_NR_fanotify_init 300
+#define TARGET_NR_fanotify_mark 301
+#define TARGET_NR_prlimit64 302
+#define TARGET_NR_name_to_handle_at 303
+#define TARGET_NR_open_by_handle_at 304
+#define TARGET_NR_clock_adjtime 305
+#define TARGET_NR_syncfs 306

View File

@ -1,23 +1,24 @@
From d03d586aabc9000cabc56de7e327c5b5640f3179 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
From 07d1e1618bb9632bad8d4b6928067711781df1d9 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Tue, 14 Apr 2009 16:27:36 +0200
Subject: [PATCH 08/17] qemu-cvs-ioctl_nodirection
Subject: [PATCH 25/32] qemu-cvs-ioctl_nodirection
the direction given in the ioctl should be correct so we can assume the
communication is uni-directional. The alsa developers did not like this
concept though and declared ioctls IOC_R and IOC_W even though they were
IOC_RW.
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
linux-user/syscall.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 04f77ef..b51634b 100644
index 4f1a5b4..eabeee6 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3134,6 +3134,11 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
@@ -3377,6 +3377,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) {
@ -29,7 +30,7 @@ index 04f77ef..b51634b 100644
case IOC_R:
ret = get_errno(ioctl(fd, ie->host_cmd, buf_temp));
if (!is_error(ret)) {
@@ -3152,6 +3157,7 @@ static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)
@@ -3395,6 +3400,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;
@ -38,5 +39,5 @@ index 04f77ef..b51634b 100644
case IOC_RW:
argptr = lock_user(VERIFY_READ, arg, target_size, 1);
--
1.7.1
1.6.0.2

View File

@ -1,218 +0,0 @@
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 8677bba..2a1adf1 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1246,6 +1246,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;
@@ -1317,6 +1318,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. */
@@ -1347,6 +1349,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;
@@ -2330,9 +2333,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
@@ -2340,15 +2342,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;
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 7735008..e71550c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4608,6 +4608,125 @@ int get_osversion(void)
return osversion;
}
+
+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;
+
+ 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);
+#endif
+
+ 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 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 {
+ const char *filename;
+ int (*fill)(void *cpu_env, int fd);
+ };
+ const struct fake_open *fake_open;
+ 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 }
+ };
+
+ 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>. */
@@ -4693,9 +4812,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)
@@ -5937,6 +6056,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
if ((arg3 & PROT_GROWSDOWN)
&& arg1 >= ts->info->stack_limit
&& arg1 <= ts->info->start_stack) {
+typedef struct sPAPREnvironment sPAPREnvironment;
arg3 &= ~PROT_GROWSDOWN;
arg2 = arg2 + arg1 - ts->info->stack_limit;
arg1 = ts->info->stack_limit;

View File

@ -1,32 +1,32 @@
From 09686f619707ec98e073bf671b0334a2f65934ad Mon Sep 17 00:00:00 2001
From a4eebec448c7cd69fcc589912779fc7df6fca4ea Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:37:42 +0200
Subject: [PATCH 11/17] qemu-img-vmdk-scsi
Subject: [PATCH 26/32] qemu-img-vmdk-scsi
Support creation of SCSI VMDK images in qemu-img.
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
block.c | 5 ++++-
block/vmdk.c | 7 +++++--
block/vmdk.c | 12 ++++++++++--
block_int.h | 2 ++
qemu-img.c | 8 +++++++-
4 files changed, 18 insertions(+), 4 deletions(-)
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/block.c b/block.c
index b476479..b77f09b 100644
index d015887..4b9f81d 100644
--- a/block.c
+++ b/block.c
@@ -2792,7 +2792,7 @@ int bdrv_img_create(const char *filename, const char *fmt,
@@ -3151,7 +3151,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;
- QEMUOptionParameter *backing_fmt, *backing_file;
+ QEMUOptionParameter *backing_fmt, *backing_file, *scsi;
- QEMUOptionParameter *backing_fmt, *backing_file, *size;
+ QEMUOptionParameter *backing_fmt, *backing_file, *size, *scsi;
BlockDriverState *bs = NULL;
BlockDriver *drv, *proto_drv;
BlockDriver *backing_drv = NULL;
@@ -2901,6 +2901,9 @@ int bdrv_img_create(const char *filename, const char *fmt,
@@ -3261,6 +3261,9 @@ int bdrv_img_create(const char *filename, const char *fmt,
printf("Formatting '%s', fmt=%s ", filename, fmt);
print_option_parameters(param);
@ -37,42 +37,54 @@ index b476479..b77f09b 100644
ret = bdrv_create(drv, filename, param);
diff --git a/block/vmdk.c b/block/vmdk.c
index 8fc9d67..8944173 100644
index f544159..2b9531d 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -685,7 +685,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
@@ -1375,7 +1375,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
"ddb.geometry.cylinders = \"%" PRId64 "\"\n"
"ddb.geometry.heads = \"16\"\n"
"ddb.geometry.sectors = \"63\"\n"
- "ddb.adapterType = \"ide\"\n";
+ "ddb.adapterType = \"%s\"\n";
char desc[1024];
const char *real_filename, *temp_str;
int64_t total_size = 0;
@@ -701,6 +701,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
backing_file = options->value.s;
} else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) {
flags |= options->value.n ? BLOCK_FLAG_COMPAT6: 0;
if (filename_decompose(filename, path, prefix, postfix, PATH_MAX)) {
return -EINVAL;
@@ -1390,6 +1390,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;
+ } else if (!strcmp(options->name, BLOCK_OPT_SCSI)) {
+ flags |= options->value.n ? BLOCK_FLAG_SCSI: 0;
}
options++;
}
@@ -798,7 +800,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
snprintf(desc, sizeof(desc), desc_template, (unsigned int)time(NULL),
total_size, real_filename,
(flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
- total_size / (int64_t)(63 * 16));
+ total_size / (int64_t)(63 * 16),
+ flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide");
@@ -1480,7 +1482,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options)
parent_desc_line,
ext_desc_lines,
(flags & BLOCK_FLAG_COMPAT6 ? 6 : 4),
- total_size / (int64_t)(63 * 16 * 512));
+ total_size / (int64_t)(63 * 16 * 512),
+ flags & BLOCK_FLAG_SCSI ? "lsilogic" : "ide");
if (split || flat) {
fd = open(
filename,
@@ -1583,6 +1586,11 @@ static QEMUOptionParameter vmdk_create_options[] = {
"VMDK flat extent format, can be one of "
"{monolithicSparse (default) | monolithicFlat | twoGbMaxExtentSparse | twoGbMaxExtentFlat | streamOptimized} "
},
+ {
+ .name = BLOCK_OPT_SCSI,
+ .type = OPT_FLAG,
+ .help = "SCSI image"
+ },
{ NULL }
};
/* write the descriptor */
lseek(fd, le64_to_cpu(header.desc_offset) << 9, SEEK_SET);
diff --git a/block_int.h b/block_int.h
index 545ad11..771fd91 100644
index 77c0187..b79ab4b 100644
--- a/block_int.h
+++ b/block_int.h
@@ -30,10 +30,12 @@
@@ -33,10 +33,12 @@
#define BLOCK_FLAG_ENCRYPT 1
#define BLOCK_FLAG_COMPAT6 4
@ -86,10 +98,10 @@ index 545ad11..771fd91 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 4a37358..ed8cc08 100644
index 8bdae66..012a9e4 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -572,7 +572,7 @@ static int img_convert(int argc, char **argv)
@@ -661,7 +661,7 @@ static int img_convert(int argc, char **argv)
const uint8_t *buf1;
BlockDriverInfo bdi;
QEMUOptionParameter *param = NULL, *create_options = NULL;
@ -97,8 +109,8 @@ index 4a37358..ed8cc08 100644
+ QEMUOptionParameter *out_baseimg_param, *scsi;
char *options = NULL;
const char *snapshot_name = NULL;
@@ -727,6 +727,12 @@ static int img_convert(int argc, char **argv)
float local_progress;
@@ -852,6 +852,12 @@ static int img_convert(int argc, char **argv)
}
}
@ -112,5 +124,5 @@ index 4a37358..ed8cc08 100644
ret = bdrv_create(drv, out_filename, param);
if (ret < 0) {
--
1.7.1
1.6.0.2

View File

@ -1,16 +0,0 @@
Index: qemu-0.14.1/linux-user/syscall.c
===================================================================
--- qemu-0.14.1.orig/linux-user/syscall.c
+++ qemu-0.14.1/linux-user/syscall.c
@@ -7423,6 +7423,11 @@ typedef struct sPAPREnvironment sPAPREnv
break;
#endif
+#if defined(TARGET_NR_timer_create)
+ case TARGET_NR_set_tid_address:
+ goto unimplemented_nowarn;
+#endif
+
#if defined(TARGET_NR_tkill) && defined(__NR_tkill)
case TARGET_NR_tkill:
ret = get_errno(sys_tkill((int)arg1, target_to_host_signal(arg2)));

View File

@ -1,7 +1,7 @@
From 75c51f45c127ebe4f549041aae98f510480429ae Mon Sep 17 00:00:00 2001
From 9b3ae5bebe9635991156b6e87f61ca204b204345 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Tue, 14 Apr 2009 16:38:20 +0200
Subject: [PATCH 12/17] qemu-nonvoid_return
Subject: [PATCH 27/32] qemu-nonvoid_return
Squelches GCC warnings about undefined return values.
@ -12,10 +12,10 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hw/mpcore.c b/hw/mpcore.c
index fc05215..7bdb495 100644
index d6175cf..58dfd09 100644
--- a/hw/mpcore.c
+++ b/hw/mpcore.c
@@ -104,6 +104,7 @@ static uint32_t mpcore_timer_read(mpcore_timer_state *s, int offset)
@@ -106,6 +106,7 @@ static uint32_t mpcore_timer_read(mpcore_timer_state *s, int offset)
default:
return 0;
}
@ -24,10 +24,10 @@ index fc05215..7bdb495 100644
static void mpcore_timer_write(mpcore_timer_state *s, int offset,
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 6f72a2b..7d9492b 100644
index 0e7f1fe..bfaf116 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -440,6 +440,7 @@ static inline int opsize_bytes(int opsize)
@@ -436,6 +436,7 @@ static inline int opsize_bytes(int opsize)
qemu_assert(0, "bad operand size");
return 0;
}
@ -36,5 +36,5 @@ index 6f72a2b..7d9492b 100644
/* Assign value to a register. If the width is less than the register width
--
1.7.1
1.6.0.2

View File

@ -1,7 +1,7 @@
From 4569b209989e09bdebcb6cce809b3fed0f94142c Mon Sep 17 00:00:00 2001
From 18b54324078105bd5d23241026bdbc92f1fe22b6 Mon Sep 17 00:00:00 2001
From: Ulrich Hecht <uli@suse.de>
Date: Wed, 25 Aug 2010 14:23:43 +0200
Subject: [PATCH 16/17] fix mipsn32*-linux-user builds
Subject: [PATCH 28/32] fix mipsn32*-linux-user builds
Signed-off-by: Ulrich Hecht <uli@suse.de>
---
@ -14,11 +14,11 @@ Signed-off-by: Ulrich Hecht <uli@suse.de>
create mode 100644 default-configs/mipsn32el-linux-user.mak
diff --git a/configure b/configure
index bd1484b..6513d91 100755
index ac4840d..e9cad7f 100755
--- a/configure
+++ b/configure
@@ -1010,6 +1010,8 @@ m68k-linux-user \
microblaze-linux-user \
@@ -915,6 +915,8 @@ microblaze-linux-user \
microblazeel-linux-user \
mips-linux-user \
mipsel-linux-user \
+mipsn32-linux-user \
@ -54,5 +54,5 @@ index 4ec506c..beeeb3c 100644
#define UNAME_MACHINE "mips64"
--
1.7.1
1.6.0.2

View File

@ -1,8 +1,65 @@
diff -uNr old-qemu-0.14.1//block/raw-win32.c qemu-0.14.1/block/raw-win32.c
--- old-qemu-0.14.1//block/raw-win32.c 2011-05-06 21:01:43.000000000 +0200
+++ qemu-0.14.1/block/raw-win32.c 2011-05-11 15:41:45.744749392 +0200
@@ -93,7 +93,7 @@
else if (!(flags & BDRV_O_CACHE_WB))
From b3f9ab3168e50f1dec4835c0df01869ecf848267 Mon Sep 17 00:00:00 2001
From: Benjamin <mlspirat42@gmail.com>
Date: Sat, 8 Oct 2011 07:31:33 +0000
Subject: [PATCH 29/32] 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 d7a6539..1a28830 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,
@ -10,8 +67,8 @@ diff -uNr old-qemu-0.14.1//block/raw-win32.c qemu-0.14.1/block/raw-win32.c
OPEN_EXISTING, overlapped, NULL);
if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();
@@ -354,7 +354,7 @@
else if (!(flags & BDRV_O_CACHE_WB))
@@ -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,
@ -19,10 +76,11 @@ diff -uNr old-qemu-0.14.1//block/raw-win32.c qemu-0.14.1/block/raw-win32.c
create_flags, overlapped, NULL);
if (s->hfile == INVALID_HANDLE_VALUE) {
int err = GetLastError();
diff -uNr old-qemu-0.14.1//hw/e1000.c qemu-0.14.1/hw/e1000.c
--- old-qemu-0.14.1//hw/e1000.c 2011-05-06 21:01:43.000000000 +0200
+++ qemu-0.14.1/hw/e1000.c 2011-05-11 15:41:45.744749392 +0200
@@ -573,7 +573,7 @@
diff --git a/hw/e1000.c b/hw/e1000.c
index 986ed9c..19ca5bf 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -577,7 +577,7 @@ receive_filter(E1000State *s, const uint8_t *buf, int size)
if (rctl & E1000_RCTL_UPE) // promiscuous
return 1;
@ -31,20 +89,73 @@ diff -uNr old-qemu-0.14.1//hw/e1000.c qemu-0.14.1/hw/e1000.c
return 1;
if ((rctl & E1000_RCTL_BAM) && !memcmp(buf, bcast, sizeof bcast))
diff -uNr old-qemu-0.14.1//Makefile.objs qemu-0.14.1/Makefile.objs
--- old-qemu-0.14.1//Makefile.objs 2011-05-06 21:01:43.000000000 +0200
+++ qemu-0.14.1/Makefile.objs 2011-05-11 15:41:45.751749392 +0200
@@ -34,6 +34,7 @@
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 -uNr old-qemu-0.14.1//net/udp.c qemu-0.14.1/net/udp.c
--- old-qemu-0.14.1//net/udp.c 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.14.1/net/udp.c 2011-05-11 15:41:45.752749392 +0200
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..6080919
--- /dev/null
+++ b/net/udp.c
@@ -0,0 +1,138 @@
+/*
+ * QEMU System Emulator
@ -184,9 +295,11 @@ diff -uNr old-qemu-0.14.1//net/udp.c qemu-0.14.1/net/udp.c
+
+ return 0;
+}
diff -uNr old-qemu-0.14.1//net/udp.h qemu-0.14.1/net/udp.h
--- old-qemu-0.14.1//net/udp.h 1970-01-01 01:00:00.000000000 +0100
+++ qemu-0.14.1/net/udp.h 2011-05-11 15:41:45.752749392 +0200
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
@ -220,65 +333,11 @@ diff -uNr old-qemu-0.14.1//net/udp.h qemu-0.14.1/net/udp.h
+int net_init_udp(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan);
+
+#endif /* QEMU_NET_UDP_H */
diff -uNr old-qemu-0.14.1//net.c qemu-0.14.1/net.c
--- old-qemu-0.14.1//net.c 2011-05-06 21:01:44.000000000 +0200
+++ qemu-0.14.1/net.c 2011-05-11 15:42:53.145749408 +0200
@@ -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 "sysemu.h"
@@ -1085,9 +1086,31 @@
.help = "permissions for socket",
},
{ /* end of list */ }
- },
+ },
#endif
}, {
+
+ .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 */ }
+ },
+ }, {
.type = "dump",
.init = net_init_dump,
.desc = {
diff -uNr old-qemu-0.14.1//net.h qemu-0.14.1/net.h
--- old-qemu-0.14.1//net.h 2011-05-06 21:01:44.000000000 +0200
+++ qemu-0.14.1/net.h 2011-05-11 15:41:45.754749392 +0200
@@ -35,6 +35,7 @@
NET_CLIENT_TYPE_TAP,
NET_CLIENT_TYPE_SOCKET,
NET_CLIENT_TYPE_VDE,
+ NET_CLIENT_TYPE_UDP,
NET_CLIENT_TYPE_DUMP
} net_client_type;
diff -uNr old-qemu-0.14.1//qemu-options.hx qemu-0.14.1/qemu-options.hx
--- old-qemu-0.14.1//qemu-options.hx 2011-05-06 21:01:44.000000000 +0200
+++ qemu-0.14.1/qemu-options.hx 2011-05-11 15:41:45.755749392 +0200
@@ -1070,6 +1070,8 @@
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"
@ -287,3 +346,6 @@ diff -uNr old-qemu-0.14.1//qemu-options.hx qemu-0.14.1/qemu-options.hx
#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"
--
1.6.0.2

View File

@ -1,7 +1,7 @@
From 864b2c7da05bc29a94b3e792b100dd5189576942 Mon Sep 17 00:00:00 2001
From 42ca714385588477429c8ac77c810b310854494b 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
Subject: [PATCH 30/32] linux-user: add binfmt wrapper for argv[0] handling
When using qemu's linux-user binaries through binfmt, argv[0] gets lost
along the execution because qemu only gets passed in the full file name
@ -28,10 +28,10 @@ Signed-off-by: Alexander Graf <agraf@suse.de>
3 files changed, 67 insertions(+), 17 deletions(-)
create mode 100644 linux-user/binfmt.c
Index: qemu-0.14.1/Makefile.target
===================================================================
--- qemu-0.14.1.orig/Makefile.target
+++ qemu-0.14.1/Makefile.target
diff --git a/Makefile.target b/Makefile.target
index a111521..4287960 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -33,6 +33,10 @@ endif
PROGS=$(QEMU_PROG)
STPFILES=
@ -43,7 +43,7 @@ Index: qemu-0.14.1/Makefile.target
ifndef CONFIG_HAIKU
LIBS+=-lm
endif
@@ -131,6 +135,8 @@ obj-y += $(addprefix ../libuser/, $(user
@@ -139,6 +143,8 @@ obj-y += $(addprefix ../libuser/, $(user-obj-y))
obj-y += $(addprefix ../libdis-user/, $(libdis-y))
obj-y += $(libobj-y)
@ -52,19 +52,20 @@ Index: qemu-0.14.1/Makefile.target
endif #CONFIG_LINUX_USER
#########################################################
@@ -346,6 +352,8 @@ obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml
@@ -416,6 +422,8 @@ obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
$(call LINK,$^)
+$(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)$@")
Index: qemu-0.14.1/linux-user/binfmt.c
===================================================================
diff --git a/linux-user/binfmt.c b/linux-user/binfmt.c
new file mode 100644
index 0000000..cd1f513
--- /dev/null
+++ qemu-0.14.1/linux-user/binfmt.c
+++ b/linux-user/binfmt.c
@@ -0,0 +1,42 @@
+#include <stdio.h>
+#include <stdarg.h>
@ -108,11 +109,11 @@ Index: qemu-0.14.1/linux-user/binfmt.c
+
+ return execve(new_argv[0], new_argv, envp);
+}
Index: qemu-0.14.1/scripts/qemu-binfmt-conf.sh
===================================================================
--- qemu-0.14.1.orig/scripts/qemu-binfmt-conf.sh
+++ qemu-0.14.1/scripts/qemu-binfmt-conf.sh
@@ -34,36 +34,36 @@ esac
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index d0fe4e1..c20fb61 100644
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -34,38 +34,38 @@ esac
# register the interpreter for each cpu except for the native one
if [ $cpu != "i386" ] ; then
@ -141,8 +142,8 @@ Index: qemu-0.14.1/scripts/qemu-binfmt-conf.sh
fi
if [ $cpu != "m68k" ] ; then
echo 'Please check cpu value and header information for m68k!'
- echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
+ echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k-binfmt:P' > /proc/sys/fs/binfmt_misc/register
- echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k:' > /proc/sys/fs/binfmt_misc/register
+ echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k-binfmt:P' > /proc/sys/fs/binfmt_misc/register
fi
if [ $cpu != "mips" ] ; then
# FIXME: We could use the other endianness on a MIPS host.
@ -164,4 +165,10 @@ Index: qemu-0.14.1/scripts/qemu-binfmt-conf.sh
- 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
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
fi
--
1.6.0.2

View File

@ -0,0 +1,32 @@
From a9d80d519385d7c659173a7b12461a2099738c02 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 11 Dec 2011 01:19:24 +0100
Subject: [PATCH 31/32] linux-user: Ignore timer_create syscall
We don't implement the timer_create syscall, but shouting out loud
about it breaks some %check tests in OBS, so better ignore it silently.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
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 eabeee6..fd6ff1f 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,
break;
#endif
+#if defined(TARGET_NR_timer_create)
+ case TARGET_NR_timer_create:
+ goto unimplemented_nowarn;
+#endif
+
#if defined(TARGET_NR_tkill) && defined(__NR_tkill)
case TARGET_NR_tkill:
ret = get_errno(sys_tkill((int)arg1, target_to_host_signal(arg2)));
--
1.6.0.2

View File

@ -0,0 +1,30 @@
From 0006edd6319648e5a5eac86b6c7c82d67c4b5cb1 Mon Sep 17 00:00:00 2001
From: Alexander Graf <agraf@suse.de>
Date: Sun, 11 Dec 2011 01:21:51 +0100
Subject: [PATCH 32/32] linux-user: be silent about capget failures
Complaining about capget doesn't buy us anything, but makes %check
fail in certain builds. So better not complain about its missing
implementation and go on with life :)
Signed-off-by: Alexander Graf <agraf@suse.de>
---
linux-user/syscall.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index fd6ff1f..9ba51bf 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,
unlock_user(p, arg1, ret);
break;
case TARGET_NR_capget:
- goto unimplemented;
+ goto unimplemented_nowarn;
case TARGET_NR_capset:
goto unimplemented;
case TARGET_NR_sigaltstack:
--
1.6.0.2

View File

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

3
qemu-1.0.tar.bz2 Normal file
View File

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

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Sun Dec 11 00:36:35 UTC 2011 - agraf@suse.com
- update to 1.0 from upstream. for changelogs please see:
- 0.14 -> 0.15: http://wiki.qemu.org/ChangeLog/0.15
- 0.15 -> 1.0: http://wiki.qemu.org/ChangeLog/1.0
- the binary "qemu" is now called qemu-system-i386
-------------------------------------------------------------------
Tue Nov 8 14:53:19 UTC 2011 - agraf@suse.com

106
qemu.spec
View File

@ -23,35 +23,41 @@ Url: http://fabrice.bellard.free.fr/qemu/
License: BSD3c(or similar) ; GPLv2+ ; LGPLv2.1+ ; MIT License (or similar)
Group: System/Emulators/PC
Summary: Universal CPU emulator
Version: 0.14.1
Release: 1
Version: 1.0
Release: 0
Source: %name-%version.tar.bz2
Patch1: 0001-qemu-0.7.0-amd64.patch
Patch2: 0002-qemu-0.9.0.cvs-binfmt.patch
Patch3: 0003-qemu-cvs-alsa_bitfield.patch
Patch4: 0004-qemu-cvs-alsa_ioctl.patch
Patch5: 0005-qemu-cvs-alsa_mmap.patch
Patch6: 0006-qemu-cvs-gettimeofday.patch
Patch7: 0007-qemu-cvs-ioctl_debug.patch
Patch8: 0008-qemu-cvs-ioctl_nodirection.patch
Patch9: 0009-qemu-cvs-sched_getaffinity.patch
Patch10: 0010-qemu-cvs-mmap-amd64.patch
Patch11: 0011-qemu-img-vmdk-scsi.patch
Patch12: 0012-qemu-nonvoid_return.patch
Patch13: 0013-i386-linux-user-NPTL-support.patch
Patch15: 0015-S-390-support.patch
Patch16: 0016-fix-mipsn32-linux-user-builds.patch
Patch17: 0017-S-390-build-fix.patch
Patch18: 0018-qemu-0.14.1-mcast-udp.patch
Patch19: 0019-linux-user-fix-openat.patch
Patch20: 0020-linux-user-implement-reboot-syscall.patch
Patch21: 0021-implement-prlimit64-syscall.patch
Patch22: 0022-fixing-smp-races.patch
Patch23: 0023-linux-user-add-binfmt-wrapper-for-argv-0-handling.patch
Patch24: 0024-fix-glibc-install-locales.patch
Patch25: 0025-add-syscall-numbers-from-2.6.39.2.patch
Patch26: 0026-linux-user_fake-some-_proc_self-entries.patch
Patch27: 0027-ignore-timer-create.patch
Patch1: 0001-Handle-CPU-interrupts-by-inline-checking-of-a-flag.patch
Patch2: 0002-linux-user-fix-QEMU_STRACE-1-segfault.patch
Patch3: 0003-linux-user-save-auxv-length.patch
Patch4: 0004-linux-user-add-open-hijack-infrastructure.patch
Patch5: 0005-linux-user-fake-proc-self-maps.patch
Patch6: 0006-linux-user-fake-proc-self-stat.patch
Patch7: 0007-linux-user-fake-proc-self-auxv.patch
Patch8: 0008-XXX-dont-dump-core-on-sigabort.patch
Patch9: 0009-linux-user-fix-wait-syscall-status-returns.patch
Patch10: 0010-Revert-linux-user-fix-wait-syscall-status-returns.patch
Patch11: 0011-linux-user-fix-wait-syscall-status-returns.patch
Patch12: 0012-linux-user-Fix-32-on-64-mmap-for-x86_64.patch
Patch13: 0013-XXX-linux-user-fake-proc-self-maps-even-more.patch
Patch14: 0014-XXX-work-around-SA_RESTART-race-with-boehm-gc-ARM-o.patch
Patch15: 0015-XXX-move-qemu-binary-lower-in-address-space-so-we-ha.patch
Patch16: 0016-linux-user-map-lower-in-address-space.patch
Patch17: 0017-XXX-fake-proc-self-maps-also-fclose-real-file.patch
Patch18: 0018-XXX-map-qemu-higher-again-so-we-have-space-for-brk.patch
Patch19: 0019-qemu-0.9.0.cvs-binfmt.patch
Patch20: 0020-qemu-cvs-alsa_bitfield.patch
Patch21: 0021-qemu-cvs-alsa_ioctl.patch
Patch22: 0022-qemu-cvs-alsa_mmap.patch
Patch23: 0023-qemu-cvs-gettimeofday.patch
Patch24: 0024-qemu-cvs-ioctl_debug.patch
Patch25: 0025-qemu-cvs-ioctl_nodirection.patch
Patch26: 0026-qemu-img-vmdk-scsi.patch
Patch27: 0027-qemu-nonvoid_return.patch
Patch28: 0028-fix-mipsn32-linux-user-builds.patch
Patch29: 0029-Integrating-Dynamips-and-GNS3-UDP-tunnels-Patches.patch
Patch30: 0030-linux-user-add-binfmt-wrapper-for-argv-0-handling.patch
Patch31: 0031-linux-user-Ignore-timer_create-syscall.patch
Patch32: 0032-linux-user-be-silent-about-capget-failures.patch
# this is to make lint happy
Source300: rpmlintrc
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -68,18 +74,19 @@ BuildRequires: libattr-devel
BuildRequires: libgnutls-devel
BuildRequires: libpcap-devel
BuildRequires: ncurses-devel
%if 0%{?suse_version} >= 1210
BuildRequires: libattr-devel-static
%endif
%if 0%{?suse_version} >= 1120
BuildRequires: zlib-devel-static
%else
BuildRequires: zlib-devel
%endif
%if 0%{?suse_version} >= 1210
BuildRequires: libattr-devel-static
BuildRequires: glibc-devel-static
BuildRequires: libfdt1-devel
BuildRequires: glib2-devel-static
%endif
BuildRequires: libvdeplug3-devel
BuildRequires: glib2-devel
Requires: timezone virt-utils
%description
@ -120,22 +127,25 @@ run cross architectures builds
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1 -R
%patch25 -p1 -F 3
%patch26 -p1 -F 3
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%ifarch s390x ppc64 x86_64
# s390 target only builds on 64-bit machines
%patch15 -p1
%patch17 -p1
%endif
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%build
# build QEMU
@ -145,15 +155,12 @@ mkdir -p dynamic
--interp-prefix=%_datadir/%name/qemu-i386 \
--audio-card-list="ac97 es1370 sb16 cs4231a adlib gus" \
--audio-drv-list="alsa sdl" --enable-mixemu --enable-vde \
--extra-cflags="$QEMU_OPT_FLAGS" --enable-system --disable-linux-user \
%ifarch ppc
--disable-kvm
%endif
--extra-cflags="$QEMU_OPT_FLAGS" --enable-system --disable-linux-user
# curl test fails for no reason in build system
echo "CONFIG_CURL=y" >> config-host.mak
echo "CURL_LIBS=-lcurl" >> config-host.mak
echo "#define CONFIG_CURL 1" >> config-host.h
make -j1 V=1
make %{?jobs:-j%jobs} V=1
make qemu-img V=1
mv */qemu */qemu-* qemu-io dynamic || true
make clean
@ -164,15 +171,15 @@ make clean
--disable-system \
--static --disable-linux-aio \
--extra-cflags="$QEMU_OPT_FLAGS"
make -j1 V=1
make %{?jobs:-j%jobs} V=1
%install
make install DESTDIR=$RPM_BUILD_ROOT
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
install -m 755 */qemu $RPM_BUILD_ROOT/%_bindir
ln -sf qemu $RPM_BUILD_ROOT/%_bindir/qemu-system-i386
# otherwise we get: install: omitting directory `dynamic/qemu-palcode'
rm -fr dynamic/qemu-palcode
install -m 755 */qemu-*[^.]? $RPM_BUILD_ROOT/%_bindir
install -d -m 755 $RPM_BUILD_ROOT/%_sbindir
install -m 755 dynamic/qemu-binfmt-conf.sh $RPM_BUILD_ROOT/%_sbindir
@ -189,7 +196,6 @@ rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(-, root, root)
%doc COPYING COPYING.LIB Changelog README TODO VERSION qemu-doc.html qemu-tech.html
%_bindir/qemu
%_bindir/qemu-io
%_bindir/qemu-system-*
%doc %_mandir/man[18]/qemu*.[18].gz
@ -209,6 +215,7 @@ rm -rf ${RPM_BUILD_ROOT}
%_bindir/qemu-i386
%_bindir/qemu-m68k
%_bindir/qemu-microblaze
%_bindir/qemu-microblazeel
%_bindir/qemu-mips
%_bindir/qemu-mipsel
%_bindir/qemu-mipsn32
@ -216,14 +223,13 @@ rm -rf ${RPM_BUILD_ROOT}
%_bindir/qemu-ppc64abi32
%_bindir/qemu-ppc64
%_bindir/qemu-ppc
%ifarch s390x ppc64 x86_64
%_bindir/qemu-s390x
%endif
%_bindir/qemu-sh4
%_bindir/qemu-sh4eb
%_bindir/qemu-sparc32plus
%_bindir/qemu-sparc64
%_bindir/qemu-sparc
%_bindir/qemu-unicore32
%_bindir/qemu-x86_64
%_bindir/qemu-*-binfmt
%_bindir/qemu-binfmt-conf.sh