syscall-sparc-netbsd-1.3.S
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:3k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* ==== syscall.S ============================================================
  2.  * Copyright (c) 1994 Chris Provenzano, proven@mit.edu
  3.  * All rights reserved.
  4.  *
  5.  */
  6. #ifndef lint
  7. .text
  8. .asciz "$Id$";
  9. #endif
  10.  
  11. #include <machine/asm.h>
  12. #include <sys/syscall.h>
  13. #define SYSCALL(x)
  14. .globl _C_LABEL(machdep_sys_##x);
  15. _C_LABEL(machdep_sys_##x):;
  16. mov SYS_##x, %g1;   
  17. ta 0;
  18. bcs,a 2b;
  19. sub %r0,%o0,%o0;
  20. retl
  21. /*
  22.  * Initial asm stuff for all functions.
  23.  */
  24. .text
  25. .align 4
  26. /* ==========================================================================
  27.  * error code for all syscalls. The error value is returned as the negative
  28.  * of the errno value.
  29.  */
  30. 1:
  31. sub %r0, %o0, %o0
  32. 2:
  33. retl
  34. nop
  35. /* ==========================================================================
  36.  * machdep_sys_pipe()
  37.  */
  38.     .globl _C_LABEL(machdep_sys_pipe)
  39. _C_LABEL(machdep_sys_pipe):
  40.     mov  %o0, %o2
  41.     mov  SYS_pipe, %g1
  42.     ta  0
  43.     bcs 1b
  44.     nop
  45.     st  %o0, [ %o2 ]
  46.     st  %o1, [ %o2 + 4 ]
  47.     retl 
  48.     mov  %g0, %o0
  49. /* ==========================================================================
  50.  * machdep_sys_fork()
  51.  */
  52.     .globl _C_LABEL(machdep_sys_fork);
  53. _C_LABEL(machdep_sys_fork):;
  54.     mov SYS_fork, %g1;
  55.     ta 0;
  56.     bcs 1b;
  57.     nop;
  58.     dec %o1;
  59.     retl;
  60.     and %o0, %o1, %o0; ! return 0 in child, pid in parent
  61. #ifndef SYS___sigprocmask14
  62. /* ==========================================================================
  63.  * machdep_sys_sigprocmask()
  64.  */
  65.     .globl _C_LABEL(machdep_sys_sigprocmask);
  66. _C_LABEL(machdep_sys_sigprocmask):;
  67.     ld [%o1], %o1; 
  68.     mov SYS_sigprocmask, %g1;
  69.     ta 0;
  70.     bcs 1b;
  71.     nop;
  72.     retl
  73.     nop
  74. #endif
  75. #ifndef SYS___sigsuspend14
  76. /* ==========================================================================
  77.  * machdep_sys_sigsuspend()
  78.  */
  79.     .globl _C_LABEL(machdep_sys_sigsuspend);
  80. _C_LABEL(machdep_sys_sigsuspend):;
  81.     ld [%o0], %o0; 
  82.     mov SYS_sigsuspend, %g1;
  83.     ta 0;
  84.     bcs 1b;
  85.     nop;
  86.     retl
  87.     nop
  88. #endif
  89. /* ==========================================================================
  90.  * machdep_sys_fstat()
  91.  */
  92.     .globl _C_LABEL(machdep_sys_fstat);
  93. _C_LABEL(machdep_sys_fstat):;
  94.     mov SYS___fstat13, %g1;
  95.     ta 0;
  96.     bcs 1b;
  97.     nop;
  98.     retl
  99.     nop
  100. /* ==========================================================================
  101.  * machdep_sys___syscall()
  102.  */
  103. _machdep_sys___syscall:;
  104.     mov SYS___syscall, %g1;
  105.     ta 0;
  106.     bcs 1b;
  107.     nop;
  108.     retl
  109.     nop
  110. /* ==========================================================================
  111.  * machdep_sys_lseek()
  112.  */
  113. .global _C_LABEL(machdep_sys_lseek)
  114. _C_LABEL(machdep_sys_lseek):
  115. save %sp,-112,%sp
  116. mov %i1,%o4
  117. mov %i2,%o5
  118. st %i3,[%sp+92]
  119. mov 0,%o0
  120. mov SYS_lseek,%o1
  121. mov %i0,%o2
  122. call _machdep_sys___syscall,0
  123. mov 0,%o3
  124. mov %o0,%i0
  125. mov %o1,%i1
  126. ret
  127. restore
  128. /* ==========================================================================
  129.  * machdep_sys_ftruncate()
  130.  */
  131. .global _C_LABEL(machdep_sys_ftruncate)
  132. _C_LABEL(machdep_sys_ftruncate):
  133. save %sp,-104,%sp
  134. mov %i1,%o4
  135. mov %i2,%o5
  136. mov 0,%o0
  137. mov SYS_ftruncate,%o1
  138. mov %i0,%o2
  139. call _machdep_sys___syscall,0
  140. mov 0,%o3
  141. mov %o0,%o1
  142. sra %o0,31,%o0
  143. ret
  144. restore %g0,%o1,%o0