sys32.S 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Compat system call wrappers
  3. *
  4. * Copyright (C) 2012 ARM Ltd.
  5. * Authors: Will Deacon <will.deacon@arm.com>
  6. * Catalin Marinas <catalin.marinas@arm.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include <linux/linkage.h>
  21. #include <asm/assembler.h>
  22. #include <asm/asm-offsets.h>
  23. /*
  24. * System call wrappers for the AArch32 compatibility layer.
  25. */
  26. compat_sys_sigreturn_wrapper:
  27. mov x0, sp
  28. mov x27, #0 // prevent syscall restart handling (why)
  29. b compat_sys_sigreturn
  30. ENDPROC(compat_sys_sigreturn_wrapper)
  31. compat_sys_rt_sigreturn_wrapper:
  32. mov x0, sp
  33. mov x27, #0 // prevent syscall restart handling (why)
  34. b compat_sys_rt_sigreturn
  35. ENDPROC(compat_sys_rt_sigreturn_wrapper)
  36. compat_sys_statfs64_wrapper:
  37. mov w3, #84
  38. cmp w1, #88
  39. csel w1, w3, w1, eq
  40. b compat_sys_statfs64
  41. ENDPROC(compat_sys_statfs64_wrapper)
  42. compat_sys_fstatfs64_wrapper:
  43. mov w3, #84
  44. cmp w1, #88
  45. csel w1, w3, w1, eq
  46. b compat_sys_fstatfs64
  47. ENDPROC(compat_sys_fstatfs64_wrapper)
  48. /*
  49. * Wrappers for AArch32 syscalls that either take 64-bit parameters
  50. * in registers or that take 32-bit parameters which require sign
  51. * extension.
  52. */
  53. compat_sys_pread64_wrapper:
  54. orr x3, x4, x5, lsl #32
  55. b sys_pread64
  56. ENDPROC(compat_sys_pread64_wrapper)
  57. compat_sys_pwrite64_wrapper:
  58. orr x3, x4, x5, lsl #32
  59. b sys_pwrite64
  60. ENDPROC(compat_sys_pwrite64_wrapper)
  61. compat_sys_truncate64_wrapper:
  62. orr x1, x2, x3, lsl #32
  63. b sys_truncate
  64. ENDPROC(compat_sys_truncate64_wrapper)
  65. compat_sys_ftruncate64_wrapper:
  66. orr x1, x2, x3, lsl #32
  67. b sys_ftruncate
  68. ENDPROC(compat_sys_ftruncate64_wrapper)
  69. compat_sys_readahead_wrapper:
  70. orr x1, x2, x3, lsl #32
  71. mov w2, w4
  72. b sys_readahead
  73. ENDPROC(compat_sys_readahead_wrapper)
  74. compat_sys_lookup_dcookie:
  75. orr x0, x0, x1, lsl #32
  76. mov w1, w2
  77. mov w2, w3
  78. b sys_lookup_dcookie
  79. ENDPROC(compat_sys_lookup_dcookie)
  80. compat_sys_fadvise64_64_wrapper:
  81. mov w6, w1
  82. orr x1, x2, x3, lsl #32
  83. orr x2, x4, x5, lsl #32
  84. mov w3, w6
  85. b sys_fadvise64_64
  86. ENDPROC(compat_sys_fadvise64_64_wrapper)
  87. compat_sys_sync_file_range2_wrapper:
  88. orr x2, x2, x3, lsl #32
  89. orr x3, x4, x5, lsl #32
  90. b sys_sync_file_range2
  91. ENDPROC(compat_sys_sync_file_range2_wrapper)
  92. compat_sys_fallocate_wrapper:
  93. orr x2, x2, x3, lsl #32
  94. orr x3, x4, x5, lsl #32
  95. b sys_fallocate
  96. ENDPROC(compat_sys_fallocate_wrapper)
  97. compat_sys_fanotify_mark_wrapper:
  98. orr x2, x2, x3, lsl #32
  99. mov w3, w4
  100. mov w4, w5
  101. b sys_fanotify_mark
  102. ENDPROC(compat_sys_fanotify_mark_wrapper)
  103. #undef __SYSCALL
  104. #define __SYSCALL(x, y) .quad y // x
  105. /*
  106. * The system calls table must be 4KB aligned.
  107. */
  108. .align 12
  109. ENTRY(compat_sys_call_table)
  110. #include <asm/unistd32.h>