sotruss-lib.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Override generic sotruss-lib.c to define actual functions for MIPS.
  2. Copyright (C) 2012-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #define HAVE_ARCH_PLTENTER
  16. #define HAVE_ARCH_PLTEXIT
  17. #include <elf/sotruss-lib.c>
  18. #if _MIPS_SIM == _ABIO32
  19. ElfW(Addr)
  20. la_mips_o32_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
  21. unsigned int ndx __attribute__ ((unused)),
  22. uintptr_t *refcook, uintptr_t *defcook,
  23. La_mips_32_regs *regs, unsigned int *flags,
  24. const char *symname, long int *framesizep)
  25. {
  26. print_enter (refcook, defcook, symname,
  27. regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2],
  28. *flags);
  29. /* No need to copy anything, we will not need the parameters in any case. */
  30. *framesizep = 0;
  31. return sym->st_value;
  32. }
  33. unsigned int
  34. la_mips_o32_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
  35. uintptr_t *defcook,
  36. const struct La_mips_32_regs *inregs,
  37. struct La_mips_32_retval *outregs,
  38. const char *symname)
  39. {
  40. print_exit (refcook, defcook, symname, outregs->lrv_v0);
  41. return 0;
  42. }
  43. #elif _MIPS_SIM == _ABIN32
  44. ElfW(Addr)
  45. la_mips_n32_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
  46. unsigned int ndx __attribute__ ((unused)),
  47. uintptr_t *refcook, uintptr_t *defcook,
  48. La_mips_64_regs *regs, unsigned int *flags,
  49. const char *symname, long int *framesizep)
  50. {
  51. print_enter (refcook, defcook, symname,
  52. regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2],
  53. *flags);
  54. /* No need to copy anything, we will not need the parameters in any case. */
  55. *framesizep = 0;
  56. return sym->st_value;
  57. }
  58. unsigned int
  59. la_mips_n32_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
  60. uintptr_t *defcook,
  61. const struct La_mips_64_regs *inregs,
  62. struct La_mips_64_retval *outregs,
  63. const char *symname)
  64. {
  65. print_exit (refcook, defcook, symname, outregs->lrv_v0);
  66. return 0;
  67. }
  68. #else
  69. ElfW(Addr)
  70. la_mips_n64_gnu_pltenter (ElfW(Sym) *sym __attribute__ ((unused)),
  71. unsigned int ndx __attribute__ ((unused)),
  72. uintptr_t *refcook, uintptr_t *defcook,
  73. La_mips_64_regs *regs, unsigned int *flags,
  74. const char *symname, long int *framesizep)
  75. {
  76. print_enter (refcook, defcook, symname,
  77. regs->lr_reg[0], regs->lr_reg[1], regs->lr_reg[2],
  78. *flags);
  79. /* No need to copy anything, we will not need the parameters in any case. */
  80. *framesizep = 0;
  81. return sym->st_value;
  82. }
  83. unsigned int
  84. la_mips_n64_gnu_pltexit (ElfW(Sym) *sym, unsigned int ndx, uintptr_t *refcook,
  85. uintptr_t *defcook,
  86. const struct La_mips_64_regs *inregs,
  87. struct La_mips_64_retval *outregs,
  88. const char *symname)
  89. {
  90. print_exit (refcook, defcook, symname, outregs->lrv_v0);
  91. return 0;
  92. }
  93. #endif