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 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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-2017 The strace developers.
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. The name of the author may not be used to endorse or promote products
  16. * derived from this software without specific prior written permission.
  17. *
  18. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  19. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  20. * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  21. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  23. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  24. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  25. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  26. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  27. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. #include "defs.h"
  30. #ifdef OR1K
  31. #define OR1K_ATOMIC_SWAP 1
  32. #define OR1K_ATOMIC_CMPXCHG 2
  33. #define OR1K_ATOMIC_XCHG 3
  34. #define OR1K_ATOMIC_ADD 4
  35. #define OR1K_ATOMIC_DECPOS 5
  36. #define OR1K_ATOMIC_AND 6
  37. #define OR1K_ATOMIC_OR 7
  38. #define OR1K_ATOMIC_UMAX 8
  39. #define OR1K_ATOMIC_UMIN 9
  40. #include "xlat/atomic_ops.h"
  41. SYS_FUNC(or1k_atomic)
  42. {
  43. printxval64(atomic_ops, tcp->u_arg[0], "???");
  44. switch (tcp->u_arg[0]) {
  45. case OR1K_ATOMIC_SWAP:
  46. tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]);
  47. break;
  48. case OR1K_ATOMIC_CMPXCHG:
  49. tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2],
  50. tcp->u_arg[3]);
  51. break;
  52. case OR1K_ATOMIC_XCHG:
  53. case OR1K_ATOMIC_ADD:
  54. case OR1K_ATOMIC_AND:
  55. case OR1K_ATOMIC_OR:
  56. case OR1K_ATOMIC_UMAX:
  57. case OR1K_ATOMIC_UMIN:
  58. tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]);
  59. break;
  60. case OR1K_ATOMIC_DECPOS:
  61. tprintf(", 0x%lx", tcp->u_arg[1]);
  62. break;
  63. default:
  64. break;
  65. }
  66. return RVAL_DECODED | RVAL_HEX;
  67. }
  68. #endif /* OR1K */