sys32.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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_fadvise64_64_wrapper:
  75. mov w6, w1
  76. orr x1, x2, x3, lsl #32
  77. orr x2, x4, x5, lsl #32
  78. mov w3, w6
  79. b sys_fadvise64_64
  80. ENDPROC(compat_sys_fadvise64_64_wrapper)
  81. compat_sys_sync_file_range2_wrapper:
  82. orr x2, x2, x3, lsl #32
  83. orr x3, x4, x5, lsl #32
  84. b sys_sync_file_range2
  85. ENDPROC(compat_sys_sync_file_range2_wrapper)
  86. compat_sys_fallocate_wrapper:
  87. orr x2, x2, x3, lsl #32
  88. orr x3, x4, x5, lsl #32
  89. b sys_fallocate
  90. ENDPROC(compat_sys_fallocate_wrapper)
  91. #undef __SYSCALL
  92. #define __SYSCALL(x, y) .quad y // x
  93. /*
  94. * The system calls table must be 4KB aligned.
  95. */
  96. .align 12
  97. ENTRY(compat_sys_call_table)
  98. #include <asm/unistd32.h>