[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 08/10] arm: compile memshr



On Fri, 2012-02-10 at 12:02 +0000, Stefano Stabellini wrote:
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

I'm a little surprised we don't have some more "utils" type place to put
these but since it was already like this:

Acked-by: Ian Campbell <Ian.campbell@xxxxxxxxxx>

> ---
>  tools/memshr/bidir-hash.c |   31 +++++++++++++++++++++++++++++++
>  1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/memshr/bidir-hash.c b/tools/memshr/bidir-hash.c
> index 6c0dc3d..45d473e 100644
> --- a/tools/memshr/bidir-hash.c
> +++ b/tools/memshr/bidir-hash.c
> @@ -109,6 +109,37 @@ static void      hash_resize(struct __hash *h);
>  } while (0)
>  static inline void atomic_inc(uint32_t *v) { ia64_fetchadd4_rel(v, 1); }
>  static inline void atomic_dec(uint32_t *v) { ia64_fetchadd4_rel(v, -1); }
> +#elif defined(__arm__)
> +static inline void atomic_inc(uint32_t *v)
> +{
> +        unsigned long tmp;
> +        int result;
> +
> +        __asm__ __volatile__("@ atomic_add\n"
> +"1:     ldrex   %0, [%3]\n"
> +"       add     %0, %0, #1\n"
> +"       strex   %1, %0, [%3]\n"
> +"       teq     %1, #0\n"
> +"       bne     1b"
> +        : "=&r" (result), "=&r" (tmp), "+Qo" (*v)
> +        : "r" (v)
> +        : "cc");
> +}
> +static inline void atomic_dec(uint32_t *v)
> +{
> +        unsigned long tmp;
> +        int result;
> +
> +        __asm__ __volatile__("@ atomic_sub\n"
> +"1:     ldrex   %0, [%3]\n"
> +"       sub     %0, %0, #1\n"
> +"       strex   %1, %0, [%3]\n"
> +"       teq     %1, #0\n"
> +"       bne     1b"
> +        : "=&r" (result), "=&r" (tmp), "+Qo" (*v)
> +        : "r" (v)
> +        : "cc");
> +}
>  #else /* __x86__ */
>  static inline void atomic_inc(uint32_t *v)
>  {



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.