factor/vm/os-linux-x86.64.hpp

30 lines
725 B
C++
Raw Normal View History

2009-05-02 05:04:19 -04:00
#include <ucontext.h>
2009-05-04 02:46:13 -04:00
namespace factor
{
inline static void *ucontext_stack_pointer(void *uap)
2009-05-02 05:04:19 -04:00
{
ucontext_t *ucontext = (ucontext_t *)uap;
return (void *)ucontext->uc_mcontext.gregs[15];
}
inline static unsigned int uap_fpu_status(void *uap)
{
ucontext_t *ucontext = (ucontext_t *)uap;
return ucontext->uc_mcontext.fpregs->swd
| ucontext->uc_mcontext.fpregs->mxcsr;
}
inline static void uap_clear_fpu_status(void *uap)
{
ucontext_t *ucontext = (ucontext_t *)uap;
ucontext->uc_mcontext.fpregs->swd = 0;
ucontext->uc_mcontext.fpregs->mxcsr &= 0xffffffc0;
}
2009-05-02 05:04:19 -04:00
#define UAP_PROGRAM_COUNTER(ucontext) \
(((ucontext_t *)(ucontext))->uc_mcontext.gregs[16])
2009-05-04 02:46:13 -04:00
}