84
84
`defarg(5,`%o0')')dnl
88
* Used by NBIF_SAVE_RESCHED_ARGS to save argument
89
* registers in locations preserved by C.
90
* May be registers or process-private memory locations.
91
* Must not be C caller-save registers.
92
* Must not overlap with any Erlang global registers.
95
88
* Used in nbif_stack_trap_ra to preserve the return value.
96
89
* Must be a C callee-save register.
101
94
* (TEMP_RA contains the caller's saved return address).
102
95
* Must be a C callee-save register.
103
96
* Must be otherwise unused in the call path.
99
* Used to pass the callee address in native-to-BEAM traps
101
* Must be otherwise unused in the call path.
104
* Used to pass the callee arity in native-to-BEAM traps
106
* Must be otherwise unused in the call path.
105
108
`#define TEMP_ARG0 %i4'
106
109
`#define TEMP_ARG1 %i5'
107
`#define TEMP_ARG2 %l7'
109
111
dnl XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
179
181
`/* #define NBIF_RET_5 'NBIF_RET(5)` */'
182
dnl NBIF_SAVE_RESCHED_ARGS(ARITY)
183
dnl Used in the expensive_bif_interface_{1,3}() macros to copy
184
dnl caller-save argument registers to non-volatile locations.
185
dnl Currently, 1 <= ARITY <= 3, so this simply moves the arguments
186
dnl to C callee-save registers.
188
define(NBIF_MIN,`ifelse(eval($1 > $2),0,$1,$2)')dnl
189
define(NBIF_SVA_1,`ifelse(eval($1 < NR_ARG_REGS),0,,`mov ARG$1,TEMP_ARG$1; ')')dnl
190
define(NBIF_SVA_N,`ifelse(eval($1 >= 0),0,,`NBIF_SVA_N(eval($1-1))NBIF_SVA_1($1)')')dnl
191
define(NBIF_SAVE_RESCHED_ARGS,`NBIF_SVA_N(eval(NBIF_MIN($1,NR_ARG_REGS)-1))')dnl
192
`/* #define NBIF_SAVE_RESCHED_ARGS_1 'NBIF_SAVE_RESCHED_ARGS(1)` */'
193
`/* #define NBIF_SAVE_RESCHED_ARGS_2 'NBIF_SAVE_RESCHED_ARGS(2)` */'
194
`/* #define NBIF_SAVE_RESCHED_ARGS_3 'NBIF_SAVE_RESCHED_ARGS(3)` */'
197
184
dnl QUICK_CALL_RET(CFUN,ARITY)
198
185
dnl Used in nocons_nofail and noproc primop interfaces to optimise
199
186
dnl SAVE_CONTEXT_QUICK; call CFUN; nop; RESTORE_CONTEXT_QUICK; NBIF_RET(ARITY).