fn reg2ucontext(reg: usize) -> usize {
    match reg {
        0 => REG_RAX,
        1 => REG_RCX,
        2 => REG_RDX,
        3 => REG_RBX,
        4 => REG_RSP,
        5 => REG_RBP,
        6 => REG_RSI,
        7 => REG_RDI,
        8 => REG_R8,
        9 => REG_R9,
        10 => REG_R10,
        11 => REG_R11,
        12 => REG_R12,
        13 => REG_R13,
        14 => REG_R14,
        15 => REG_R15,
        _ => unreachable!(),
    }
}
/// Dora uses same index for register as CPU,
// but the indices in mcontext are different and need to be mapped
Dora uses same index for register as CPU,
but the indices in mcontext are different and need to be mapped
Dora uses same index for register as CPU but the indices in mcontext are different and need to be mapped
fn reg2ucontext(reg: usize) -> usize {
    match reg {
        0 => REG_RAX,
        1 => REG_RCX,
        2 => REG_RDX,
        3 => REG_RBX,
        4 => REG_RSP,
        5 => REG_RBP,
        6 => REG_RSI,
        7 => REG_RDI,
        8 => REG_R8,
        9 => REG_R9,
        10 => REG_R10,
        11 => REG_R11,
        12 => REG_R12,
        13 => REG_R13,
        14 => REG_R14,
        15 => REG_R15,
        _ => unreachable!(),
    }
}
fn reg2ucontext ( reg : usize ) -> usize { match reg { 0 => REG_RAX , 1 => REG_RCX , 2 => REG_RDX , 3 => REG_RBX , 4 => REG_RSP , 5 => REG_RBP , 6 => REG_RSI , 7 => REG_RDI , 8 => REG_R8 , 9 => REG_R9 , 10 => REG_R10 , 11 => REG_R11 , 12 => REG_R12 , 13 => REG_R13 , 14 => REG_R14 , 15 => REG_R15 , _ => unreachable ! ( ) , } }
Dora uses same index for register as CPU,
but the indices in mcontext are different and need to be mapped
Dora uses same index for register as CPU but the indices in mcontext are different and need to be mapped
reg
usize
reg
usize