asm_nacl_arm.s 981 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2014 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. #include "../../cmd/ld/textflag.h" // TODO: how to refer to this?
  5. #include "../runtime/syscall_nacl.h" // TODO: how to refer to this?
  6. //
  7. // System call support for ARM, Native Client
  8. //
  9. #define NACL_SYSCALL(code) \
  10. MOVW $(0x10000 + ((code)<<5)), R8; BL (R8)
  11. #define NACL_SYSJMP(code) \
  12. MOVW $(0x10000 + ((code)<<5)), R8; B (R8)
  13. TEXT unix·Syscall(SB),NOSPLIT,$0-28
  14. BL runtime·entersyscall(SB)
  15. MOVW trap+0(FP), R8
  16. MOVW a1+4(FP), R0
  17. MOVW a2+8(FP), R1
  18. MOVW a3+12(FP), R2
  19. // more args would use R3, and then stack.
  20. MOVW $0x10000, R7
  21. ADD R8<<5, R7
  22. BL (R7)
  23. CMP $0, R0
  24. BGE ok
  25. MOVW $-1, R1
  26. MOVW R1, r1+16(FP)
  27. MOVW R1, r2+20(FP)
  28. RSB $0, R0
  29. MOVW R0, err+24(FP)
  30. BL runtime·exitsyscall(SB)
  31. RET
  32. ok:
  33. MOVW R0, r1+16(FP)
  34. MOVW R1, r2+20(FP)
  35. MOVW $0, R2
  36. MOVW R2, err+24(FP)
  37. BL runtime·exitsyscall(SB)
  38. RET