summaryrefslogtreecommitdiff
path: root/includes/stg
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2015-05-28 02:57:28 +0000
committerErik de Castro Lopo <erikd@mega-nerd.com>2015-06-01 19:40:07 +1000
commitf6ca6959e54ede0b28735ab7e011c16b3cb172db (patch)
treee91c6daabedd093a0229605e6478a589dd682e1a /includes/stg
parentf5b43ce177e40a34afb1913bc0ec866185ed95d7 (diff)
downloadhaskell-f6ca6959e54ede0b28735ab7e011c16b3cb172db.tar.gz
rts: Fix aarch64 implementation of xchg
In the previous implementation, the `stlxr` instruction clobbered the value that was supposed to be returned by the the `xchg` function. Signed-off-by: Erik de Castro Lopo <erikd@mega-nerd.com> Test Plan: build on aarch64 Reviewers: austin, bgamari, rwbarton Subscribers: bgamari, thomie Differential Revision: https://phabricator.haskell.org/D932
Diffstat (limited to 'includes/stg')
-rw-r--r--includes/stg/SMP.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
index 10ef83ee13..fbc8bdcfa3 100644
--- a/includes/stg/SMP.h
+++ b/includes/stg/SMP.h
@@ -158,13 +158,11 @@ xchg(StgPtr p, StgWord w)
: "memory"
);
#elif aarch64_HOST_ARCH
- // Don't think we actually use tmp here, but leaving
- // it for consistent numbering
StgWord tmp;
__asm__ __volatile__ (
"1: ldaxr %0, [%3]\n"
- " stlxr %w0, %2, [%3]\n"
- " cbnz %w0, 1b\n"
+ " stlxr %w1, %2, [%3]\n"
+ " cbnz %w1, 1b\n"
" dmb sy\n"
: "=&r" (result), "=&r" (tmp)
: "r" (w), "r" (p)