blob: 458d6d41f2258cc02a211ce1c1c9416b09d7143c [file] [log] [blame]
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +00001#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
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000017SYS_FUNC(or1k_atomic)
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +000018{
Dmitry V. Levineebb5612015-07-20 21:18:14 +000019 printxval(atomic_ops, tcp->u_arg[0], "???");
20 switch(tcp->u_arg[0]) {
21 case OR1K_ATOMIC_SWAP:
22 tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
23 break;
24 case OR1K_ATOMIC_CMPXCHG:
25 tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2],
26 tcp->u_arg[3]);
27 break;
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +000028
Dmitry V. Levineebb5612015-07-20 21:18:14 +000029 case OR1K_ATOMIC_XCHG:
30 case OR1K_ATOMIC_ADD:
31 case OR1K_ATOMIC_AND:
32 case OR1K_ATOMIC_OR:
33 case OR1K_ATOMIC_UMAX:
34 case OR1K_ATOMIC_UMIN:
35 tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]);
36 break;
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +000037
Dmitry V. Levineebb5612015-07-20 21:18:14 +000038 case OR1K_ATOMIC_DECPOS:
39 tprintf(", 0x%lx", tcp->u_arg[1]);
40 break;
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +000041
Dmitry V. Levineebb5612015-07-20 21:18:14 +000042 default:
43 break;
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +000044 }
45
Dmitry V. Levineebb5612015-07-20 21:18:14 +000046 return RVAL_DECODED | RVAL_HEX;
Dmitry V. Levinf6eb0d62014-12-03 20:00:42 +000047}
48
49#endif /* OR1K */