mirror of
https://github.com/corda/corda.git
synced 2025-06-16 06:08:13 +00:00
add support for FreeBSD
This commit is contained in:
committed by
Joel Dice
parent
57e318bbec
commit
c1aa0b46b5
@ -197,8 +197,8 @@ public:
|
||||
|
||||
const unsigned machine;
|
||||
|
||||
ElfPlatform(PlatformInfo::Architecture arch):
|
||||
Platform(PlatformInfo(PlatformInfo::Linux, arch)),
|
||||
ElfPlatform(PlatformInfo::OperatingSystem os, PlatformInfo::Architecture arch):
|
||||
Platform(PlatformInfo(os, arch)),
|
||||
machine(getElfPlatform(arch)) {}
|
||||
|
||||
class FileWriter {
|
||||
@ -372,10 +372,15 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
ElfPlatform<uint32_t> elfx86Platform(PlatformInfo::x86);
|
||||
ElfPlatform<uint32_t> elfArmPlatform(PlatformInfo::Arm);
|
||||
ElfPlatform<uint32_t, false> elfPowerPCPlatform(PlatformInfo::PowerPC);
|
||||
ElfPlatform<uint64_t> elfx86_64Platform(PlatformInfo::x86_64);
|
||||
ElfPlatform<uint32_t> elfLinuxX86Platform(PlatformInfo::Linux, PlatformInfo::x86);
|
||||
ElfPlatform<uint32_t> elfLinuxArmPlatform(PlatformInfo::Linux, PlatformInfo::Arm);
|
||||
ElfPlatform<uint32_t, false> elfLinuxPowerPCPlatform(PlatformInfo::Linux, PlatformInfo::PowerPC);
|
||||
ElfPlatform<uint64_t> elfLinuxX86_64Platform(PlatformInfo::Linux, PlatformInfo::x86_64);
|
||||
|
||||
ElfPlatform<uint32_t> elfFreeBSDx86Platform(PlatformInfo::FreeBSD, PlatformInfo::x86);
|
||||
ElfPlatform<uint32_t> elfFreeBSDArmPlatform(PlatformInfo::FreeBSD, PlatformInfo::Arm);
|
||||
ElfPlatform<uint32_t, false> elfFreeBSDPowerPCPlatform(PlatformInfo::FreeBSD, PlatformInfo::PowerPC);
|
||||
ElfPlatform<uint64_t> elfFreeBSDx86_64Platform(PlatformInfo::FreeBSD, PlatformInfo::x86_64);
|
||||
|
||||
|
||||
} // namespace
|
||||
|
@ -92,6 +92,8 @@ PlatformInfo::OperatingSystem PlatformInfo::osFromString(const char* os) {
|
||||
return Windows;
|
||||
} else if(strcmp(os, "darwin") == 0) {
|
||||
return Darwin;
|
||||
} else if(strcmp(os, "freebsd") == 0) {
|
||||
return FreeBSD;
|
||||
} else {
|
||||
return UnknownOS;
|
||||
}
|
||||
@ -122,4 +124,5 @@ Platform* Platform::getPlatform(PlatformInfo info) {
|
||||
|
||||
} // namespace tools
|
||||
|
||||
} // namespace avian
|
||||
} // namespace avian
|
||||
|
||||
|
@ -135,6 +135,7 @@ public:
|
||||
Linux = AVIAN_PLATFORM_LINUX,
|
||||
Windows = AVIAN_PLATFORM_WINDOWS,
|
||||
Darwin = AVIAN_PLATFORM_DARWIN,
|
||||
FreeBSD = AVIAN_PLATFORM_FREEBSD,
|
||||
UnknownOS = AVIAN_PLATFORM_UNKNOWN
|
||||
};
|
||||
|
||||
@ -193,4 +194,5 @@ public:
|
||||
|
||||
} // namespace avian
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -3002,6 +3002,8 @@ jvmInitProperties(Thread* t, uintptr_t* arguments)
|
||||
local::setProperty(t, method, *properties, "path.separator", ":");
|
||||
# ifdef __APPLE__
|
||||
local::setProperty(t, method, *properties, "os.name", "Mac OS X");
|
||||
# elif defined __FreeBSD__
|
||||
local::setProperty(t, method, *properties, "os.name", "FreeBSD");
|
||||
# else // not __APPLE__
|
||||
local::setProperty(t, method, *properties, "os.name", "Linux");
|
||||
# endif // not __APPLE__
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define AVIAN_PLATFORM_LINUX 1
|
||||
#define AVIAN_PLATFORM_WINDOWS 2
|
||||
#define AVIAN_PLATFORM_DARWIN 3
|
||||
#define AVIAN_PLATFORM_FREEBSD 4
|
||||
|
||||
#define AVIAN_ARCH_UNKNOWN 0
|
||||
#define AVIAN_ARCH_X86 (1 << 8)
|
||||
@ -30,4 +31,5 @@
|
||||
#define AVIAN_ARCH_ARM (3 << 8)
|
||||
#define AVIAN_ARCH_POWERPC (4 << 8)
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -17,6 +17,9 @@
|
||||
# include "sys/ucontext.h"
|
||||
# undef assert
|
||||
#else
|
||||
# if defined __FreeBSD__
|
||||
# include "limits.h"
|
||||
# endif
|
||||
# include "ucontext.h"
|
||||
#endif
|
||||
|
||||
@ -797,6 +800,13 @@ class MySystem: public System {
|
||||
}
|
||||
|
||||
virtual FileType stat(const char* name, unsigned* length) {
|
||||
#ifdef __FreeBSD__
|
||||
// Now the hack below causes the error "Dereferencing type-punned
|
||||
// pointer will break strict aliasing rules", so another workaround
|
||||
// is needed...
|
||||
struct stat ss;
|
||||
struct stat* s = &ss;
|
||||
#else
|
||||
// Ugly Hack Alert: It seems that the Apple iOS Simulator's stat
|
||||
// implementation writes beyond the end of the struct stat we pass
|
||||
// it, which can clobber unrelated parts of the stack. Perhaps
|
||||
@ -806,6 +816,7 @@ class MySystem: public System {
|
||||
// made up and seems to work.
|
||||
void* array[ceiling(sizeof(struct stat), sizeof(void*)) + 8];
|
||||
struct stat* s = reinterpret_cast<struct stat*>(array);
|
||||
#endif
|
||||
|
||||
int r = ::stat(name, s);
|
||||
if (r == 0) {
|
||||
|
@ -60,4 +60,5 @@
|
||||
# error
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -70,6 +70,12 @@
|
||||
# define THREAD_REGISTER(context) (context->uc_mcontext.cpu.ebx)
|
||||
# define LINK_REGISTER(context) (context->uc_mcontext.cpu.ecx)
|
||||
# define FRAME_REGISTER(context) (context->uc_mcontext.cpu.ebp)
|
||||
# elif (defined __FreeBSD__)
|
||||
# define IP_REGISTER(context) (context->uc_mcontext.mc_eip)
|
||||
# define STACK_REGISTER(context) (context->uc_mcontext.mc_esp)
|
||||
# define THREAD_REGISTER(context) (context->uc_mcontext.mc_ebx)
|
||||
# define LINK_REGISTER(context) (context->uc_mcontext.mc_ecx)
|
||||
# define FRAME_REGISTER(context) (context->uc_mcontext.mc_ebp)
|
||||
# else
|
||||
# define IP_REGISTER(context) (context->uc_mcontext.gregs[REG_EIP])
|
||||
# define STACK_REGISTER(context) (context->uc_mcontext.gregs[REG_ESP])
|
||||
|
Reference in New Issue
Block a user