From e4d966cc651f633cf5244fceb6b0a1dd78d4dd14 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 26 Jan 2017 09:04:47 +0100 Subject: [PATCH 1/5] linux-user: add hppa magic numbers in qemu-binfmt-conf.sh As we have now a linux-user HPPA target, we can add it to the list of supported targets in qemu-binfmt-conf.sh Signed-off-by: Laurent Vivier Reviewed-by: Richard Henderson Message-Id: <20170126080449.28255-2-laurent@vivier.eu> Signed-off-by: Richard Henderson --- scripts/qemu-binfmt-conf.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh index de4d1c13d4..0f1aa63872 100755 --- a/scripts/qemu-binfmt-conf.sh +++ b/scripts/qemu-binfmt-conf.sh @@ -1,9 +1,10 @@ #!/bin/sh -# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390 program execution by the kernel +# enable automatic i386/ARM/M68K/MIPS/SPARC/PPC/s390/HPPA +# program execution by the kernel qemu_target_list="i386 i486 alpha arm sparc32plus ppc ppc64 ppc64le m68k \ mips mipsel mipsn32 mipsn32el mips64 mips64el \ -sh4 sh4eb s390x aarch64" +sh4 sh4eb s390x aarch64 hppa" i386_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00' i386_mask='\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' @@ -91,6 +92,10 @@ aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff' aarch64_family=arm +hppa_magic='\x7f\x45\x4c\x46\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x0f' +hppa_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff' +hppa_family=hppa + qemu_get_family() { cpu=${HOST_ARCH:-$(uname -m)} case "$cpu" in From 40493c5f2b0f124c9b2581e539bba14522e51269 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 26 Jan 2017 09:04:48 +0100 Subject: [PATCH 2/5] linux-user: fix "apt-get update" on linux-user hppa apt-get was hanging on linux-user hppa. strace has shown the netlink data stream was not correctly byte swapped. It appears the fd translator function is unregistered just after it has been registered, so the translator function is not called. This patch removes the fd_trans_unregister() after the do_socket() in the TARGET_NR_socket case. This fd_trans_unregister() was added by commit e36800c linux-user: add signalfd/signalfd4 syscalls when do_socket() was not registering any fd translator. And as now it is, we must remove this fd_trans_unregister() to keep them. Reported-by: John Paul Adrian Glaubitz Signed-off-by: Laurent Vivier Tested-by: John Paul Adrian Glaubitz Message-Id: <20170126080449.28255-3-laurent@vivier.eu> Signed-off-by: Richard Henderson --- linux-user/syscall.c | 1 - 1 file changed, 1 deletion(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 11a311f9db..9be8e9530e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -9343,7 +9343,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, #ifdef TARGET_NR_socket case TARGET_NR_socket: ret = do_socket(arg1, arg2, arg3); - fd_trans_unregister(ret); break; #endif #ifdef TARGET_NR_socketpair From 3d96995decb33e49503e30899098e3d3289c9e0d Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 26 Jan 2017 09:04:49 +0100 Subject: [PATCH 3/5] linux-user: define correct UTS machine name for hppa the correct UTS machine name (as expected by systemd) is "parisc", not "hppa". Signed-off-by: Laurent Vivier Message-Id: <20170126080449.28255-4-laurent@vivier.eu> Signed-off-by: Richard Henderson --- linux-user/hppa/target_syscall.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/hppa/target_syscall.h b/linux-user/hppa/target_syscall.h index ac18a9c575..e2f366839d 100644 --- a/linux-user/hppa/target_syscall.h +++ b/linux-user/hppa/target_syscall.h @@ -19,7 +19,7 @@ struct target_pt_regs { target_ulong ipsw; }; -#define UNAME_MACHINE "hppa" +#define UNAME_MACHINE "parisc" #define UNAME_MINIMUM_RELEASE "2.6.32" #define TARGET_CLONE_BACKWARDS #define TARGET_MINSIGSTKSZ 2048 From a881c8e73fb8a6c72c963f842181ad2753913748 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Thu, 26 Jan 2017 13:35:05 -0800 Subject: [PATCH 4/5] target/hppa: Tidy do_cbranch Removes some dead code detected by Covarity. Reported-by: Paolo Bonzini Signed-off-by: Richard Henderson --- target/hppa/translate.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 4d243f7d3d..5d571f0a4e 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1433,7 +1433,6 @@ static ExitStatus do_cbranch(DisasContext *ctx, target_long disp, bool is_n, target_ulong dest = iaoq_dest(ctx, disp); TCGLabel *taken = NULL; TCGCond c = cond->c; - int which = 0; bool n; assert(ctx->null_cond.c == TCG_COND_NEVER); @@ -1455,14 +1454,14 @@ static ExitStatus do_cbranch(DisasContext *ctx, target_long disp, bool is_n, n = is_n && disp < 0; if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); - gen_goto_tb(ctx, which++, ctx->iaoq_n, ctx->iaoq_n + 4); + gen_goto_tb(ctx, 0, ctx->iaoq_n, ctx->iaoq_n + 4); } else { if (!n && ctx->null_lab) { gen_set_label(ctx->null_lab); ctx->null_lab = NULL; } nullify_set(ctx, n); - gen_goto_tb(ctx, which++, ctx->iaoq_b, ctx->iaoq_n); + gen_goto_tb(ctx, 0, ctx->iaoq_b, ctx->iaoq_n); } gen_set_label(taken); @@ -1471,23 +1470,17 @@ static ExitStatus do_cbranch(DisasContext *ctx, target_long disp, bool is_n, n = is_n && disp >= 0; if (n && use_nullify_skip(ctx)) { nullify_set(ctx, 0); - gen_goto_tb(ctx, which++, dest, dest + 4); + gen_goto_tb(ctx, 1, dest, dest + 4); } else { nullify_set(ctx, n); - gen_goto_tb(ctx, which++, ctx->iaoq_b, dest); + gen_goto_tb(ctx, 1, ctx->iaoq_b, dest); } /* Not taken: the branch itself was nullified. */ if (ctx->null_lab) { gen_set_label(ctx->null_lab); ctx->null_lab = NULL; - if (which < 2) { - nullify_set(ctx, 0); - gen_goto_tb(ctx, which, ctx->iaoq_b, ctx->iaoq_n); - return EXIT_GOTO_TB; - } else { - return EXIT_IAQ_N_STALE; - } + return EXIT_IAQ_N_STALE; } else { return EXIT_GOTO_TB; } From 6836a8fb96963a29f309d49873062bbca9ab0e28 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Mon, 6 Feb 2017 18:25:31 -0800 Subject: [PATCH 5/5] target/hppa: Fix gdb_write_register Add a missing break, detected by Coverity. Reported-by: Peter Maydell Signed-off-by: Richard Henderson --- target/hppa/gdbstub.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/hppa/gdbstub.c b/target/hppa/gdbstub.c index 413a5e12ad..c37a56f238 100644 --- a/target/hppa/gdbstub.c +++ b/target/hppa/gdbstub.c @@ -85,6 +85,7 @@ int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) break; case 35: env->iaoq_b = val; + break; case 59: env->cr26 = val; break;