Sun Feb 13 13:41:53 2022 UTC ()
sh3: __cpu_simple_unlock needs __insn_barrier.

No multiprocessor support here but the compiler can still reorder
memory access.


(riastradh)
diff -r1.18 -r1.19 src/sys/arch/sh3/include/lock.h

cvs diff -r1.18 -r1.19 src/sys/arch/sh3/include/lock.h (expand / switch to unified diff)

--- src/sys/arch/sh3/include/lock.h 2019/11/29 20:06:08 1.18
+++ src/sys/arch/sh3/include/lock.h 2022/02/13 13:41:53 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: lock.h,v 1.18 2019/11/29 20:06:08 riastradh Exp $ */ 1/* $NetBSD: lock.h,v 1.19 2022/02/13 13:41:53 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2002 The NetBSD Foundation, Inc. 4 * Copyright (c) 2002 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Gregory McGarry. 8 * by Gregory McGarry.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -97,17 +97,18 @@ __cpu_simple_lock_try(__cpu_simple_lock_ @@ -97,17 +97,18 @@ __cpu_simple_lock_try(__cpu_simple_lock_
97 " tas.b @%1 \n" 97 " tas.b @%1 \n"
98 " movt %0 \n" 98 " movt %0 \n"
99 : "=r" (__rv) 99 : "=r" (__rv)
100 : "r" (alp) 100 : "r" (alp)
101 : "cc", "memory"); 101 : "cc", "memory");
102 102
103 return (__rv); 103 return (__rv);
104} 104}
105 105
106static __inline void 106static __inline void
107__cpu_simple_unlock(__cpu_simple_lock_t *alp) 107__cpu_simple_unlock(__cpu_simple_lock_t *alp)
108{ 108{
109 109
 110 __insn_barrier();
110 *alp = __SIMPLELOCK_UNLOCKED; 111 *alp = __SIMPLELOCK_UNLOCKED;
111} 112}
112 113
113#endif /* !_SH3_LOCK_H_ */ 114#endif /* !_SH3_LOCK_H_ */