Accepting request 86517 from openSUSE:Tools:Unstable
add binfmt misc handler OBS-URL: https://build.opensuse.org/request/show/86517 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=20
This commit is contained in:
parent
61f77256ce
commit
b3401ee668
@ -8,10 +8,10 @@ No clue why this is necessary or useful, nothing found in any changelogs.
|
||||
x86_64.ld | 6 ++----
|
||||
1 files changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/x86_64.ld b/x86_64.ld
|
||||
index 46d8d4d..cce0a17 100644
|
||||
--- a/x86_64.ld
|
||||
+++ b/x86_64.ld
|
||||
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) }
|
||||
@ -32,6 +32,3 @@ index 46d8d4d..cce0a17 100644
|
||||
.dynamic : { *(.dynamic) }
|
||||
.ctors :
|
||||
{
|
||||
--
|
||||
1.7.1
|
||||
|
||||
|
@ -39,11 +39,11 @@ Subject: [PATCH 15/17] S/390 support
|
||||
create mode 100644 s390x.ld
|
||||
create mode 100644 target-s390x/helpers.h
|
||||
|
||||
diff --git a/configure b/configure
|
||||
index 95de763..bd1484b 100755
|
||||
--- a/configure
|
||||
+++ b/configure
|
||||
@@ -1018,6 +1018,7 @@ sh4eb-linux-user \
|
||||
Index: qemu-0.14.1/configure
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/configure
|
||||
+++ qemu-0.14.1/configure
|
||||
@@ -1020,6 +1020,7 @@ sh4eb-linux-user \
|
||||
sparc-linux-user \
|
||||
sparc64-linux-user \
|
||||
sparc32plus-linux-user \
|
||||
@ -51,7 +51,7 @@ index 95de763..bd1484b 100755
|
||||
"
|
||||
fi
|
||||
# the following are Darwin specific
|
||||
@@ -3006,6 +3007,7 @@ case "$target_arch2" in
|
||||
@@ -3008,6 +3009,7 @@ case "$target_arch2" in
|
||||
target_phys_bits=64
|
||||
;;
|
||||
s390x)
|
||||
@ -59,10 +59,10 @@ index 95de763..bd1484b 100755
|
||||
target_phys_bits=64
|
||||
;;
|
||||
*)
|
||||
diff --git a/cpu-all.h b/cpu-all.h
|
||||
index ffbd6a4..3713bce 100644
|
||||
--- a/cpu-all.h
|
||||
+++ b/cpu-all.h
|
||||
Index: qemu-0.14.1/cpu-all.h
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/cpu-all.h
|
||||
+++ qemu-0.14.1/cpu-all.h
|
||||
@@ -138,7 +138,7 @@ typedef union {
|
||||
uint64_t ll;
|
||||
} CPU_DoubleU;
|
||||
@ -72,10 +72,10 @@ index ffbd6a4..3713bce 100644
|
||||
typedef union {
|
||||
float128 q;
|
||||
#if defined(HOST_WORDS_BIGENDIAN) \
|
||||
diff --git a/cpu-defs.h b/cpu-defs.h
|
||||
index 8d4bf86..1d489c5 100644
|
||||
--- a/cpu-defs.h
|
||||
+++ b/cpu-defs.h
|
||||
Index: qemu-0.14.1/cpu-defs.h
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/cpu-defs.h
|
||||
+++ qemu-0.14.1/cpu-defs.h
|
||||
@@ -148,6 +148,13 @@ typedef struct CPUWatchpoint {
|
||||
} CPUWatchpoint;
|
||||
|
||||
@ -98,10 +98,10 @@ index 8d4bf86..1d489c5 100644
|
||||
volatile sig_atomic_t exit_request; \
|
||||
CPU_COMMON_TLB \
|
||||
struct TranslationBlock *tb_jmp_cache[TB_JMP_CACHE_SIZE]; \
|
||||
diff --git a/cpu-exec.c b/cpu-exec.c
|
||||
index 8c9fb8b..38ce4c0 100644
|
||||
--- a/cpu-exec.c
|
||||
+++ b/cpu-exec.c
|
||||
Index: qemu-0.14.1/cpu-exec.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/cpu-exec.c
|
||||
+++ qemu-0.14.1/cpu-exec.c
|
||||
@@ -229,6 +229,9 @@ int cpu_exec(CPUState *env1)
|
||||
TranslationBlock *tb;
|
||||
uint8_t *tc_ptr;
|
||||
@ -137,18 +137,17 @@ index 8c9fb8b..38ce4c0 100644
|
||||
|
||||
/* cpu_interrupt might be called while translating the
|
||||
TB, but before it is linked into a potentially
|
||||
diff --git a/default-configs/s390x-linux-user.mak b/default-configs/s390x-linux-user.mak
|
||||
new file mode 100644
|
||||
index 0000000..a243c99
|
||||
Index: qemu-0.14.1/default-configs/s390x-linux-user.mak
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/default-configs/s390x-linux-user.mak
|
||||
+++ qemu-0.14.1/default-configs/s390x-linux-user.mak
|
||||
@@ -0,0 +1 @@
|
||||
+# Default configuration for s390x-linux-user
|
||||
diff --git a/disas.c b/disas.c
|
||||
index c76f36f..dbc1d0a 100644
|
||||
--- a/disas.c
|
||||
+++ b/disas.c
|
||||
@@ -215,6 +215,9 @@ void target_disas(FILE *out, target_ulong code, target_ulong size, int flags)
|
||||
Index: qemu-0.14.1/disas.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/disas.c
|
||||
+++ qemu-0.14.1/disas.c
|
||||
@@ -215,6 +215,9 @@ void target_disas(FILE *out, target_ulon
|
||||
disasm_info.mach = bfd_mach_cris_v32;
|
||||
print_insn = print_insn_crisv32;
|
||||
}
|
||||
@ -158,11 +157,11 @@ index c76f36f..dbc1d0a 100644
|
||||
#elif defined(TARGET_MICROBLAZE)
|
||||
disasm_info.mach = bfd_arch_microblaze;
|
||||
print_insn = print_insn_microblaze;
|
||||
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
|
||||
index 33d776d..8554a04 100644
|
||||
--- a/linux-user/elfload.c
|
||||
+++ b/linux-user/elfload.c
|
||||
@@ -793,6 +793,24 @@ static inline void init_thread(struct target_pt_regs *regs,
|
||||
Index: qemu-0.14.1/linux-user/elfload.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/linux-user/elfload.c
|
||||
+++ qemu-0.14.1/linux-user/elfload.c
|
||||
@@ -793,6 +793,24 @@ static inline void init_thread(struct ta
|
||||
|
||||
#endif /* TARGET_ALPHA */
|
||||
|
||||
@ -187,10 +186,10 @@ index 33d776d..8554a04 100644
|
||||
#ifndef ELF_PLATFORM
|
||||
#define ELF_PLATFORM (NULL)
|
||||
#endif
|
||||
diff --git a/linux-user/main.c b/linux-user/main.c
|
||||
index 0d627d6..812efda 100644
|
||||
--- a/linux-user/main.c
|
||||
+++ b/linux-user/main.c
|
||||
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
|
||||
@@ -2624,6 +2624,86 @@ void cpu_loop (CPUState *env)
|
||||
}
|
||||
#endif /* TARGET_ALPHA */
|
||||
@ -278,7 +277,7 @@ index 0d627d6..812efda 100644
|
||||
static void usage(void)
|
||||
{
|
||||
printf("qemu-" TARGET_ARCH " version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n"
|
||||
@@ -3354,6 +3434,15 @@ int main(int argc, char **argv, char **envp)
|
||||
@@ -3354,6 +3434,15 @@ int main(int argc, char **argv, char **e
|
||||
env->regs[15] = regs->acr;
|
||||
env->pc = regs->erp;
|
||||
}
|
||||
@ -294,11 +293,10 @@ index 0d627d6..812efda 100644
|
||||
#else
|
||||
#error unsupported target CPU
|
||||
#endif
|
||||
diff --git a/linux-user/s390x/syscall.h b/linux-user/s390x/syscall.h
|
||||
new file mode 100644
|
||||
index 0000000..a3812a8
|
||||
Index: qemu-0.14.1/linux-user/s390x/syscall.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/linux-user/s390x/syscall.h
|
||||
+++ qemu-0.14.1/linux-user/s390x/syscall.h
|
||||
@@ -0,0 +1,25 @@
|
||||
+/* this typedef defines how a Program Status Word looks like */
|
||||
+typedef struct
|
||||
@ -325,11 +323,10 @@ index 0000000..a3812a8
|
||||
+};
|
||||
+
|
||||
+#define UNAME_MACHINE "s390x"
|
||||
diff --git a/linux-user/s390x/syscall_nr.h b/linux-user/s390x/syscall_nr.h
|
||||
new file mode 100644
|
||||
index 0000000..4a60b9a
|
||||
Index: qemu-0.14.1/linux-user/s390x/syscall_nr.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/linux-user/s390x/syscall_nr.h
|
||||
+++ qemu-0.14.1/linux-user/s390x/syscall_nr.h
|
||||
@@ -0,0 +1,348 @@
|
||||
+/*
|
||||
+ * This file contains the system call numbers.
|
||||
@ -679,11 +676,10 @@ index 0000000..4a60b9a
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
diff --git a/linux-user/s390x/target_signal.h b/linux-user/s390x/target_signal.h
|
||||
new file mode 100644
|
||||
index 0000000..b4816b0
|
||||
Index: qemu-0.14.1/linux-user/s390x/target_signal.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/linux-user/s390x/target_signal.h
|
||||
+++ qemu-0.14.1/linux-user/s390x/target_signal.h
|
||||
@@ -0,0 +1,26 @@
|
||||
+#ifndef TARGET_SIGNAL_H
|
||||
+#define TARGET_SIGNAL_H
|
||||
@ -711,11 +707,10 @@ index 0000000..b4816b0
|
||||
+}
|
||||
+
|
||||
+#endif /* TARGET_SIGNAL_H */
|
||||
diff --git a/linux-user/s390x/termbits.h b/linux-user/s390x/termbits.h
|
||||
new file mode 100644
|
||||
index 0000000..2a78a05
|
||||
Index: qemu-0.14.1/linux-user/s390x/termbits.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/linux-user/s390x/termbits.h
|
||||
+++ qemu-0.14.1/linux-user/s390x/termbits.h
|
||||
@@ -0,0 +1,283 @@
|
||||
+/*
|
||||
+ * include/asm-s390/termbits.h
|
||||
@ -1000,10 +995,10 @@ index 0000000..2a78a05
|
||||
+
|
||||
+#define TARGET_TIOCSER_TEMT 0x01 /* Transmitter physically empty */
|
||||
+
|
||||
diff --git a/linux-user/signal.c b/linux-user/signal.c
|
||||
index b01bd64..8b02b32 100644
|
||||
--- a/linux-user/signal.c
|
||||
+++ b/linux-user/signal.c
|
||||
Index: qemu-0.14.1/linux-user/signal.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/linux-user/signal.c
|
||||
+++ qemu-0.14.1/linux-user/signal.c
|
||||
@@ -3614,6 +3614,320 @@ long do_rt_sigreturn(CPUState *env)
|
||||
return -TARGET_ENOSYS;
|
||||
}
|
||||
@ -1325,11 +1320,11 @@ index b01bd64..8b02b32 100644
|
||||
#elif defined(TARGET_PPC) && !defined(TARGET_PPC64)
|
||||
|
||||
/* FIXME: Many of the structures are defined for both PPC and PPC64, but
|
||||
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
||||
index 1a98433..fe8fb1e 100644
|
||||
--- a/linux-user/syscall.c
|
||||
+++ b/linux-user/syscall.c
|
||||
@@ -194,7 +194,7 @@ static type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5, \
|
||||
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
|
||||
@@ -194,7 +194,7 @@ static type name (type1 arg1,type2 arg2,
|
||||
#define __NR_sys_inotify_add_watch __NR_inotify_add_watch
|
||||
#define __NR_sys_inotify_rm_watch __NR_inotify_rm_watch
|
||||
|
||||
@ -1338,7 +1333,7 @@ index 1a98433..fe8fb1e 100644
|
||||
#define __NR__llseek __NR_lseek
|
||||
#endif
|
||||
|
||||
@@ -321,7 +321,7 @@ static int sys_fchmodat(int dirfd, const char *pathname, mode_t mode)
|
||||
@@ -323,7 +323,7 @@ static int sys_fchmodat(int dirfd, const
|
||||
return (fchmodat(dirfd, pathname, mode, 0));
|
||||
}
|
||||
#endif
|
||||
@ -1347,7 +1342,7 @@ index 1a98433..fe8fb1e 100644
|
||||
static int sys_fchownat(int dirfd, const char *pathname, uid_t owner,
|
||||
gid_t group, int flags)
|
||||
{
|
||||
@@ -430,7 +430,7 @@ _syscall3(int,sys_faccessat,int,dirfd,const char *,pathname,int,mode)
|
||||
@@ -420,7 +420,7 @@ _syscall3(int,sys_faccessat,int,dirfd,co
|
||||
#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
|
||||
_syscall3(int,sys_fchmodat,int,dirfd,const char *,pathname, mode_t,mode)
|
||||
#endif
|
||||
@ -1356,7 +1351,7 @@ index 1a98433..fe8fb1e 100644
|
||||
_syscall5(int,sys_fchownat,int,dirfd,const char *,pathname,
|
||||
uid_t,owner,gid_t,group,int,flags)
|
||||
#endif
|
||||
@@ -3774,6 +3774,7 @@ static int do_fork(CPUState *env, unsigned int flags, abi_ulong newsp,
|
||||
@@ -3779,6 +3779,7 @@ static int do_fork(CPUState *env, unsign
|
||||
#endif
|
||||
ts = qemu_mallocz(sizeof(TaskState));
|
||||
init_task_state(ts);
|
||||
@ -1364,7 +1359,7 @@ index 1a98433..fe8fb1e 100644
|
||||
/* we create a new CPU instance. */
|
||||
new_env = cpu_copy(env);
|
||||
#if defined(TARGET_I386) || defined(TARGET_SPARC) || defined(TARGET_PPC)
|
||||
@@ -5443,7 +5444,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -5448,7 +5449,7 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
ret = get_errno(settimeofday(&tv, NULL));
|
||||
}
|
||||
break;
|
||||
@ -1373,7 +1368,7 @@ index 1a98433..fe8fb1e 100644
|
||||
case TARGET_NR_select:
|
||||
{
|
||||
struct target_sel_arg_struct *sel;
|
||||
@@ -5554,7 +5555,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -5563,7 +5564,9 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
#endif
|
||||
#ifdef TARGET_NR_mmap
|
||||
case TARGET_NR_mmap:
|
||||
@ -1384,7 +1379,7 @@ index 1a98433..fe8fb1e 100644
|
||||
{
|
||||
abi_ulong *v;
|
||||
abi_ulong v1, v2, v3, v4, v5, v6;
|
||||
@@ -6050,6 +6053,8 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6059,6 +6062,8 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg5, arg4));
|
||||
#elif defined(TARGET_CRIS)
|
||||
ret = get_errno(do_fork(cpu_env, arg2, arg1, arg3, arg4, arg5));
|
||||
@ -1393,7 +1388,7 @@ index 1a98433..fe8fb1e 100644
|
||||
#else
|
||||
ret = get_errno(do_fork(cpu_env, arg1, arg2, arg3, arg4, arg5));
|
||||
#endif
|
||||
@@ -6254,8 +6259,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6263,8 +6268,12 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
}
|
||||
break;
|
||||
#endif /* TARGET_NR_getdents64 */
|
||||
@ -1407,7 +1402,7 @@ index 1a98433..fe8fb1e 100644
|
||||
ret = do_select(arg1, arg2, arg3, arg4, arg5);
|
||||
break;
|
||||
#endif
|
||||
@@ -6480,7 +6489,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6489,7 +6498,7 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
case TARGET_NR_sigaltstack:
|
||||
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_MIPS) || \
|
||||
defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_ALPHA) || \
|
||||
@ -1416,7 +1411,7 @@ index 1a98433..fe8fb1e 100644
|
||||
ret = do_sigaltstack(arg1, arg2, get_sp_from_cpustate((CPUState *)cpu_env));
|
||||
break;
|
||||
#else
|
||||
@@ -6713,18 +6722,35 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6722,18 +6731,35 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
case TARGET_NR_setfsgid:
|
||||
ret = get_errno(setfsgid(arg1));
|
||||
break;
|
||||
@ -1454,7 +1449,7 @@ index 1a98433..fe8fb1e 100644
|
||||
ret = get_errno(getuid());
|
||||
break;
|
||||
#endif
|
||||
@@ -6869,33 +6895,57 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6878,33 +6904,57 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -1518,7 +1513,7 @@ index 1a98433..fe8fb1e 100644
|
||||
{
|
||||
int gidsetsize = arg1;
|
||||
uint32_t *target_grouplist;
|
||||
@@ -6919,8 +6969,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6928,8 +6978,12 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -1532,7 +1527,7 @@ index 1a98433..fe8fb1e 100644
|
||||
{
|
||||
int gidsetsize = arg1;
|
||||
uint32_t *target_grouplist;
|
||||
@@ -6940,18 +6994,30 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6949,18 +7003,30 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -1566,7 +1561,7 @@ index 1a98433..fe8fb1e 100644
|
||||
{
|
||||
uid_t ruid, euid, suid;
|
||||
ret = get_errno(getresuid(&ruid, &euid, &suid));
|
||||
@@ -6964,13 +7030,21 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6973,13 +7039,21 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -1589,7 +1584,7 @@ index 1a98433..fe8fb1e 100644
|
||||
{
|
||||
gid_t rgid, egid, sgid;
|
||||
ret = get_errno(getresgid(&rgid, &egid, &sgid));
|
||||
@@ -6983,31 +7057,51 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
|
||||
@@ -6992,31 +7066,51 @@ abi_long do_syscall(void *cpu_env, int n
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -1646,10 +1641,10 @@ index 1a98433..fe8fb1e 100644
|
||||
ret = get_errno(setfsgid(arg1));
|
||||
break;
|
||||
#endif
|
||||
diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h
|
||||
index be612ce..c17bfc9 100644
|
||||
--- a/linux-user/syscall_defs.h
|
||||
+++ b/linux-user/syscall_defs.h
|
||||
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
|
||||
@@ -55,7 +55,7 @@
|
||||
#endif
|
||||
|
||||
@ -1734,11 +1729,10 @@ index be612ce..c17bfc9 100644
|
||||
#else
|
||||
struct target_statfs {
|
||||
uint32_t f_type;
|
||||
diff --git a/s390x.ld b/s390x.ld
|
||||
new file mode 100644
|
||||
index 0000000..7d1f2b7
|
||||
Index: qemu-0.14.1/s390x.ld
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/s390x.ld
|
||||
+++ qemu-0.14.1/s390x.ld
|
||||
@@ -0,0 +1,194 @@
|
||||
+/* Default linker script, for normal executables */
|
||||
+OUTPUT_FORMAT("elf64-s390", "elf64-s390",
|
||||
@ -1934,10 +1928,10 @@ index 0000000..7d1f2b7
|
||||
+ .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
|
||||
+ /DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) }
|
||||
+}
|
||||
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
|
||||
index 335ab05..7aa4a4a 100644
|
||||
--- a/scripts/qemu-binfmt-conf.sh
|
||||
+++ b/scripts/qemu-binfmt-conf.sh
|
||||
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
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
-# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC program execution by the kernel
|
||||
@ -1946,16 +1940,16 @@ index 335ab05..7aa4a4a 100644
|
||||
# load the binfmt_misc module
|
||||
if [ ! -d /proc/sys/fs/binfmt_misc ]; then
|
||||
@@ -67,3 +67,6 @@ if [ $cpu != "sh" ] ; then
|
||||
echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4:' > /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
|
||||
echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
+if [ $cpu != "s390x" ] ; then
|
||||
+ echo ':s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/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/local/bin/qemu-s390x-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+fi
|
||||
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
|
||||
index e47c372..49a919e 100644
|
||||
--- a/target-s390x/cpu.h
|
||||
+++ b/target-s390x/cpu.h
|
||||
Index: qemu-0.14.1/target-s390x/cpu.h
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/target-s390x/cpu.h
|
||||
+++ qemu-0.14.1/target-s390x/cpu.h
|
||||
@@ -26,6 +26,14 @@
|
||||
#define CPUState struct CPUS390XState
|
||||
|
||||
@ -1980,7 +1974,7 @@ index e47c372..49a919e 100644
|
||||
float_status fpu_status; /* passed to softfloat lib */
|
||||
|
||||
struct {
|
||||
@@ -85,8 +93,10 @@ static inline int cpu_mmu_index (CPUState *env)
|
||||
@@ -85,8 +93,10 @@ static inline int cpu_mmu_index (CPUStat
|
||||
}
|
||||
|
||||
CPUS390XState *cpu_s390x_init(const char *cpu_model);
|
||||
@ -1991,7 +1985,7 @@ index e47c372..49a919e 100644
|
||||
|
||||
/* you can call this signal handler from your SIGBUS and SIGSEGV
|
||||
signal handlers to inform the virtual CPU of exceptions. non zero
|
||||
@@ -97,29 +107,32 @@ int cpu_s390x_handle_mmu_fault (CPUS390XState *env, target_ulong address, int rw
|
||||
@@ -97,29 +107,32 @@ int cpu_s390x_handle_mmu_fault (CPUS390X
|
||||
int mmu_idx, int is_softmuu);
|
||||
#define cpu_handle_mmu_fault cpu_s390x_handle_mmu_fault
|
||||
|
||||
@ -2031,11 +2025,11 @@ index e47c372..49a919e 100644
|
||||
#define EXCP_EXECUTE_SVC 0xff00000 /* supervisor call via execute insn */
|
||||
|
||||
static inline void cpu_get_tb_cpu_state(CPUState* env, target_ulong *pc,
|
||||
diff --git a/target-s390x/exec.h b/target-s390x/exec.h
|
||||
index bf3f264..6fe64a6 100644
|
||||
--- a/target-s390x/exec.h
|
||||
+++ b/target-s390x/exec.h
|
||||
@@ -34,6 +34,14 @@ static inline int cpu_has_work(CPUState *env)
|
||||
Index: qemu-0.14.1/target-s390x/exec.h
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/target-s390x/exec.h
|
||||
+++ qemu-0.14.1/target-s390x/exec.h
|
||||
@@ -34,6 +34,14 @@ static inline int cpu_has_work(CPUState
|
||||
return env->interrupt_request & CPU_INTERRUPT_HARD; // guess
|
||||
}
|
||||
|
||||
@ -2050,10 +2044,10 @@ index bf3f264..6fe64a6 100644
|
||||
static inline int cpu_halted(CPUState *env)
|
||||
{
|
||||
if (!env->halted) {
|
||||
diff --git a/target-s390x/helper.c b/target-s390x/helper.c
|
||||
index 4a5297b..6085e58 100644
|
||||
--- a/target-s390x/helper.c
|
||||
+++ b/target-s390x/helper.c
|
||||
Index: qemu-0.14.1/target-s390x/helper.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/target-s390x/helper.c
|
||||
+++ qemu-0.14.1/target-s390x/helper.c
|
||||
@@ -26,8 +26,10 @@
|
||||
#include "gdbstub.h"
|
||||
#include "qemu-common.h"
|
||||
@ -2065,7 +2059,7 @@ index 4a5297b..6085e58 100644
|
||||
|
||||
CPUS390XState *cpu_s390x_init(const char *cpu_model)
|
||||
{
|
||||
@@ -38,6 +40,7 @@ CPUS390XState *cpu_s390x_init(const char *cpu_model)
|
||||
@@ -38,6 +40,7 @@ CPUS390XState *cpu_s390x_init(const char
|
||||
cpu_exec_init(env);
|
||||
if (!inited) {
|
||||
inited = 1;
|
||||
@ -2073,7 +2067,7 @@ index 4a5297b..6085e58 100644
|
||||
}
|
||||
|
||||
env->cpu_model_str = cpu_model;
|
||||
@@ -46,6 +49,24 @@ CPUS390XState *cpu_s390x_init(const char *cpu_model)
|
||||
@@ -46,6 +49,24 @@ CPUS390XState *cpu_s390x_init(const char
|
||||
return env;
|
||||
}
|
||||
|
||||
@ -2114,11 +2108,10 @@ index 4a5297b..6085e58 100644
|
||||
int cpu_s390x_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
|
||||
int mmu_idx, int is_softmmu)
|
||||
{
|
||||
diff --git a/target-s390x/helpers.h b/target-s390x/helpers.h
|
||||
new file mode 100644
|
||||
index 0000000..6009312
|
||||
Index: qemu-0.14.1/target-s390x/helpers.h
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ b/target-s390x/helpers.h
|
||||
+++ qemu-0.14.1/target-s390x/helpers.h
|
||||
@@ -0,0 +1,127 @@
|
||||
+#include "def-helper.h"
|
||||
+
|
||||
@ -2247,10 +2240,10 @@ index 0000000..6009312
|
||||
+DEF_HELPER_2(sqdbr, void, i32, i32)
|
||||
+
|
||||
+#include "def-helper.h"
|
||||
diff --git a/target-s390x/op_helper.c b/target-s390x/op_helper.c
|
||||
index 402df2d..20c83c5 100644
|
||||
--- a/target-s390x/op_helper.c
|
||||
+++ b/target-s390x/op_helper.c
|
||||
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
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* S/390 helper routines
|
||||
@ -2268,7 +2261,7 @@ index 402df2d..20c83c5 100644
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Softmmu support */
|
||||
@@ -71,3 +74,1607 @@ void tlb_fill (target_ulong addr, int is_write, int mmu_idx, void *retaddr)
|
||||
@@ -71,3 +74,1607 @@ void tlb_fill (target_ulong addr, int is
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -3876,10 +3869,10 @@ index 402df2d..20c83c5 100644
|
||||
+{
|
||||
+ env->fregs[f1].d = float64_sqrt(env->fregs[f2].d, &env->fpu_status);
|
||||
+}
|
||||
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
|
||||
index d33bfb1..e08dcf4 100644
|
||||
--- a/target-s390x/translate.c
|
||||
+++ b/target-s390x/translate.c
|
||||
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
|
||||
@@ -16,6 +16,18 @@
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
@ -3925,7 +3918,7 @@ index d33bfb1..e08dcf4 100644
|
||||
void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
|
||||
int flags)
|
||||
{
|
||||
@@ -46,12 +77,2776 @@ void cpu_dump_state(CPUState *env, FILE *f, fprintf_function cpu_fprintf,
|
||||
@@ -46,12 +77,2776 @@ void cpu_dump_state(CPUState *env, FILE
|
||||
cpu_fprintf(f, "PSW=mask %016lx addr %016lx cc %02x\n", env->psw.mask, env->psw.addr, env->cc);
|
||||
}
|
||||
|
||||
@ -6702,10 +6695,10 @@ index d33bfb1..e08dcf4 100644
|
||||
}
|
||||
|
||||
void gen_pc_load(CPUState *env, TranslationBlock *tb,
|
||||
diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h
|
||||
index 207a89f..f5de104 100644
|
||||
--- a/tcg/tcg-op.h
|
||||
+++ b/tcg/tcg-op.h
|
||||
Index: qemu-0.14.1/tcg/tcg-op.h
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/tcg/tcg-op.h
|
||||
+++ qemu-0.14.1/tcg/tcg-op.h
|
||||
@@ -366,6 +366,18 @@ static inline void tcg_gen_br(int label)
|
||||
tcg_gen_op1i(INDEX_op_br, label);
|
||||
}
|
||||
@ -6725,11 +6718,11 @@ index 207a89f..f5de104 100644
|
||||
static inline void tcg_gen_mov_i32(TCGv_i32 ret, TCGv_i32 arg)
|
||||
{
|
||||
if (!TCGV_EQUAL_I32(ret, arg))
|
||||
diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h
|
||||
index 2c7ca1a..938b1a0 100644
|
||||
--- a/tcg/tcg-opc.h
|
||||
+++ b/tcg/tcg-opc.h
|
||||
@@ -41,6 +41,7 @@ DEF(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS) /* variable number of parameters */
|
||||
Index: qemu-0.14.1/tcg/tcg-opc.h
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/tcg/tcg-opc.h
|
||||
+++ qemu-0.14.1/tcg/tcg-opc.h
|
||||
@@ -41,6 +41,7 @@ DEF(call, 0, 1, 2, TCG_OPF_SIDE_EFFECTS)
|
||||
DEF(jmp, 0, 1, 0, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
|
||||
DEF(br, 0, 0, 1, TCG_OPF_BB_END | TCG_OPF_SIDE_EFFECTS)
|
||||
|
||||
@ -6745,11 +6738,11 @@ index 2c7ca1a..938b1a0 100644
|
||||
DEF(mov_i64, 1, 1, 0, 0)
|
||||
DEF(movi_i64, 1, 0, 1, 0)
|
||||
DEF(setcond_i64, 1, 2, 1, 0)
|
||||
diff --git a/tcg/tcg.c b/tcg/tcg.c
|
||||
index 5dd6a2c..a75772a 100644
|
||||
--- a/tcg/tcg.c
|
||||
+++ b/tcg/tcg.c
|
||||
@@ -2022,6 +2022,12 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,
|
||||
Index: qemu-0.14.1/tcg/tcg.c
|
||||
===================================================================
|
||||
--- qemu-0.14.1.orig/tcg/tcg.c
|
||||
+++ qemu-0.14.1/tcg/tcg.c
|
||||
@@ -2022,6 +2022,12 @@ static inline int tcg_gen_code_common(TC
|
||||
// dump_regs(s);
|
||||
#endif
|
||||
switch(opc) {
|
||||
@ -6762,6 +6755,3 @@ index 5dd6a2c..a75772a 100644
|
||||
case INDEX_op_mov_i32:
|
||||
#if TCG_TARGET_REG_BITS == 64
|
||||
case INDEX_op_mov_i64:
|
||||
--
|
||||
1.7.1
|
||||
|
||||
|
117
0021-implement-prlimit64-syscall.patch
Normal file
117
0021-implement-prlimit64-syscall.patch
Normal file
@ -0,0 +1,117 @@
|
||||
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"
|
34
0022-fixing-smp-races.patch
Normal file
34
0022-fixing-smp-races.patch
Normal file
@ -0,0 +1,34 @@
|
||||
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. */
|
167
0023-linux-user-add-binfmt-wrapper-for-argv-0-handling.patch
Normal file
167
0023-linux-user-add-binfmt-wrapper-for-argv-0-handling.patch
Normal file
@ -0,0 +1,167 @@
|
||||
From 864b2c7da05bc29a94b3e792b100dd5189576942 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
|
||||
|
||||
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
|
||||
to the executable while argv[0] can be something completely different.
|
||||
|
||||
This breaks in some subtile situations, such as the grep and make test
|
||||
suites.
|
||||
|
||||
This patch adds a wrapper binary called qemu-$TARGET-binfmt that can be
|
||||
used with binfmt's P flag which passes the full path _and_ argv[0] to
|
||||
the binfmt handler.
|
||||
|
||||
The binary would be smart enough to be versatile and only exist in the
|
||||
system once, creating the qemu binary path names from its own argv[0].
|
||||
However, this seemed like it didn't fit the make system too well, so
|
||||
we're currently creating a new binary for each target archictecture.
|
||||
|
||||
CC: Reinhard Max <max@suse.de>
|
||||
Signed-off-by: Alexander Graf <agraf@suse.de>
|
||||
---
|
||||
Makefile.target | 8 ++++++++
|
||||
linux-user/binfmt.c | 42 ++++++++++++++++++++++++++++++++++++++++++
|
||||
scripts/qemu-binfmt-conf.sh | 34 +++++++++++++++++-----------------
|
||||
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
|
||||
@@ -33,6 +33,10 @@ endif
|
||||
PROGS=$(QEMU_PROG)
|
||||
STPFILES=
|
||||
|
||||
+ifdef CONFIG_LINUX_USER
|
||||
+PROGS+=$(QEMU_PROG)-binfmt
|
||||
+endif
|
||||
+
|
||||
ifndef CONFIG_HAIKU
|
||||
LIBS+=-lm
|
||||
endif
|
||||
@@ -131,6 +135,8 @@ obj-y += $(addprefix ../libuser/, $(user
|
||||
obj-y += $(addprefix ../libdis-user/, $(libdis-y))
|
||||
obj-y += $(libobj-y)
|
||||
|
||||
+obj-binfmt-y += binfmt.o
|
||||
+
|
||||
endif #CONFIG_LINUX_USER
|
||||
|
||||
#########################################################
|
||||
@@ -346,6 +352,8 @@ obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml
|
||||
$(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
|
||||
$(call LINK,$(obj-y) $(obj-$(TARGET_BASE_ARCH)-y))
|
||||
|
||||
+$(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
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ qemu-0.14.1/linux-user/binfmt.c
|
||||
@@ -0,0 +1,42 @@
|
||||
+#include <stdio.h>
|
||||
+#include <stdarg.h>
|
||||
+#include <unistd.h>
|
||||
+#include <libgen.h>
|
||||
+#include <string.h>
|
||||
+#include <stdlib.h>
|
||||
+
|
||||
+
|
||||
+int main(int argc, char **argv, char **envp)
|
||||
+{
|
||||
+ char *binfmt;
|
||||
+ char **new_argv;
|
||||
+
|
||||
+ /*
|
||||
+ * Check if our file name ends with -binfmt
|
||||
+ */
|
||||
+ binfmt = argv[0] + strlen(argv[0]) - strlen("-binfmt");
|
||||
+ if (strcmp(binfmt, "-binfmt")) {
|
||||
+ fprintf(stderr, "%s: Invalid executable name\n", argv[0]);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+ if (argc < 3) {
|
||||
+ fprintf(stderr, "%s: Please use me through binfmt with P flag\n",
|
||||
+ argv[0]);
|
||||
+ exit(1);
|
||||
+ }
|
||||
+
|
||||
+ binfmt[0] = '\0';
|
||||
+ /* Now argv[0] is the real qemu binary name */
|
||||
+
|
||||
+ new_argv = (char **)malloc((argc + 2) * sizeof(*new_argv));
|
||||
+ if (argc > 3) {
|
||||
+ memcpy(&new_argv[4], &argv[3], (argc - 3) * sizeof(*new_argv));
|
||||
+ }
|
||||
+ new_argv[0] = argv[0];
|
||||
+ new_argv[1] = (char *)"-0";
|
||||
+ new_argv[2] = argv[2];
|
||||
+ new_argv[3] = argv[1];
|
||||
+ new_argv[argc + 1] = NULL;
|
||||
+
|
||||
+ 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
|
||||
|
||||
# register the interpreter for each cpu except for the native one
|
||||
if [ $cpu != "i386" ] ; then
|
||||
- echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-i386-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
if [ $cpu != "alpha" ] ; then
|
||||
- echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-alpha-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
if [ $cpu != "arm" ] ; then
|
||||
- echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
if [ $cpu != "sparc" ] ; then
|
||||
- echo ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc:' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
if [ $cpu != "ppc" ] ; then
|
||||
- echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc:' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
if [ $cpu != "m68k" ] ; then
|
||||
echo 'Please check cpu value and header information for m68k!'
|
||||
- echo ':m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\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
|
||||
fi
|
||||
if [ $cpu != "mips" ] ; then
|
||||
# FIXME: We could use the other endianness on a MIPS host.
|
||||
- echo ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mipsn32:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsn32el:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64:' > /proc/sys/fs/binfmt_misc/register
|
||||
- echo ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el:' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mipsn32-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsn32el-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
||||
if [ $cpu != "sh" ] ; then
|
||||
- echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4:' > /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
|
||||
+ echo ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
+ echo ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P' > /proc/sys/fs/binfmt_misc/register
|
||||
fi
|
17
qemu.changes
17
qemu.changes
@ -1,3 +1,20 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Oct 4 08:09:57 UTC 2011 - adrian@suse.de
|
||||
|
||||
- add binfmt misc handler binary patch from alex. This is a handler
|
||||
which calls qemu with -0 argument and right parameters to avoid
|
||||
broken runs due to different set $0 as on real hardware
|
||||
- move arch specific patches at the end to avoid arch dep conflicts
|
||||
with other patches
|
||||
- enable linux-user build to get binfmt handler
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 29 09:21:17 UTC 2011 - adrian@suse.de
|
||||
|
||||
- add 0021-implement-prlimit64-syscall.patch from upstream to avoid
|
||||
output and confused configure scripts when testing gcc on armv7hl
|
||||
- add 0022-fixing-smp-races.patch from alex to fix some SMP races
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Sep 27 09:57:34 UTC 2011 - adrian@suse.de
|
||||
|
||||
|
15
qemu.spec
15
qemu.spec
@ -45,6 +45,9 @@ 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
|
||||
# this is to make lint happy
|
||||
Source300: rpmlintrc
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
@ -57,6 +60,7 @@ BuildRequires: cyrus-sasl-devel
|
||||
BuildRequires: e2fsprogs-devel
|
||||
BuildRequires: libaio
|
||||
BuildRequires: libaio-devel
|
||||
BuildRequires: libattr-devel
|
||||
BuildRequires: libgnutls-devel
|
||||
BuildRequires: libpcap-devel
|
||||
BuildRequires: ncurses-devel
|
||||
@ -99,15 +103,18 @@ Authors:
|
||||
%patch11 -p1
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch16 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
%patch21 -p1
|
||||
%patch22 -p1
|
||||
%patch23 -p1
|
||||
%ifarch s390x ppc64 x86_64
|
||||
# s390 target only builds on 64-bit machines
|
||||
%patch15 -p1
|
||||
%patch17 -p1
|
||||
%endif
|
||||
%patch16 -p1
|
||||
%patch18 -p1
|
||||
%patch19 -p1
|
||||
%patch20 -p1
|
||||
|
||||
%build
|
||||
# build QEMU
|
||||
|
Loading…
Reference in New Issue
Block a user