xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: david.vrabel@citrix.com, Ian.Campbell@citrix.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Tim.Deegan@citrix.com
Subject: [PATCH v7 2/8] arm: compile memshr
Date: Tue, 29 May 2012 14:41:30 +0100	[thread overview]
Message-ID: <1338298896-27411-2-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1205281826060.26786@kaball-desktop>

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <Ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 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)
 {
-- 
1.7.2.5

  parent reply	other threads:[~2012-05-29 13:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 13:40 [PATCH v7 0/8] arm: compile tools Stefano Stabellini
2012-05-29 13:41 ` [PATCH v7 1/8] arm: compile libxenguest Stefano Stabellini
2012-05-29 13:41 ` Stefano Stabellini [this message]
2012-05-29 13:41 ` [PATCH v7 3/8] arm: compile xentrace Stefano Stabellini
2012-05-29 13:41 ` [PATCH v7 4/8] arm: compile libxl Stefano Stabellini
2012-05-30  7:55   ` Ian Campbell
2012-05-29 13:41 ` [PATCH v7 5/8] libxl: Introduce libxl__arch_domain_create Stefano Stabellini
2012-05-29 13:41 ` [PATCH v7 6/8] libxl: Introduce libxl__arch_domain_create (x86 version) Stefano Stabellini
2012-05-30  7:54   ` Ian Campbell
2012-05-29 13:41 ` [PATCH v7 7/8] libxl: move e820_names, e820_sanitize, libxl__e820_alloc to libxl_x86.c Stefano Stabellini
2012-05-29 13:41 ` [PATCH v7 8/8] libxl: make libxl__e820_alloc a static function Stefano Stabellini
2012-05-29 15:56 ` [PATCH v7 0/8] arm: compile tools Stefano Stabellini
2012-05-29 16:00   ` Ian Campbell
2012-05-29 16:04     ` Ian Jackson
2012-05-30  7:58   ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1338298896-27411-2-git-send-email-stefano.stabellini@eu.citrix.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Tim.Deegan@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).