syscalldb-api.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. diff --git a/elf/syscallas.S b/elf/syscallas.S
  2. new file mode 120000
  3. index 0000000..107bd13
  4. --- /dev/null
  5. +++ b/elf/syscallas.S
  6. @@ -0,0 +1 @@
  7. +../syscallas.S
  8. \ No newline at end of file
  9. diff --git a/elf/syscalldb.c b/elf/syscalldb.c
  10. new file mode 120000
  11. index 0000000..61dca52
  12. --- /dev/null
  13. +++ b/elf/syscalldb.c
  14. @@ -0,0 +1 @@
  15. +../syscalldb.c
  16. \ No newline at end of file
  17. diff --git a/syscallas.S b/syscallas.S
  18. new file mode 100644
  19. index 0000000..07c6ffc
  20. --- /dev/null
  21. +++ b/syscallas.S
  22. @@ -0,0 +1,11 @@
  23. +#include <syscalldb.h>
  24. +
  25. +.weak syscalldb
  26. +.type syscalldb,@function
  27. +
  28. +syscalldb:
  29. + .cfi_startproc
  30. + syscall
  31. + retq
  32. + .cfi_endproc
  33. + .size syscalldb,.-syscalldb
  34. diff --git a/syscalldb.c b/syscalldb.c
  35. new file mode 100644
  36. index 0000000..7a56162
  37. --- /dev/null
  38. +++ b/syscalldb.c
  39. @@ -0,0 +1,16 @@
  40. +#include "syscalldb.h"
  41. +#include <stdarg.h>
  42. +#include <errno.h>
  43. +
  44. +int register_library (const char * name, unsigned long load_address)
  45. + __attribute__((weak));
  46. +
  47. +int register_library (const char * name, unsigned long load_address)
  48. +{
  49. + return 0;
  50. +}
  51. +
  52. +long int glibc_option (const char * opt)
  53. +{
  54. + return -EINVAL;
  55. +}
  56. diff --git a/syscalldb.h b/syscalldb.h
  57. new file mode 100644
  58. index 0000000..2833def
  59. --- /dev/null
  60. +++ b/syscalldb.h
  61. @@ -0,0 +1,39 @@
  62. +#ifndef _SYSCALLDB_H_
  63. +#define _SYSCALLDB_H_
  64. +
  65. +#ifdef __ASSEMBLER__
  66. +.weak syscalldb
  67. +.type syscalldb, @function
  68. +
  69. +# if defined(PSEUDO) && defined(SYSCALL_NAME) && defined(SYSCALL_SYMBOL)
  70. +# define SYSCALLDB \
  71. + subq $128, %rsp; \
  72. + callq *syscalldb@GOTPCREL(%rip); \
  73. + addq $128, %rsp
  74. +# else
  75. +# define SYSCALLDB \
  76. + callq *syscalldb@GOTPCREL(%rip)
  77. +# endif
  78. +
  79. +#else /* !__ASSEMBLER__ */
  80. +asm (
  81. +".weak syscalldb\r\n"
  82. +".type syscalldb, @function\r\n");
  83. +
  84. +#define SYSCALLDB \
  85. + "subq $128, %%rsp\n\t" \
  86. + "callq *syscalldb@GOTPCREL(%%rip)\n\t" \
  87. + "addq $128, %%rsp\n\t"
  88. +
  89. +#define SYSCALLDB_ASM \
  90. + "callq *syscalldb@GOTPCREL(%rip)\n\t"
  91. +
  92. +long int glibc_option (const char * opt);
  93. +
  94. +asm (
  95. +".weak glibc_option\r\n"
  96. +".type glibc_option, @function\r\n");
  97. +
  98. +#endif /* Assembler */
  99. +
  100. +#endif /* _SYSCALLDB_H */
  101. diff --git a/sysdeps/unix/sysv/linux/x86_64/syscalldb.h b/sysdeps/unix/sysv/linux/x86_64/syscalldb.h
  102. new file mode 120000
  103. index 0000000..55ab305
  104. --- /dev/null
  105. +++ b/sysdeps/unix/sysv/linux/x86_64/syscalldb.h
  106. @@ -0,0 +1 @@
  107. +../../../../../syscalldb.h
  108. \ No newline at end of file