diff mbox

[1/3] tcg-alpha: Fix type mismatch errors in cpu_signal_handler.

Message ID 1348942239-3081-2-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson Sept. 29, 2012, 6:10 p.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 user-exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Stefan Weil Sept. 29, 2012, 6:26 p.m. UTC | #1
Am 29.09.2012 20:10, schrieb Richard Henderson:
> Signed-off-by: Richard Henderson<rth@twiddle.net>
> ---
>   user-exec.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/user-exec.c b/user-exec.c
> index ef9b172..1635e4a 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -352,8 +352,8 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>   {
>       siginfo_t *info = pinfo;
>       struct ucontext *uc = puc;
> -    uint32_t *pc = uc->uc_mcontext.sc_pc;
> -    uint32_t insn = *pc;
> +    unsigned long pc = uc->uc_mcontext.sc_pc;
>    

I'd prefer uintptr_t instead of unsigned long.
Otherwise the following type cast is not portable
(even if that doesn't matter currently because
that code is not compiled with MinGW).

Yes, there is more similar code in user-exec.c.

> +    uint32_t insn = *(uint32_t *)pc;
>       int is_write = 0;
>
>       /* XXX: need kernel patch to get write flag faster */
>    


Regards

Stefan W.
Aurelien Jarno Oct. 22, 2012, 9:39 p.m. UTC | #2
On Sat, Sep 29, 2012 at 11:10:37AM -0700, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  user-exec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/user-exec.c b/user-exec.c
> index ef9b172..1635e4a 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -352,8 +352,8 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>  {
>      siginfo_t *info = pinfo;
>      struct ucontext *uc = puc;
> -    uint32_t *pc = uc->uc_mcontext.sc_pc;
> -    uint32_t insn = *pc;
> +    unsigned long pc = uc->uc_mcontext.sc_pc;
> +    uint32_t insn = *(uint32_t *)pc;
>      int is_write = 0;
>  
>      /* XXX: need kernel patch to get write flag faster */

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
diff mbox

Patch

diff --git a/user-exec.c b/user-exec.c
index ef9b172..1635e4a 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -352,8 +352,8 @@  int cpu_signal_handler(int host_signum, void *pinfo,
 {
     siginfo_t *info = pinfo;
     struct ucontext *uc = puc;
-    uint32_t *pc = uc->uc_mcontext.sc_pc;
-    uint32_t insn = *pc;
+    unsigned long pc = uc->uc_mcontext.sc_pc;
+    uint32_t insn = *(uint32_t *)pc;
     int is_write = 0;
 
     /* XXX: need kernel patch to get write flag faster */