On Thu, Feb 21, 2013 at 03:57:38PM +0000, Steve Capper wrote:
> Supply some ARM signal handler code for icache-hygiene, and an ARM icache
> flush function.
> 
> Signed-off-by: Steve Capper <steve.cap...@arm.com>
> ---
>  tests/icache-hygiene.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/icache-hygiene.c b/tests/icache-hygiene.c
> index eb64a62..c1f2f66 100644
> --- a/tests/icache-hygiene.c
> +++ b/tests/icache-hygiene.c
> @@ -52,8 +52,10 @@ static long hpage_size;
>  
>  static void cacheflush(void *p)
>  {
> -#ifdef __powerpc__
> +#if defined(__powerpc__)
>       asm volatile("dcbst 0,%0; sync; icbi 0,%0; isync" : : "r"(p));
> +#elif defined(__arm__)
> +     __clear_cache(p, p + COPY_SIZE);
>  #endif
>  }
>  
> @@ -97,7 +99,7 @@ static void sig_handler(int signum, siginfo_t *si, void *uc)
>               }
>               FAIL("SIGILL somewhere unexpected");
>       }
> -#elif defined(__i386__) || defined(__x86_64__)
> +#elif defined(__i386__) || defined(__x86_64__) || defined(__arm__)
>       /* On x86, zero bytes form a valid instruction:
>        *      add %al,(%eax)          (i386)
>        * or   add %al,(%rax)          (x86_64)

It would be nice to update this comment for the arm case.  Basically
what exactly is going on when executing a page of zeroes - on x86 we
execute right through it harmlessly, then get a SEGV when we run off
the end.  Is that the same for arm?  Could the 0-bits instruction have
any side effects?

> @@ -121,10 +123,12 @@ static void sig_handler(int signum, siginfo_t *si, void 
> *uc)
>               FAIL("SIGBUS somewhere unexpected");
>       }
>       if (signum == SIGSEGV) {
> -#ifdef __x86_64__
> +#if defined(__x86_64__)
>               void *pc = (void *)((ucontext_t 
> *)uc)->uc_mcontext.gregs[REG_RIP];
> -#else
> +#elif defined(__i386__)
>               void *pc = (void *)((ucontext_t 
> *)uc)->uc_mcontext.gregs[REG_EIP];
> +#elif defined(__arm__)
> +             void *pc = (void *)((ucontext_t 
> *)uc)->uc_mcontext.fault_address;
>  #endif
>  
>               verbose_printf("SIGSEGV at %p, PC=%p (sig_expected=%p)\n",

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: Digital signature

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Libhugetlbfs-devel mailing list
Libhugetlbfs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel

Reply via email to