sys32.S 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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_sigaltstack_wrapper:
  37. ldr x2, [sp, #S_COMPAT_SP]
  38. b compat_do_sigaltstack
  39. ENDPROC(compat_sys_sigaltstack_wrapper)
  40. compat_sys_statfs64_wrapper:
  41. mov w3, #84
  42. cmp w1, #88
  43. csel w1, w3, w1, eq
  44. b compat_sys_statfs64
  45. ENDPROC(compat_sys_statfs64_wrapper)
  46. compat_sys_fstatfs64_wrapper:
  47. mov w3, #84
  48. cmp w1, #88
  49. csel w1, w3, w1, eq
  50. b compat_sys_fstatfs64
  51. ENDPROC(compat_sys_fstatfs64_wrapper)
  52. /*
  53. * Wrappers for AArch32 syscalls that either take 64-bit parameters
  54. * in registers or that take 32-bit parameters which require sign
  55. * extension.
  56. */
  57. compat_sys_lseek_wrapper:
  58. sxtw x1, w1
  59. b sys_lseek
  60. ENDPROC(compat_sys_lseek_wrapper)
  61. compat_sys_pread64_wrapper:
  62. orr x3, x4, x5, lsl #32
  63. b sys_pread64
  64. ENDPROC(compat_sys_pread64_wrapper)
  65. compat_sys_pwrite64_wrapper:
  66. orr x3, x4, x5, lsl #32
  67. b sys_pwrite64
  68. ENDPROC(compat_sys_pwrite64_wrapper)
  69. compat_sys_truncate64_wrapper:
  70. orr x1, x2, x3, lsl #32
  71. b sys_truncate
  72. ENDPROC(compat_sys_truncate64_wrapper)
  73. compat_sys_ftruncate64_wrapper:
  74. orr x1, x2, x3, lsl #32
  75. b sys_ftruncate
  76. ENDPROC(compat_sys_ftruncate64_wrapper)
  77. compat_sys_readahead_wrapper:
  78. orr x1, x2, x3, lsl #32
  79. mov w2, w4
  80. b sys_readahead
  81. ENDPROC(compat_sys_readahead_wrapper)
  82. compat_sys_lookup_dcookie:
  83. orr x0, x0, x1, lsl #32
  84. mov w1, w2
  85. mov w2, w3
  86. b sys_lookup_dcookie
  87. ENDPROC(compat_sys_lookup_dcookie)
  88. compat_sys_fadvise64_64_wrapper:
  89. mov w6, w1
  90. orr x1, x2, x3, lsl #32
  91. orr x2, x4, x5, lsl #32
  92. mov w3, w6
  93. b sys_fadvise64_64
  94. ENDPROC(compat_sys_fadvise64_64_wrapper)
  95. compat_sys_sync_file_range2_wrapper:
  96. orr x2, x2, x3, lsl #32
  97. orr x3, x4, x5, lsl #32
  98. b sys_sync_file_range2
  99. ENDPROC(compat_sys_sync_file_range2_wrapper)
  100. compat_sys_fallocate_wrapper:
  101. orr x2, x2, x3, lsl #32
  102. orr x3, x4, x5, lsl #32
  103. b sys_fallocate
  104. ENDPROC(compat_sys_fallocate_wrapper)
  105. compat_sys_fanotify_mark_wrapper:
  106. orr x2, x2, x3, lsl #32
  107. mov w3, w4
  108. mov w4, w5
  109. b sys_fanotify_mark
  110. ENDPROC(compat_sys_fanotify_mark_wrapper)
  111. #undef __SYSCALL
  112. #define __SYSCALL(x, y) .quad y // x
  113. /*
  114. * The system calls table must be 4KB aligned.
  115. */
  116. .align 12
  117. ENTRY(compat_sys_call_table)
  118. #include <asm/unistd32.h>