callback_srm.S
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:3k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * arch/alpha/lib/callback_srm.S
  3.  */
  4. #include <linux/config.h>
  5. #include <asm/console.h>
  6. .text
  7. #define HWRPB_CRB_OFFSET 0xc0
  8. #if defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC)
  9. .align 4
  10. srm_dispatch:
  11. #if defined(CONFIG_ALPHA_GENERIC)
  12. ldl $4,alpha_using_srm
  13. beq $4,nosrm
  14. #endif
  15. ldq $0,hwrpb # gp is set up by CALLBACK macro.
  16. ldl $25,0($25) # Pick up the wrapper data.
  17. mov $20,$21 # Shift arguments right.
  18. mov $19,$20
  19. ldq $1,HWRPB_CRB_OFFSET($0)
  20. mov $18,$19
  21. mov $17,$18
  22. mov $16,$17
  23. addq $0,$1,$2 # CRB address
  24. ldq $27,0($2) # DISPATCH procedure descriptor (VMS call std)
  25. extwl $25,0,$16 # SRM callback function code
  26. ldq $3,8($27) # call address
  27. extwl $25,2,$25 # argument information (VMS calling std)
  28. jmp ($3) # Return directly to caller of wrapper.
  29. .align 4
  30. .globl srm_fixup
  31. .ent srm_fixup
  32. srm_fixup:
  33. ldgp $29,0($27)
  34. #if defined(CONFIG_ALPHA_GENERIC)
  35. ldl $4,alpha_using_srm
  36. beq $4,nosrm
  37. #endif
  38. ldq $0,hwrpb
  39. ldq $1,HWRPB_CRB_OFFSET($0)
  40. addq $0,$1,$2 # CRB address
  41. ldq $27,16($2) # VA of FIXUP procedure descriptor
  42. ldq $3,8($27) # call address
  43. lda $25,2($31) # two integer arguments
  44. jmp ($3) # Return directly to caller of srm_fixup.
  45. .end    srm_fixup
  46. #if defined(CONFIG_ALPHA_GENERIC)
  47. .align 3
  48. nosrm:
  49. lda $0,-1($31)
  50. ret
  51. #endif
  52. #define CALLBACK(NAME, CODE, ARG_CNT) 
  53. .align 4; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: 
  54. ldgp $29,0($27); br $25,srm_dispatch; .word CODE, ARG_CNT; .end callback_##NAME
  55. #else /* defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC) */
  56. #define CALLBACK(NAME, CODE, ARG_CNT) 
  57. .align 3; .globl callback_##NAME; .ent callback_##NAME; callback_##NAME##: 
  58. lda $0,-1($31); ret; .end callback_##NAME
  59. .align 3
  60. .globl srm_fixup
  61. .ent srm_fixup
  62. srm_fixup:
  63. lda $0,-1($31)
  64. ret
  65. .end srm_fixup
  66. #endif /* defined(CONFIG_ALPHA_SRM) || defined(CONFIG_ALPHA_GENERIC) */
  67. CALLBACK(puts, CCB_PUTS, 4)
  68. CALLBACK(open, CCB_OPEN, 3)
  69. CALLBACK(close, CCB_CLOSE, 2)
  70. CALLBACK(read, CCB_READ, 5)
  71. CALLBACK(getenv, CCB_GET_ENV, 4)
  72. CALLBACK(setenv, CCB_SET_ENV, 4)
  73. CALLBACK(getc, CCB_GETC, 2)
  74. CALLBACK(reset_term, CCB_RESET_TERM, 2)
  75. CALLBACK(term_int, CCB_SET_TERM_INT, 3)
  76. CALLBACK(term_ctl, CCB_SET_TERM_CTL, 3)
  77. CALLBACK(process_keycode, CCB_PROCESS_KEYCODE, 3)
  78. CALLBACK(ioctl, CCB_IOCTL, 6)
  79. CALLBACK(write, CCB_WRITE, 5)
  80. CALLBACK(reset_env, CCB_RESET_ENV, 4)
  81. CALLBACK(save_env, CCB_SAVE_ENV, 1)
  82. CALLBACK(pswitch, CCB_PSWITCH, 3)
  83. CALLBACK(bios_emul, CCB_BIOS_EMUL, 5)
  84. .data
  85. __alpha_using_srm: # For use by bootpheader
  86. .long 7 # value is not 1 for link debugging
  87. .weak alpha_using_srm; alpha_using_srm = __alpha_using_srm
  88. __callback_init_done: # For use by bootpheader
  89. .long 7 # value is not 1 for link debugging
  90. .weak callback_init_done; callback_init_done = __callback_init_done