core/x86/mangle.c
/* Inserts a complete call to callee with the passed-in arguments.
 * For x64, assumes the stack pointer is currently 16-byte aligned.
 * Clean calls ensure this by using clean base of dstack and having
 * dr_prepare_for_call pad to 16 bytes.
 */
Inserts a complete call to callee with the passed-in arguments.
For x64, assumes the stack pointer is currently 16-byte aligned.
Clean calls ensure this by using clean base of dstack and having
dr_prepare_for_call pad to 16 bytes.
Inserts a complete call to callee with the passed - in arguments . For x64 assumes the stack pointer is currently 16 - byte aligned . Clean calls ensure this by using clean base of dstack and having dr_prepare_for_call pad to 16 bytes .
void
insert_meta_call_vargs(dcontext_t *dcontext, instrlist_t *ilist, instr_t *instr,
                       bool clean_call, void *callee, uint num_args, va_list ap)
{
    instr_t *in = (instr == NULL) ? instrlist_last(ilist) : instr_get_prev(instr);
    uint stack_for_params = 
        insert_parameter_preparation(dcontext, ilist, instr, clean_call, num_args, ap);
    IF_X64(ASSERT(ALIGNED(stack_for_params, 16)));
    PRE(ilist, instr, INSTR_CREATE_call(dcontext, opnd_create_pc(callee)));
    if (stack_for_params > 0) {
        PRE(ilist, instr,
            INSTR_CREATE_lea(dcontext, opnd_create_reg(REG_XSP),
                             opnd_create_base_disp(REG_XSP, REG_NULL, 0,
                                                   stack_for_params, OPSZ_lea)));
    }
    if (in == NULL)
        in = instrlist_first(ilist);
    else
        in = instr_get_next(in);
    while (in != instr) {
        instr_set_ok_to_mangle(in, false);
        in = instr_get_next(in);
    }
}
void insert_meta_call_vargs ( dcontext_t * dcontext , instrlist_t * ilist , instr_t * instr , bool clean_call , void * callee , uint num_args , va_list ap ) { instr_t * in = ( instr == NULL ) ? instrlist_last ( ilist ) : instr_get_prev ( instr ) ; uint stack_for_params = insert_parameter_preparation ( dcontext , ilist , instr , clean_call , num_args , ap ) ; IF_X64 ( ASSERT ( ALIGNED ( stack_for_params , 16 ) ) ) ; PRE ( ilist , instr , INSTR_CREATE_call ( dcontext , opnd_create_pc ( callee ) ) ) ; if ( stack_for_params > 0 ) { PRE ( ilist , instr , INSTR_CREATE_lea ( dcontext , opnd_create_reg ( REG_XSP ) , opnd_create_base_disp ( REG_XSP , REG_NULL , 0 , stack_for_params , OPSZ_lea ) ) ) ; } if ( in == NULL ) in = instrlist_first ( ilist ) ; else in = instr_get_next ( in ) ; while ( in != instr ) { instr_set_ok_to_mangle ( in , false ) ; in = instr_get_next ( in ) ; } }
Inserts a complete call to callee with the passed-in arguments.
Inserts a complete call to callee with the passed - in arguments .
/* FIXME PR 245936: let user decide whether to clean up?
         * i.e., support calling a stdcall routine?
         */ /* mark it all meta */