add support for FreeBSD on x86_64

This commit is contained in:
Joel Dice 2012-08-02 10:49:32 -06:00
parent c1aa0b46b5
commit 3a1343fb06
3 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@ version = 0.6
build-arch := $(shell uname -m \
| sed 's/^i.86$$/i386/' \
| sed 's/^x86pc$$/i386/' \
| sed 's/amd64/x86_64/' \
| sed 's/^arm.*$$/arm/' \
| sed 's/ppc/powerpc/')

View File

@ -627,7 +627,7 @@ class MySystem: public System {
}
virtual void* tryAllocateExecutable(unsigned sizeInBytes) {
#if (! defined __APPLE__) && (defined __x86_64__)
#ifdef MAP_32BIT
// map to the lower 32 bits of memory when possible so as to avoid
// expensive relative jumps
const unsigned Extra = MAP_32BIT;

View File

@ -123,6 +123,12 @@ dynamicCall(void* function, uintptr_t* arguments, uint8_t*,
# define FRAME_REGISTER(context) \
THREAD_STATE_FRAME(context->uc_mcontext->FIELD(ss))
# elif (defined __FreeBSD__)
# define IP_REGISTER(context) (context->uc_mcontext.mc_rip)
# define STACK_REGISTER(context) (context->uc_mcontext.mc_rsp)
# define THREAD_REGISTER(context) (context->uc_mcontext.mc_rbx)
# define LINK_REGISTER(context) (context->uc_mcontext.mc_rcx)
# define FRAME_REGISTER(context) (context->uc_mcontext.mc_rbp)
# else
# define IP_REGISTER(context) (context->uc_mcontext.gregs[REG_RIP])
# define STACK_REGISTER(context) (context->uc_mcontext.gregs[REG_RSP])