syscall-alpha-osf1.S
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:2k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. #include <asm.h>
  2. #include <regdef.h>
  3. #define COMPAT_43
  4. #include <syscall.h>
  5. #undef SYSCALL
  6. /* Kernel syscall interface:
  7.    Input:
  8. v0 - system call number
  9. a* - arguments, as in C
  10.    Output:
  11. a3 - zero iff successful
  12. v0 - errno value on failure, else result
  13.    This macro is similar to SYSCALL in asm.h, but not completely.
  14.    There's room for optimization, if we assume this will continue to
  15.    be assembled as one file.
  16.    This macro expansions does not include the return instruction.
  17.    If there's no other work to be done, use something like:
  18. SYSCALL(foo) ; ret
  19.    If there is other work to do (in fork, maybe?), do it after the
  20.    SYSCALL invocation.  */
  21. #define SYSCALL(x) 
  22. .align 4 ;
  23. .globl machdep_sys_##x ;
  24. .ent machdep_sys_##x, 0 ;
  25. machdep_sys_##x: ;
  26. .frame sp,0,ra ;
  27. ldiq v0, SYS_##x ;
  28. CHMK() ;
  29. beq a3, 2f ;
  30. br gp, 1f ;
  31. 1: ;
  32. /* Load gp so we can find cerror to jump to.  */;
  33. ldgp gp, 0(gp) ;
  34. jmp zero, machdep_cerror ;
  35. 2:
  36. #define XSYSCALL(x) SYSCALL(x) ; ret ; .end machdep_sys_##x
  37. .globl machdep_cerror 
  38. machdep_cerror:
  39. br t0, 1f
  40. 1:
  41. ldgp gp, 0(t0)
  42. stl v0, errno
  43. #if 0
  44. ldiq v0, -1
  45. #else
  46. subq zero, v0, v0
  47. #endif
  48. ret
  49. /* The fork system call is special...  */
  50. SYSCALL(fork)
  51. cmovne a4, 0, v0
  52. ret
  53. .end machdep_sys_fork
  54. /* So is the sigsuspend system call */
  55. .align 4
  56. .globl machdep_sys_sigsuspend
  57. .ent machdep_sys_sigsuspend, 0
  58. machdep_sys_sigsuspend:
  59. .frame sp,0,ra
  60. bis a0, a0, a1
  61. ldq a0, 0(a1)
  62. ldiq v0, SYS_sigsuspend
  63. CHMK()
  64. ret
  65. .end  machdep_sys_sigsuspend
  66. /* More stuff ... */
  67. .align 4
  68. .globl machdep_restore_from_setjmp
  69. .ent machdep_restore_from_setjmp, 0
  70. machdep_restore_from_setjmp:
  71. .frame sp, 16, ra
  72. ldgp gp, 0(t12)
  73. lda sp, -16(sp)
  74. stq ra, 0(sp)
  75. ldq v0, 280(a0)
  76. subq v0, 0x00000000acedbade, t0
  77. bne t0, botch
  78. cmoveq a1, 0x1, a1
  79. stq a1, 32(a0)
  80. ldiq v0, 0x67
  81. call_pal 0x83
  82. botch:
  83. /* This should cause the program to crash.  Eventually, fix it
  84.    up to print a message first.  */
  85. jsr abort
  86. .end machdep_restore_from_setjmp