Esempio n. 1
0
/*++
Function :
    GetNativeContextPC
    
    Returns the program counter from the native context.

Parameters :
    const native_context_t *native : native context

Return value :
    The program counter from the native context.

--*/
LPVOID GetNativeContextPC(const native_context_t *context)
{
#ifdef _AMD64_
    return (LPVOID)MCREG_Rip(context->uc_mcontext);
#elif defined(_X86_)
    return (LPVOID) MCREG_Eip(context->uc_mcontext);
#elif defined(_ARM_)
    return (LPVOID) MCREG_Pc(context->uc_mcontext);
#elif defined(_ARM64_)
    return (LPVOID) MCREG_Pc(context->uc_mcontext);
#else
#   error implement me for this architecture
#endif
}
Esempio n. 2
0
// Get value of the program counter from the native context
uint64_t GetPC(void* context)
{
    ucontext_t *nativeContext = (ucontext_t*)context;
    return MCREG_Rip(nativeContext->uc_mcontext);
}