syscall.h 715 B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <stdint.h>
  3. // 系统调用号
  4. #define SYS_NOT_EXISTS 0
  5. #define SYS_PUT_STRING 1
  6. #define SYS_OPEN 2
  7. #define SYS_CLOSE 3
  8. #define SYS_READ 4
  9. #define SYS_WRITE 5
  10. #define SYS_LSEEK 6
  11. #define SYS_FORK 7
  12. #define SYS_VFORK 8
  13. #define SYS_BRK 9
  14. #define SYS_SBRK 10
  15. #define SYS_REBOOT 11
  16. #define SYS_CHDIR 12 // 切换工作目录
  17. /**
  18. * @brief 用户态系统调用函数
  19. *
  20. * @param syscall_id
  21. * @param arg0
  22. * @param arg1
  23. * @param arg2
  24. * @param arg3
  25. * @param arg4
  26. * @param arg5
  27. * @param arg6
  28. * @param arg7
  29. * @return long
  30. */
  31. long syscall_invoke(uint64_t syscall_id, uint64_t arg0, uint64_t arg1, uint64_t arg2, uint64_t arg3, uint64_t arg4, uint64_t arg5, uint64_t arg6, uint64_t arg7);