diff options
author | Tzung-Bi Shih <tzungbi@chromium.org> | 2021-01-12 10:55:12 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-01-14 10:04:16 +0000 |
commit | 45651535396a735de6e000e090eaf05d9d32c335 (patch) | |
tree | e02e6b852128f2135307c70d2957416738b31416 | |
parent | 29c10ee122bddee940f9f7c81bb9961b01c25be6 (diff) | |
download | chrome-ec-45651535396a735de6e000e090eaf05d9d32c335.tar.gz |
core/riscv-rv32i: correct inline assembly constraint modifier
To make compiler translate the inline assembly well, use '&' modifier
to tell compiler that the `locked' variable is written before the
instruction is finished using the input operands[1].
[1]: https://gcc.gnu.org/onlinedocs/gcc/Modifiers.html#Modifiers
BRANCH=none
BUG=b:176959740
BUG=b:177287581
TEST=make BOARD=asurada_scp
Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org>
Change-Id: I3f6e5741afeaf98bf8f8e736c6d8db58daac6a17
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2623869
Reviewed-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
-rw-r--r-- | core/riscv-rv32i/task.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c index eef46efce7..ae1609e9a2 100644 --- a/core/riscv-rv32i/task.c +++ b/core/riscv-rv32i/task.c @@ -574,7 +574,7 @@ void __ram_code mutex_lock(struct mutex *mtx) "li %0, 2\n\t" /* attempt to acquire lock */ "amoswap.w.aq %0, %0, %1\n\t" - : "=r" (locked), "+A" (mtx->lock)); + : "=&r" (locked), "+A" (mtx->lock)); /* we got it ! */ if (!locked) break; |