Patchwork [1/2] user-exec.c: aarch64 initial implementation of cpu_signal_handler

login
register
mail settings
Submitter Claudio Fontana
Date June 5, 2013, 1:42 p.m.
Message ID <51AF4028.5030504@huawei.com>
Download mbox | patch
Permalink /patch/249065/
State New
Headers show

Comments

Claudio Fontana - June 5, 2013, 1:42 p.m.
Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>

---
 user-exec.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
Peter Maydell - June 5, 2013, 5:38 p.m.
On 5 June 2013 14:42, Claudio Fontana <claudio.fontana@huawei.com> wrote:
>
> Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
>
> ---
>  user-exec.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/user-exec.c b/user-exec.c
> index 71bd6c5..fa7f1f1 100644
> --- a/user-exec.c
> +++ b/user-exec.c
> @@ -448,6 +448,21 @@ int cpu_signal_handler(int host_signum, void *pinfo,
>                               &uc->uc_sigmask, puc);
>  }
>
> +#elif defined(__aarch64__)
> +
> +int cpu_signal_handler(int host_signum, void *pinfo,
> +                       void *puc)
> +{
> +    siginfo_t *info = pinfo;
> +    struct ucontext *uc = puc;
> +    uint64_t pc;
> +    int is_write = 0; /* XXX how to determine? */

The long-term answer to this XXX, incidentally, is that
I need to persuade the kernel folk to expose the ESR (or
at a minimum its WnR bit) to userspace. For the moment,
always-0 is what other archs are doing here. (I'd rather
not get into the "read and interpret faulting instruction"
game if we can get the kernel fixed, given we're at a
pretty early stage in aarch64 adoption/rollout.)

> +
> +    pc = uc->uc_mcontext.pc;
> +    return handle_cpu_signal(pc, (uint64_t)info->si_addr,
> +                             is_write, &uc->uc_sigmask, puc);
> +}
> +

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM

Patch

diff --git a/user-exec.c b/user-exec.c
index 71bd6c5..fa7f1f1 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -448,6 +448,21 @@  int cpu_signal_handler(int host_signum, void *pinfo,
                              &uc->uc_sigmask, puc);
 }
 
+#elif defined(__aarch64__)
+
+int cpu_signal_handler(int host_signum, void *pinfo,
+                       void *puc)
+{
+    siginfo_t *info = pinfo;
+    struct ucontext *uc = puc;
+    uint64_t pc;
+    int is_write = 0; /* XXX how to determine? */
+
+    pc = uc->uc_mcontext.pc;
+    return handle_cpu_signal(pc, (uint64_t)info->si_addr,
+                             is_write, &uc->uc_sigmask, puc);
+}
+
 #elif defined(__mc68000)
 
 int cpu_signal_handler(int host_signum, void *pinfo,