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