Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/m68k/include m68k: __cpu_simple_unlock audit.
details: https://anonhg.NetBSD.org/src/rev/d92f37b4b30f
branches: trunk
changeset: 361541:d92f37b4b30f
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Feb 13 13:41:44 2022 +0000
description:
m68k: __cpu_simple_unlock audit.
- Use `cc' clobbers in asm volatile because they touch the condition
codes.
- Use `memory' clobbers in asm volatile so the compiler doesn't move
up loads and stores in the critical section at _other_ addresses
than the lock so they happen before __cpu_simple_lock or
__cpu_simple_lock_try.
- Not sure if we have any (or if there even are any?) multicore m68k
systems out there, but __cpu_simple_unlock needs __insn_barrier
either way so the compiler doesn't delay loads and stores prior to
__cpu_simple_unlock so they happen after it.
diffstat:
sys/arch/m68k/include/lock.h | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diffs (39 lines):
diff -r 2b7d5131b714 -r d92f37b4b30f sys/arch/m68k/include/lock.h
--- a/sys/arch/m68k/include/lock.h Sun Feb 13 13:41:26 2022 +0000
+++ b/sys/arch/m68k/include/lock.h Sun Feb 13 13:41:44 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lock.h,v 1.16 2019/11/29 20:05:49 riastradh Exp $ */
+/* $NetBSD: lock.h,v 1.17 2022/02/13 13:41:44 riastradh Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -75,7 +75,9 @@
__asm volatile(
"1: tas %0 \n"
" jne 1b \n"
- : "=m" (*alp));
+ : "=m" (*alp)
+ : /* no inputs */
+ : "cc", "memory");
}
static __inline int
@@ -89,7 +91,9 @@
" jeq 1f \n"
" moveq #0, %1 \n"
"1: \n"
- : "=m" (*alp), "=d" (__rv));
+ : "=m" (*alp), "=d" (__rv)
+ : /* no inputs */
+ : "cc", "memory");
return (__rv);
}
@@ -98,6 +102,7 @@
__cpu_simple_unlock(__cpu_simple_lock_t *alp)
{
+ __insn_barrier();
*alp = __SIMPLELOCK_UNLOCKED;
}
Home |
Main Index |
Thread Index |
Old Index