OLD | NEW |
1 // Use of this source file is governed by a BSD-style | 1 // Use of this source file is governed by a BSD-style |
2 // license that can be found in the LICENSE file.` | 2 // license that can be found in the LICENSE file.` |
3 | 3 |
4 #include "runtime.h" | 4 #include "runtime.h" |
5 #include "defs.h" | 5 #include "defs.h" |
6 #include "signals.h" | |
7 #include "os.h" | 6 #include "os.h" |
8 | 7 |
9 extern SigTab sigtab[]; | 8 extern SigTab sigtab[]; |
| 9 extern int32 sys_umtx_op(uint32*, int32, uint32, void*, void*); |
10 | 10 |
11 // FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and | 11 // FreeBSD's umtx_op syscall is effectively the same as Linux's futex, and |
12 // thus the code is largely similar. See linux/thread.c for comments. | 12 // thus the code is largely similar. See linux/thread.c for comments. |
13 | 13 |
14 static void | 14 static void |
15 umtx_wait(uint32 *addr, uint32 val) | 15 umtx_wait(uint32 *addr, uint32 val) |
16 { | 16 { |
17 int32 ret; | 17 int32 ret; |
18 | 18 |
19 ret = sys_umtx_op(addr, UMTX_OP_WAIT, val, nil, nil); | 19 ret = sys_umtx_op(addr, UMTX_OP_WAIT, val, nil, nil); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 void· | 95 void· |
96 unlock(Lock *l) | 96 unlock(Lock *l) |
97 { | 97 { |
98 m->locks--; | 98 m->locks--; |
99 if(m->locks < 0) | 99 if(m->locks < 0) |
100 throw("lock count"); | 100 throw("lock count"); |
101 umtx_unlock(l); | 101 umtx_unlock(l); |
102 } | 102 } |
103 | 103 |
104 void | 104 void |
105 destroylock(Lock *l) | 105 destroylock(Lock*) |
106 { | 106 { |
107 } | 107 } |
108 | 108 |
109 // Event notifications. | 109 // Event notifications. |
110 void | 110 void |
111 noteclear(Note *n) | 111 noteclear(Note *n) |
112 { | 112 { |
113 n->lock.key = 0; | 113 n->lock.key = 0; |
114 umtx_lock(&n->lock); | 114 umtx_lock(&n->lock); |
115 } | 115 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 switch(g->sigcode0) { | 188 switch(g->sigcode0) { |
189 case FPE_INTDIV: | 189 case FPE_INTDIV: |
190 panicstring("integer divide by zero"); | 190 panicstring("integer divide by zero"); |
191 case FPE_INTOVF: | 191 case FPE_INTOVF: |
192 panicstring("integer overflow"); | 192 panicstring("integer overflow"); |
193 } | 193 } |
194 panicstring("floating point error"); | 194 panicstring("floating point error"); |
195 } | 195 } |
196 panicstring(sigtab[g->sig].name); | 196 panicstring(sigtab[g->sig].name); |
197 } | 197 } |
OLD | NEW |