entry32.S 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 <linux/const.h>
  22. #include <asm/assembler.h>
  23. #include <asm/asm-offsets.h>
  24. #include <asm/errno.h>
  25. #include <asm/page.h>
  26. /*
  27. * System call wrappers for the AArch32 compatibility layer.
  28. */
  29. ENTRY(compat_sys_sigreturn_wrapper)
  30. mov x0, sp
  31. b compat_sys_sigreturn
  32. ENDPROC(compat_sys_sigreturn_wrapper)
  33. ENTRY(compat_sys_rt_sigreturn_wrapper)
  34. mov x0, sp
  35. b compat_sys_rt_sigreturn
  36. ENDPROC(compat_sys_rt_sigreturn_wrapper)
  37. ENTRY(compat_sys_statfs64_wrapper)
  38. mov w3, #84
  39. cmp w1, #88
  40. csel w1, w3, w1, eq
  41. b compat_sys_statfs64
  42. ENDPROC(compat_sys_statfs64_wrapper)
  43. ENTRY(compat_sys_fstatfs64_wrapper)
  44. mov w3, #84
  45. cmp w1, #88
  46. csel w1, w3, w1, eq
  47. b compat_sys_fstatfs64
  48. ENDPROC(compat_sys_fstatfs64_wrapper)
  49. /*
  50. * Note: off_4k (w5) is always in units of 4K. If we can't do the
  51. * requested offset because it is not page-aligned, we return -EINVAL.
  52. */
  53. ENTRY(compat_sys_mmap2_wrapper)
  54. #if PAGE_SHIFT > 12
  55. tst w5, #~PAGE_MASK >> 12
  56. b.ne 1f
  57. lsr w5, w5, #PAGE_SHIFT - 12
  58. #endif
  59. b sys_mmap_pgoff
  60. 1: mov x0, #-EINVAL
  61. ret
  62. ENDPROC(compat_sys_mmap2_wrapper)
  63. /*
  64. * Wrappers for AArch32 syscalls that either take 64-bit parameters
  65. * in registers or that take 32-bit parameters which require sign
  66. * extension.
  67. */
  68. ENTRY(compat_sys_pread64_wrapper)
  69. regs_to_64 x3, x4, x5
  70. b sys_pread64
  71. ENDPROC(compat_sys_pread64_wrapper)
  72. ENTRY(compat_sys_pwrite64_wrapper)
  73. regs_to_64 x3, x4, x5
  74. b sys_pwrite64
  75. ENDPROC(compat_sys_pwrite64_wrapper)
  76. ENTRY(compat_sys_truncate64_wrapper)
  77. regs_to_64 x1, x2, x3
  78. b sys_truncate
  79. ENDPROC(compat_sys_truncate64_wrapper)
  80. ENTRY(compat_sys_ftruncate64_wrapper)
  81. regs_to_64 x1, x2, x3
  82. b sys_ftruncate
  83. ENDPROC(compat_sys_ftruncate64_wrapper)
  84. ENTRY(compat_sys_readahead_wrapper)
  85. regs_to_64 x1, x2, x3
  86. mov w2, w4
  87. b sys_readahead
  88. ENDPROC(compat_sys_readahead_wrapper)
  89. ENTRY(compat_sys_fadvise64_64_wrapper)
  90. mov w6, w1
  91. regs_to_64 x1, x2, x3
  92. regs_to_64 x2, x4, x5
  93. mov w3, w6
  94. b sys_fadvise64_64
  95. ENDPROC(compat_sys_fadvise64_64_wrapper)
  96. ENTRY(compat_sys_sync_file_range2_wrapper)
  97. regs_to_64 x2, x2, x3
  98. regs_to_64 x3, x4, x5
  99. b sys_sync_file_range2
  100. ENDPROC(compat_sys_sync_file_range2_wrapper)
  101. ENTRY(compat_sys_fallocate_wrapper)
  102. regs_to_64 x2, x2, x3
  103. regs_to_64 x3, x4, x5
  104. b sys_fallocate
  105. ENDPROC(compat_sys_fallocate_wrapper)