Beispiel #1
0
void asm_x64_entry(asm_x64_t* as, int num_locals) {
    asm_x64_push_r64(as, REG_RBP);
    asm_x64_mov_r64_to_r64(as, REG_RSP, REG_RBP);
    if (num_locals < 0) {
        num_locals = 0;
    }
    num_locals |= 1; // make it odd so stack is aligned on 16 byte boundary
    asm_x64_sub_i32_from_r64(as, num_locals * WORD_SIZE, REG_RSP);
    asm_x64_push_r64(as, REG_RBX);
}
Beispiel #2
0
void asm_x64_entry(asm_x64_t *as, int num_locals) {
    assert(num_locals >= 0);
    asm_x64_push_r64(as, ASM_X64_REG_RBP);
    asm_x64_mov_r64_r64(as, ASM_X64_REG_RBP, ASM_X64_REG_RSP);
    num_locals |= 1; // make it odd so stack is aligned on 16 byte boundary
    asm_x64_sub_r64_i32(as, ASM_X64_REG_RSP, num_locals * WORD_SIZE);
    asm_x64_push_r64(as, ASM_X64_REG_RBX);
    asm_x64_push_r64(as, ASM_X64_REG_R12);
    asm_x64_push_r64(as, ASM_X64_REG_R13);
    as->num_locals = num_locals;
}
Beispiel #3
0
void asm_x64_push_local_addr(asm_x64_t* as, int local_num, int temp_r64)
{
    asm_x64_mov_r64_to_r64(as, REG_RBP, temp_r64);
    asm_x64_add_i32_to_r32(as, asm_x64_local_offset_from_ebp(local_num), temp_r64);
    asm_x64_push_r64(as, temp_r64);
}