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