Re: [Qemu-devel] [PATCH] alpha-linux-user: Implement signals.
On Wed, Feb 10, 2010 at 09:35:12AM -0800, Richard Henderson wrote: On 02/10/2010 04:04 AM, Riku Voipio wrote: On Tue, Feb 09, 2010 at 10:46:32AM -0800, Richard Henderson wrote: Ping? The linux-user side of the patch seems fine, but the target-alpha code doesn't apply. Either something has changed upstream or this depends on one of your other alpha patches. If the latter case, I don't mind if this is applied together with the rest of alpha patches. Really? I just cherry-picked the patch out of my submitted branch onto a new branch off mainline and it applied just fine. If there was some kind of conflict, it must be trivial. I have applied it after fixing the conflict and a few coding style mistakes. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurel...@aurel32.net http://www.aurel32.net
Re: [Qemu-devel] [PATCH] alpha-linux-user: Implement signals.
On Tue, Feb 09, 2010 at 10:46:32AM -0800, Richard Henderson wrote: Ping? The linux-user side of the patch seems fine, but the target-alpha code doesn't apply. Either something has changed upstream or this depends on one of your other alpha patches. If the latter case, I don't mind if this is applied together with the rest of alpha patches. r~ On 01/04/2010 03:17 PM, Richard Henderson wrote: Move userland PALcode handling into linux-user main loop so that we can send signals from there. This also makes alpha_palcode.c system-level only, so don't build it for userland. Add defines for GENTRAP PALcall mapping to signals. Signed-off-by: Richard Hendersonr...@twiddle.net --- Makefile.target |3 +- hw/alpha_palcode.c | 81 +--- linux-user/alpha/target_signal.h | 27 linux-user/main.c| 137 linux-user/signal.c | 267 ++ linux-user/syscall.c | 61 - linux-user/syscall_defs.h| 23 +++- target-alpha/cpu.h |4 +- target-alpha/translate.c |3 +- 9 files changed, 489 insertions(+), 117 deletions(-) diff --git a/Makefile.target b/Makefile.target index 7c1f30c..0ecfe76 100644 --- a/Makefile.target +++ b/Makefile.target @@ -47,7 +47,6 @@ libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o libobj-y += op_helper.o helper.o libobj-$(CONFIG_NEED_MMU) += mmu.o libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o -libobj-$(TARGET_ALPHA) += alpha_palcode.o # NOTE: the disassembler code is only needed for debugging libobj-y += disas.o @@ -295,6 +294,8 @@ obj-m68k-y += m68k-semi.o dummy_m68k.o obj-s390x-y = s390-virtio-bus.o s390-virtio.o +obj-alpha-y = alpha_palcode.o + main.o vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c index 843bd14..c1220ad 100644 --- a/hw/alpha_palcode.c +++ b/hw/alpha_palcode.c @@ -21,11 +21,9 @@ #includestdlib.h #includestdio.h -#include qemu.h #include cpu.h #include exec-all.h -#if !defined (CONFIG_USER_ONLY) /* Shared handlers */ static void pal_reset (CPUState *env); /* Console handlers */ @@ -997,12 +995,9 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, uint64_t physical, page_size, end; int prot, zbits, ret; -#if defined(CONFIG_USER_ONLY) -ret = 2; -#else -ret = virtual_to_physical(env,physical,zbits,prot, - address, mmu_idx, rw); -#endif +ret = virtual_to_physical(env,physical,zbits,prot, + address, mmu_idx, rw); + switch (ret) { case 0: /* No fault */ @@ -1050,73 +1045,3 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, return ret; } #endif - -#else /* !defined (CONFIG_USER_ONLY) */ -void pal_init (CPUState *env) -{ -} - -void call_pal (CPUState *env, int palcode) -{ -target_long ret; - -switch (palcode) { -case 0x80: -/* BPT */ -qemu_log(BPT\n); -/* FIXME: Sends SIGTRAP, si_code=TRAP_BRKPT. */ -exit(1); -case 0x81: -/* BUGCHK */ -qemu_log(BUGCHK\n); -/* FIXME: Sends SIGTRAP, si_code=SI_FAULT. */ -exit(1); -case 0x83: -/* CALLSYS */ -qemu_log(CALLSYS n TARGET_FMT_ld \n, env-ir[0]); -ret = do_syscall(env, env-ir[IR_V0], env-ir[IR_A0], env-ir[IR_A1], - env-ir[IR_A2], env-ir[IR_A3], env-ir[IR_A4], - env-ir[IR_A5]); -if (ret= 0) { -env-ir[IR_A3] = 0; -env-ir[IR_V0] = ret; -} else { -env-ir[IR_A3] = 1; -env-ir[IR_V0] = -ret; -} -break; -case 0x86: -/* IMB */ -qemu_log(IMB\n); -/* ??? We can probably elide the code using page_unprotect that is - checking for self-modifying code. Instead we could simply call - tb_flush here. Until we work out the changes required to turn - off the extra write protection, this can be a no-op. */ -break; -case 0x9E: -/* RDUNIQUE */ -qemu_log(RDUNIQUE: TARGET_FMT_lx \n, env-unique); -/* Handled in the translator for usermode. */ -abort(); -case 0x9F: -/* WRUNIQUE */ -qemu_log(WRUNIQUE: TARGET_FMT_lx \n, env-ir[IR_A0]); -/* Handled in the translator for usermode. */ -abort(); -case 0xAA: -/* GENTRAP */ -qemu_log(GENTRAP: TARGET_FMT_lx \n, env-ir[IR_A0]); -/* FIXME: This is supposed to send a signal: - SIGFPE: - GEN_INTOVF, GEN_INTDIV, GEN_FLTOVF, GEN_FLTDIV, - GEN_FLTUND, GEN_FLTINV, GEN_FLTINE,
Re: [Qemu-devel] [PATCH] alpha-linux-user: Implement signals.
On 02/10/2010 04:04 AM, Riku Voipio wrote: On Tue, Feb 09, 2010 at 10:46:32AM -0800, Richard Henderson wrote: Ping? The linux-user side of the patch seems fine, but the target-alpha code doesn't apply. Either something has changed upstream or this depends on one of your other alpha patches. If the latter case, I don't mind if this is applied together with the rest of alpha patches. Really? I just cherry-picked the patch out of my submitted branch onto a new branch off mainline and it applied just fine. If there was some kind of conflict, it must be trivial. I'll re-generate the patch. r~
Re: [Qemu-devel] [PATCH] alpha-linux-user: Implement signals.
Ping? r~ On 01/04/2010 03:17 PM, Richard Henderson wrote: Move userland PALcode handling into linux-user main loop so that we can send signals from there. This also makes alpha_palcode.c system-level only, so don't build it for userland. Add defines for GENTRAP PALcall mapping to signals. Signed-off-by: Richard Hendersonr...@twiddle.net --- Makefile.target |3 +- hw/alpha_palcode.c | 81 +--- linux-user/alpha/target_signal.h | 27 linux-user/main.c| 137 linux-user/signal.c | 267 ++ linux-user/syscall.c | 61 - linux-user/syscall_defs.h| 23 +++- target-alpha/cpu.h |4 +- target-alpha/translate.c |3 +- 9 files changed, 489 insertions(+), 117 deletions(-) diff --git a/Makefile.target b/Makefile.target index 7c1f30c..0ecfe76 100644 --- a/Makefile.target +++ b/Makefile.target @@ -47,7 +47,6 @@ libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o libobj-y += op_helper.o helper.o libobj-$(CONFIG_NEED_MMU) += mmu.o libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o -libobj-$(TARGET_ALPHA) += alpha_palcode.o # NOTE: the disassembler code is only needed for debugging libobj-y += disas.o @@ -295,6 +294,8 @@ obj-m68k-y += m68k-semi.o dummy_m68k.o obj-s390x-y = s390-virtio-bus.o s390-virtio.o +obj-alpha-y = alpha_palcode.o + main.o vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c index 843bd14..c1220ad 100644 --- a/hw/alpha_palcode.c +++ b/hw/alpha_palcode.c @@ -21,11 +21,9 @@ #includestdlib.h #includestdio.h -#include qemu.h #include cpu.h #include exec-all.h -#if !defined (CONFIG_USER_ONLY) /* Shared handlers */ static void pal_reset (CPUState *env); /* Console handlers */ @@ -997,12 +995,9 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, uint64_t physical, page_size, end; int prot, zbits, ret; -#if defined(CONFIG_USER_ONLY) -ret = 2; -#else -ret = virtual_to_physical(env,physical,zbits,prot, - address, mmu_idx, rw); -#endif +ret = virtual_to_physical(env,physical,zbits,prot, + address, mmu_idx, rw); + switch (ret) { case 0: /* No fault */ @@ -1050,73 +1045,3 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, return ret; } #endif - -#else /* !defined (CONFIG_USER_ONLY) */ -void pal_init (CPUState *env) -{ -} - -void call_pal (CPUState *env, int palcode) -{ -target_long ret; - -switch (palcode) { -case 0x80: -/* BPT */ -qemu_log(BPT\n); -/* FIXME: Sends SIGTRAP, si_code=TRAP_BRKPT. */ -exit(1); -case 0x81: -/* BUGCHK */ -qemu_log(BUGCHK\n); -/* FIXME: Sends SIGTRAP, si_code=SI_FAULT. */ -exit(1); -case 0x83: -/* CALLSYS */ -qemu_log(CALLSYS n TARGET_FMT_ld \n, env-ir[0]); -ret = do_syscall(env, env-ir[IR_V0], env-ir[IR_A0], env-ir[IR_A1], - env-ir[IR_A2], env-ir[IR_A3], env-ir[IR_A4], - env-ir[IR_A5]); -if (ret= 0) { -env-ir[IR_A3] = 0; -env-ir[IR_V0] = ret; -} else { -env-ir[IR_A3] = 1; -env-ir[IR_V0] = -ret; -} -break; -case 0x86: -/* IMB */ -qemu_log(IMB\n); -/* ??? We can probably elide the code using page_unprotect that is - checking for self-modifying code. Instead we could simply call - tb_flush here. Until we work out the changes required to turn - off the extra write protection, this can be a no-op. */ -break; -case 0x9E: -/* RDUNIQUE */ -qemu_log(RDUNIQUE: TARGET_FMT_lx \n, env-unique); -/* Handled in the translator for usermode. */ -abort(); -case 0x9F: -/* WRUNIQUE */ -qemu_log(WRUNIQUE: TARGET_FMT_lx \n, env-ir[IR_A0]); -/* Handled in the translator for usermode. */ -abort(); -case 0xAA: -/* GENTRAP */ -qemu_log(GENTRAP: TARGET_FMT_lx \n, env-ir[IR_A0]); -/* FIXME: This is supposed to send a signal: - SIGFPE: - GEN_INTOVF, GEN_INTDIV, GEN_FLTOVF, GEN_FLTDIV, - GEN_FLTUND, GEN_FLTINV, GEN_FLTINE, GEN_ROPRAND - SIGTRAP: - others - with various settings of si_code. */ -exit(1); -default: -qemu_log(%s: unhandled palcode %02x\n, __func__, palcode); -exit(1); -} -} -#endif diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index 2382ffd..cb86402 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -26,4 +26,31 @@ static inline abi_ulong
[Qemu-devel] [PATCH] alpha-linux-user: Implement signals.
Move userland PALcode handling into linux-user main loop so that we can send signals from there. This also makes alpha_palcode.c system-level only, so don't build it for userland. Add defines for GENTRAP PALcall mapping to signals. Signed-off-by: Richard Henderson r...@twiddle.net --- Makefile.target |3 +- hw/alpha_palcode.c | 81 +--- linux-user/alpha/target_signal.h | 27 linux-user/main.c| 137 linux-user/signal.c | 267 ++ linux-user/syscall.c | 61 - linux-user/syscall_defs.h| 23 +++- target-alpha/cpu.h |4 +- target-alpha/translate.c |3 +- 9 files changed, 489 insertions(+), 117 deletions(-) diff --git a/Makefile.target b/Makefile.target index 7c1f30c..0ecfe76 100644 --- a/Makefile.target +++ b/Makefile.target @@ -47,7 +47,6 @@ libobj-$(CONFIG_NOSOFTFLOAT) += fpu/softfloat-native.o libobj-y += op_helper.o helper.o libobj-$(CONFIG_NEED_MMU) += mmu.o libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o -libobj-$(TARGET_ALPHA) += alpha_palcode.o # NOTE: the disassembler code is only needed for debugging libobj-y += disas.o @@ -295,6 +294,8 @@ obj-m68k-y += m68k-semi.o dummy_m68k.o obj-s390x-y = s390-virtio-bus.o s390-virtio.o +obj-alpha-y = alpha_palcode.o + main.o vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c index 843bd14..c1220ad 100644 --- a/hw/alpha_palcode.c +++ b/hw/alpha_palcode.c @@ -21,11 +21,9 @@ #include stdlib.h #include stdio.h -#include qemu.h #include cpu.h #include exec-all.h -#if !defined (CONFIG_USER_ONLY) /* Shared handlers */ static void pal_reset (CPUState *env); /* Console handlers */ @@ -997,12 +995,9 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, uint64_t physical, page_size, end; int prot, zbits, ret; -#if defined(CONFIG_USER_ONLY) -ret = 2; -#else -ret = virtual_to_physical(env, physical, zbits, prot, - address, mmu_idx, rw); -#endif +ret = virtual_to_physical(env, physical, zbits, prot, + address, mmu_idx, rw); + switch (ret) { case 0: /* No fault */ @@ -1050,73 +1045,3 @@ int cpu_ppc_handle_mmu_fault (CPUState *env, uint32_t address, int rw, return ret; } #endif - -#else /* !defined (CONFIG_USER_ONLY) */ -void pal_init (CPUState *env) -{ -} - -void call_pal (CPUState *env, int palcode) -{ -target_long ret; - -switch (palcode) { -case 0x80: -/* BPT */ -qemu_log(BPT\n); -/* FIXME: Sends SIGTRAP, si_code=TRAP_BRKPT. */ -exit(1); -case 0x81: -/* BUGCHK */ -qemu_log(BUGCHK\n); -/* FIXME: Sends SIGTRAP, si_code=SI_FAULT. */ -exit(1); -case 0x83: -/* CALLSYS */ -qemu_log(CALLSYS n TARGET_FMT_ld \n, env-ir[0]); -ret = do_syscall(env, env-ir[IR_V0], env-ir[IR_A0], env-ir[IR_A1], - env-ir[IR_A2], env-ir[IR_A3], env-ir[IR_A4], - env-ir[IR_A5]); -if (ret = 0) { -env-ir[IR_A3] = 0; -env-ir[IR_V0] = ret; -} else { -env-ir[IR_A3] = 1; -env-ir[IR_V0] = -ret; -} -break; -case 0x86: -/* IMB */ -qemu_log(IMB\n); -/* ??? We can probably elide the code using page_unprotect that is - checking for self-modifying code. Instead we could simply call - tb_flush here. Until we work out the changes required to turn - off the extra write protection, this can be a no-op. */ -break; -case 0x9E: -/* RDUNIQUE */ -qemu_log(RDUNIQUE: TARGET_FMT_lx \n, env-unique); -/* Handled in the translator for usermode. */ -abort(); -case 0x9F: -/* WRUNIQUE */ -qemu_log(WRUNIQUE: TARGET_FMT_lx \n, env-ir[IR_A0]); -/* Handled in the translator for usermode. */ -abort(); -case 0xAA: -/* GENTRAP */ -qemu_log(GENTRAP: TARGET_FMT_lx \n, env-ir[IR_A0]); -/* FIXME: This is supposed to send a signal: - SIGFPE: - GEN_INTOVF, GEN_INTDIV, GEN_FLTOVF, GEN_FLTDIV, - GEN_FLTUND, GEN_FLTINV, GEN_FLTINE, GEN_ROPRAND - SIGTRAP: - others - with various settings of si_code. */ -exit(1); -default: -qemu_log(%s: unhandled palcode %02x\n, __func__, palcode); -exit(1); -} -} -#endif diff --git a/linux-user/alpha/target_signal.h b/linux-user/alpha/target_signal.h index 2382ffd..cb86402 100644 --- a/linux-user/alpha/target_signal.h +++ b/linux-user/alpha/target_signal.h @@ -26,4 +26,31 @@ static inline abi_ulong get_sp_from_cpustate(CPUAlphaState *state) return state-ir[IR_SP]; }