1 #include "defs.h"
2 
3 #ifdef OR1K
4 
5 #define OR1K_ATOMIC_SWAP        1
6 #define OR1K_ATOMIC_CMPXCHG     2
7 #define OR1K_ATOMIC_XCHG        3
8 #define OR1K_ATOMIC_ADD         4
9 #define OR1K_ATOMIC_DECPOS      5
10 #define OR1K_ATOMIC_AND         6
11 #define OR1K_ATOMIC_OR          7
12 #define OR1K_ATOMIC_UMAX        8
13 #define OR1K_ATOMIC_UMIN        9
14 
15 #include "xlat/atomic_ops.h"
16 
SYS_FUNC(or1k_atomic)17 SYS_FUNC(or1k_atomic)
18 {
19 	if (entering(tcp)) {
20 		printxval(atomic_ops, tcp->u_arg[0], "???");
21 		switch(tcp->u_arg[0]) {
22 		case OR1K_ATOMIC_SWAP:
23 			tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
24 			break;
25 		case OR1K_ATOMIC_CMPXCHG:
26 			tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2],
27 				tcp->u_arg[3]);
28 			break;
29 
30 		case OR1K_ATOMIC_XCHG:
31 		case OR1K_ATOMIC_ADD:
32 		case OR1K_ATOMIC_AND:
33 		case OR1K_ATOMIC_OR:
34 		case OR1K_ATOMIC_UMAX:
35 		case OR1K_ATOMIC_UMIN:
36 			tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]);
37 			break;
38 
39 		case OR1K_ATOMIC_DECPOS:
40 			tprintf(", 0x%lx", tcp->u_arg[1]);
41 			break;
42 
43 		default:
44 			break;
45 		}
46 	}
47 
48 	return RVAL_HEX;
49 }
50 
51 #endif /* OR1K */
52