1 | --- include/mutex.h.orig 2001-05-06 21:19:20.000000000 +0800 |
---|
2 | +++ include/mutex.h 2004-02-13 06:18:17.000000000 +0800 |
---|
3 | @@ -482,6 +482,31 @@ |
---|
4 | * 'set' mutexes have the value 1, like on Intel; the returned value from |
---|
5 | * MUTEX_SET() is 1 if the mutex previously had its low bit clear, 0 otherwise. |
---|
6 | */ |
---|
7 | +#if defined(__APPLE__) && defined(__MACH__) && defined(__ppc__) |
---|
8 | +#warning "Using apple specific mutexes" |
---|
9 | +extern int __db_mutex_set __P((volatile tsl_t *)); |
---|
10 | +void |
---|
11 | +__db_mutex_tas_dummy() |
---|
12 | +{ |
---|
13 | + __asm__ __volatile__(" \n\ |
---|
14 | + .globl ___db_mutex_set \n\ |
---|
15 | +___db_mutex_set: \n\ |
---|
16 | + lwarx r5,0,r3 \n\ |
---|
17 | + cmpwi r5,0 \n\ |
---|
18 | + bne fail \n\ |
---|
19 | + addi r5,r5,1 \n\ |
---|
20 | + stwcx. r5,0,r3 \n\ |
---|
21 | + beq success \n\ |
---|
22 | +fail: \n\ |
---|
23 | + li r3,0 \n\ |
---|
24 | + blr \n\ |
---|
25 | +success: \n\ |
---|
26 | + li r3,1 \n\ |
---|
27 | + blr"); |
---|
28 | +} |
---|
29 | +#define MUTEX_SET(tsl) __db_mutex_set(tsl) |
---|
30 | +#else |
---|
31 | + |
---|
32 | #define MUTEX_SET(tsl) ({ \ |
---|
33 | int __one = 1; \ |
---|
34 | int __r; \ |
---|
35 | @@ -499,6 +524,7 @@ |
---|
36 | !(__r & 1); \ |
---|
37 | }) |
---|
38 | |
---|
39 | +#endif |
---|
40 | #define MUTEX_UNSET(tsl) (*(tsl) = 0) |
---|
41 | #define MUTEX_INIT(tsl) MUTEX_UNSET(tsl) |
---|
42 | #endif |
---|