Patchwork alpha-linux-user: Fill in SI_CODE for SIGSEGV.

login
register
mail settings
Submitter Richard Henderson
Date May 21, 2010, 5:03 p.m.
Message ID <1274461413-23443-1-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/53194/
State New
Headers show

Comments

Richard Henderson - May 21, 2010, 5:03 p.m.
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 linux-user/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Aurelien Jarno - May 28, 2010, 10:09 p.m.
On Fri, May 21, 2010 at 10:03:33AM -0700, Richard Henderson wrote:
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  linux-user/main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Thanks, applied.

> diff --git a/linux-user/main.c b/linux-user/main.c
> index b240f29..de1076b 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -2433,7 +2433,8 @@ void cpu_loop (CPUState *env)
>              env->lock_addr = -1;
>              info.si_signo = TARGET_SIGSEGV;
>              info.si_errno = 0;
> -            info.si_code = 0;  /* ??? SEGV_MAPERR vs SEGV_ACCERR.  */
> +            info.si_code = (page_get_flags(env->ipr[IPR_EXC_ADDR]) & PAGE_VALID
> +                            ? TARGET_SEGV_ACCERR : TARGET_SEGV_MAPERR);
>              info._sifields._sigfault._addr = env->ipr[IPR_EXC_ADDR];
>              queue_signal(env, info.si_signo, &info);
>              break;
> -- 
> 1.7.0.1
> 
> 
>

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index b240f29..de1076b 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2433,7 +2433,8 @@  void cpu_loop (CPUState *env)
             env->lock_addr = -1;
             info.si_signo = TARGET_SIGSEGV;
             info.si_errno = 0;
-            info.si_code = 0;  /* ??? SEGV_MAPERR vs SEGV_ACCERR.  */
+            info.si_code = (page_get_flags(env->ipr[IPR_EXC_ADDR]) & PAGE_VALID
+                            ? TARGET_SEGV_ACCERR : TARGET_SEGV_MAPERR);
             info._sifields._sigfault._addr = env->ipr[IPR_EXC_ADDR];
             queue_signal(env, info.si_signo, &info);
             break;