_syscall.s 616 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #
  2. ! $Source: /cvsroot/tack/Ack/plat/linux386/libsys/_syscall.s,v $
  3. ! $State: Exp $
  4. ! $Revision: 1.1 $
  5. ! Declare segments (the order is important).
  6. .sect .text
  7. .sect .rom
  8. .sect .data
  9. .sect .bss
  10. .sect .text
  11. EINVAL = 22
  12. ! Perform a Linux system call.
  13. .define __syscall
  14. __syscall:
  15. move.l (4, sp), d0
  16. move.l (8, sp), d1
  17. move.l (12, sp), d2
  18. move.l (16, sp), d3
  19. trap #0
  20. tst.l d0
  21. bmi 1f
  22. rts
  23. 1:
  24. neg.l d0
  25. ! It just so happens that errnos 1-34 are the same in Linux as in ACK.
  26. cmp.l #1, d0
  27. blt 2f
  28. cmp.l #34, d0
  29. bgt 2f
  30. move.l d0, (_errno)
  31. 3:
  32. move.l #-1, d0
  33. rts
  34. 2:
  35. move.l #EINVAL, (_errno)
  36. bra 3b