sysdep.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * Assembler macros for Meta.
  3. *
  4. * Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  5. */
  6. #include <common/sysdep.h>
  7. #include <features.h>
  8. #include <libc-internal.h>
  9. #ifdef __ASSEMBLER__
  10. #ifdef SHARED
  11. #define PLTJMP(_x) _x##@PLT
  12. #else
  13. #define PLTJMP(_x) _x
  14. #endif
  15. #undef PSEUDO_END
  16. #define PSEUDO_END(name) \
  17. SYSCALL_ERROR_HANDLER \
  18. END (name)
  19. #if defined NOT_IN_libc
  20. # define SYSCALL_ERROR __local_syscall_error
  21. # ifdef RTLD_PRIVATE_ERRNO
  22. # define SYSCALL_ERROR_HANDLER \
  23. __local_syscall_error: \
  24. NEG D0Re0, D0Re0; \
  25. ADDT D1Re0, CPC1, #HI(_rtld_errno); \
  26. ADD D1Re0, D1Re0, #LO(_rtld_errno) + 4; \
  27. SETD [D1Re0], D0Re0; \
  28. NEG D0Re0, #0x1; \
  29. MOV PC, D1RtP;
  30. # else
  31. # define SYSCALL_ERROR_HANDLER \
  32. __local_syscall_error: \
  33. MOV D1Re0, D1RtP; \
  34. SETL [A0StP++], D0Re0, D1Re0; \
  35. CALLR D1RtP, PLTJMP(___errno_location); \
  36. GETD D1Re0, [A0StP+#-8]; \
  37. NEG D1Re0, D1Re0; \
  38. SETD [D0Re0], D1Re0; \
  39. NEG D0Re0, #0x1; \
  40. GETD D1RtP, [A0StP+#-4]; \
  41. SUB A0StP, A0StP, #0x8; \
  42. MOV PC, D1RtP;
  43. # endif
  44. #else
  45. # define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
  46. # define SYSCALL_ERROR ___syscall_error
  47. #endif
  48. #endif /* __ASSEMBLER __*/
  49. /* Pointer mangling is not yet supported for META. */
  50. #define PTR_MANGLE(var) (void) (var)
  51. #define PTR_DEMANGLE(var) (void) (var)