linux-user: m68k update
cover linux-user: m68k update
A couple of m68k patches I have in my stack for a while and needed to have a working linux-user qemu.
The first one is needed to be able to use RISU with m68k.
Laurent Vivier (1):
linux-user: correctly manage SR in ucontext
Michael Karcher (1):
linux-user: fix do_rt_sigreturn on m68k linux userspace emulation
linux-user/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/2 linux-user: correctly manage SR in ucontext
Use cpu_m68k_get_ccr()/cpu_m68k_set_ccr() to setup and restore correctly the value of SR in the ucontext structure
--- linux-user/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
linux-user/signal.c +3 -2
@@ -5495,6 +5495,7 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc, CPUM68KState *env) {target_greg_t *gregs = uc->tuc_mcontext.gregs; +uint32_t sr =cpu_m68k_get_ccr (env);__put_user (TARGET_MCONTEXT_VERSION , &uc->tuc_mcontext.version);__put_user (env->dregs[0 ], &gregs[0 ]);
@@ -5514,7 +5515,7 @@ static inline int target_rt_setup_ucontext(struct target_ucontext *uc,__put_user (env->aregs[6 ], &gregs[14 ]);__put_user (env->aregs[7 ], &gregs[15 ]);__put_user (env->pc, &gregs[16 ]); -__put_user (env->sr, &gregs[17 ]); +__put_user (sr, &gregs[17 ]);return 0 ; }
@@ -5548,7 +5549,7 @@ static inline int target_rt_restore_ucontext(CPUM68KState *env,__get_user (env->aregs[7 ], &gregs[15 ]);__get_user (env->pc, &gregs[16 ]);__get_user (temp, &gregs[17 ]); - env->sr = (env->sr &0xff00 ) | (temp &0xff ); +cpu_m68k_set_ccr (env, temp);return 0 ;
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 1/2] linux-user: correctly manage SR in ucontext
Quoted 7 lines · Laurent Vivier
Use cpu_m68k_get_ccr()/cpu_m68k_set_ccr() to setup and restore correctly the value of SR in the ucontext structure
Signed-off-by Laurent Vivier <[email protected]>--- linux-user/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
r~
PATCH 2/2 linux-user: fix do_rt_sigreturn on m68k linux userspace emulation
In reply to Laurent VivierFrom: Michael Karcher <[email protected]>
do_rt_sigreturn uses an uninitialised local variable instead of fetching the old signal mask directly from the signal frame when restoring the mask, so the signal mask is undefined after do_rt_sigreturn. As the signal frame data is in target-endian order, target_to_host_sigset instead of target_to_host_sigset_internal is required.
do_sigreturn is correct in using target_to_host_sigset_internal, because get_user already did the endianness conversion.
--- linux-user/signal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
linux-user/signal.c +1 -2
@@ -5670,14 +5670,13 @@ long do_rt_sigreturn(CPUM68KState *env) {struct target_rt_sigframe *frame;abi_ulong frame_addr = env->aregs[7 ] -4 ; -target_sigset_t target_set;sigset_t set;trace_user_do_rt_sigreturn (env, frame_addr);if (!lock_user_struct (VERIFY_READ , frame, frame_addr,1 )) goto badframe; -target_to_host_sigset_internal (&set, &target_set); +target_to_host_sigset (&set, &frame->uc.tuc_sigmask);set_sigmask (&set);/* restore registers */
Signature · 1 line
2.9.3
Re: [Qemu-devel] [PATCH 2/2] linux-user: fix do_rt_sigreturn on m68k linux userspace emulation
Quoted 8 lines · Laurent Vivier
From: Michael Karcher <[email protected]>
do_rt_sigreturnuses an uninitialised local variable instead of fetching the old signal mask directly from the signal frame when restoring the mask, so the signal mask is undefined afterdo_rt_sigreturn. As the signal frame data is in target-endian order,target_to_host_sigsetinstead oftarget_to_host_sigset_internalis required.
Quoted 8 lines
do_sigreturnis correct in usingtarget_to_host_sigset_internal, becauseget_useralready did the endianness conversion.Signed-off-by Michael Karcher <[email protected]>Signed-off-by Laurent Vivier <[email protected]>--- linux-user/signal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
r~