Mirror of strace – the linux syscall tracer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

or1k_atomic.c 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * Copyright (c) 2013 Christian Svensson <blue@cmd.nu>
  3. * Copyright (c) 2014-2015 Dmitry V. Levin <ldv@altlinux.org>
  4. * Copyright (c) 2014-2018 The strace developers.
  5. * All rights reserved.
  6. *
  7. * SPDX-License-Identifier: LGPL-2.1-or-later
  8. */
  9. #include "defs.h"
  10. #ifdef OR1K
  11. # define OR1K_ATOMIC_SWAP 1
  12. # define OR1K_ATOMIC_CMPXCHG 2
  13. # define OR1K_ATOMIC_XCHG 3
  14. # define OR1K_ATOMIC_ADD 4
  15. # define OR1K_ATOMIC_DECPOS 5
  16. # define OR1K_ATOMIC_AND 6
  17. # define OR1K_ATOMIC_OR 7
  18. # define OR1K_ATOMIC_UMAX 8
  19. # define OR1K_ATOMIC_UMIN 9
  20. # include "xlat/atomic_ops.h"
  21. SYS_FUNC(or1k_atomic)
  22. {
  23. printxval64(atomic_ops, tcp->u_arg[0], "???");
  24. switch (tcp->u_arg[0]) {
  25. case OR1K_ATOMIC_SWAP:
  26. tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
  27. break;
  28. case OR1K_ATOMIC_CMPXCHG:
  29. tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2],
  30. tcp->u_arg[3]);
  31. break;
  32. case OR1K_ATOMIC_XCHG:
  33. case OR1K_ATOMIC_ADD:
  34. case OR1K_ATOMIC_AND:
  35. case OR1K_ATOMIC_OR:
  36. case OR1K_ATOMIC_UMAX:
  37. case OR1K_ATOMIC_UMIN:
  38. tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]);
  39. break;
  40. case OR1K_ATOMIC_DECPOS:
  41. tprintf(", 0x%lx", tcp->u_arg[1]);
  42. break;
  43. default:
  44. break;
  45. }
  46. return RVAL_DECODED | RVAL_HEX;
  47. }
  48. #endif /* OR1K */