Re: [Qemu-devel] [PATCH] user-exec: alpha-host: Add type cast to avoid compiling warning

2015-08-16 Thread gchen gchen

Oh, it has been fixed, but did not merge into master branch.

commit b9b331a737f2cd34614355cc8facbbc49fc9816d
Author: Richard Henderson r...@twiddle.net
Date:   Fri Jan 29 15:28:51 2010 -0800

tcg-alpha: Fix type mismatch errors in cpu_signal_handler.

Signed-off-by: Richard Henderson r...@twiddle.net

diff --git a/user-exec.c b/user-exec.c
index bc58056..27c0f3d 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -358,8 +358,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 */



On 2015年08月12日 13:58, gchen gchen wrote:
 The related building warnings in alpha virtual machine:

 CCi386-linux-user/user-exec.o
   user-exec.c: In function 'cpu_x86_signal_handler':
   user-exec.c:363:20: error: initialization makes pointer from integer 
 without a cast [-Werror=int-conversion]
uint32_t *pc = uc-uc_mcontext.sc_pc;
   ^
   user-exec.c:383:30: error: passing argument 1 of 'handle_cpu_signal' makes 
 integer from pointer without a cast [-Werror=int-conversion]
return handle_cpu_signal(pc, (unsigned long)info-si_addr,
 ^
   user-exec.c:86:19: note: expected 'uintptr_t {aka long unsigned int}' but 
 argument is of type 'uint32_t * {aka unsigned int *}'
static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
  ^

 Signed-off-by: Chen Gang gang.chen.5...@gmail.com
 ---
  user-exec.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

 diff --git a/user-exec.c b/user-exec.c
 index ed9a07f..baaeb09 100644
 --- a/user-exec.c
 +++ b/user-exec.c
 @@ -360,7 +360,7 @@ 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 *pc = (uint32_t *)uc-uc_mcontext.sc_pc;
  uint32_t insn = *pc;
  int is_write = 0;

 @@ -380,7 +380,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
  is_write = 1;
  }

 -return handle_cpu_signal(pc, (unsigned long)info-si_addr,
 +return handle_cpu_signal((unsigned long)pc, (unsigned long)info-si_addr,
   is_write, uc-uc_sigmask, puc);
  }
  #elif defined(__sparc__)
 --
 1.9.1



--
Chen Gang

Open, share, and attitude like air, water, and life which God blessed
  

[Qemu-devel] [PATCH] user-exec: alpha-host: Add type cast to avoid compiling warning

2015-08-12 Thread gchen gchen
The related building warnings in alpha virtual machine:

CCi386-linux-user/user-exec.o
  user-exec.c: In function 'cpu_x86_signal_handler':
  user-exec.c:363:20: error: initialization makes pointer from integer without 
a cast [-Werror=int-conversion]
   uint32_t *pc = uc-uc_mcontext.sc_pc;
  ^
  user-exec.c:383:30: error: passing argument 1 of 'handle_cpu_signal' makes 
integer from pointer without a cast [-Werror=int-conversion]
   return handle_cpu_signal(pc, (unsigned long)info-si_addr,
^
  user-exec.c:86:19: note: expected 'uintptr_t {aka long unsigned int}' but 
argument is of type 'uint32_t * {aka unsigned int *}'
   static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 ^

Signed-off-by: Chen Gang gang.chen.5...@gmail.com
---
 user-exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/user-exec.c b/user-exec.c
index ed9a07f..baaeb09 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -360,7 +360,7 @@ 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 *pc = (uint32_t *)uc-uc_mcontext.sc_pc;
 uint32_t insn = *pc;
 int is_write = 0;

@@ -380,7 +380,7 @@ int cpu_signal_handler(int host_signum, void *pinfo,
 is_write = 1;
 }

-return handle_cpu_signal(pc, (unsigned long)info-si_addr,
+return handle_cpu_signal((unsigned long)pc, (unsigned long)info-si_addr,
  is_write, uc-uc_sigmask, puc);
 }
 #elif defined(__sparc__)
--
1.9.1