}
*wptr = '\0';
}
+static gint32 GetLogicalDriveStrings_Mtab (guint32 len, gunichar2 *buf);
+
#if __linux__
#define GET_LOGICAL_DRIVE_STRINGS_BUFFER 512
#define GET_LOGICAL_DRIVE_STRINGS_MOUNTPOINT_BUFFER 512
static gboolean GetLogicalDriveStrings_Mounts (guint32 len, gunichar2 *buf, LinuxMountInfoParseState *state);
static gboolean GetLogicalDriveStrings_MountInfo (guint32 len, gunichar2 *buf, LinuxMountInfoParseState *state);
-static gint32 GetLogicalDriveStrings_Mtab (guint32 len, gunichar2 *buf);
static void append_to_mountpoint (LinuxMountInfoParseState *state);
static gboolean add_drive_string (guint32 len, gunichar2 *buf, LinuxMountInfoParseState *state);
}
/* Linux has struct statfs which has a different layout */
-#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD)
+#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__native_client__)
gboolean
GetVolumeInformation (const gunichar2 *path, gunichar2 *volumename, int volumesize, int *outserial, int *maxcomp, int *fsflags, gunichar2 *fsbuffer, int fsbuffersize)
{
* MONO_CONTEXT_GET_CURRENT captures the current context as close as possible. One reg might be clobbered
* to hold the address of the target MonoContext. It will be a caller save one, so should not be a problem.
*/
-#if defined(__i386__)
+#if (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86))
/*HACK, move this to an eventual mono-signal.c*/
#if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
#define MONO_ARCH_HAS_MONO_CONTEXT 1
#endif
-#elif defined(__x86_64__) /* defined(__i386__) */
+#elif (defined(__x86_64__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_AMD64)) /* defined(__i386__) */
#if !defined( HOST_WIN32 ) && !defined(__native_client__) && !defined(__native_client_codegen__)
#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->rbp))
#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->rsp))
+#if defined(__native_client__)
+#define MONO_CONTEXT_GET_CURRENT(ctx) \
+ __asm__ __volatile__( \
+ "movq $0x0, %%nacl:0x00(%%r15, %0, 1)\n" \
+ "movq %%rbx, %%nacl:0x08(%%r15, %0, 1)\n" \
+ "movq %%rcx, %%nacl:0x10(%%r15, %0, 1)\n" \
+ "movq %%rdx, %%nacl:0x18(%%r15, %0, 1)\n" \
+ "movq %%rbp, %%nacl:0x20(%%r15, %0, 1)\n" \
+ "movq %%rsp, %%nacl:0x28(%%r15, %0, 1)\n" \
+ "movq %%rsi, %%nacl:0x30(%%r15, %0, 1)\n" \
+ "movq %%rdi, %%nacl:0x38(%%r15, %0, 1)\n" \
+ "movq %%r8, %%nacl:0x40(%%r15, %0, 1)\n" \
+ "movq %%r9, %%nacl:0x48(%%r15, %0, 1)\n" \
+ "movq %%r10, %%nacl:0x50(%%r15, %0, 1)\n" \
+ "movq %%r11, %%nacl:0x58(%%r15, %0, 1)\n" \
+ "movq %%r12, %%nacl:0x60(%%r15, %0, 1)\n" \
+ "movq %%r13, %%nacl:0x68(%%r15, %0, 1)\n" \
+ "movq %%r14, %%nacl:0x70(%%r15, %0, 1)\n" \
+ "movq %%r15, %%nacl:0x78(%%r15, %0, 1)\n" \
+ "leaq (%%rip), %%rdx\n" \
+ "movq %%rdx, %%nacl:0x80(%%r15, %0, 1)\n" \
+ : \
+ : "a" ((int64_t)&(ctx)) \
+ : "rdx", "memory")
+#else
#define MONO_CONTEXT_GET_CURRENT(ctx) \
__asm__ __volatile__( \
"movq $0x0, 0x00(%0)\n" \
: \
: "a" (&(ctx)) \
: "rdx", "memory")
+#endif
#if !defined(HOST_WIN32)
#define MONO_ARCH_HAS_MONO_CONTEXT 1
#include <errno.h>
-#if defined(_POSIX_VERSION)
+#if defined(_POSIX_VERSION) || defined(__native_client__)
+#include <signal.h>
typedef struct {
void *(*start_routine)(void*);
#if !defined (__MACH__)
+#if !defined(__native_client__)
static void
suspend_signal_handler (int _dummy, siginfo_t *info, void *context)
{
MONO_SEM_POST (¤t->finish_resume_semaphore);
}
+#endif
static void
mono_posix_add_signal_handler (int signo, gpointer handler)
{
+#if !defined(__native_client__)
/*FIXME, move the code from mini to utils and do the right thing!*/
struct sigaction sa;
struct sigaction previous_sa;
ret = sigaction (signo, &sa, &previous_sa);
g_assert (ret != -1);
+#endif
}
void
mono_threads_init_platform (void)
{
+#if !defined(__native_client__)
/*
FIXME we should use all macros from mini to make this more portable
FIXME it would be very sweet if sgen could end up using this too.
*/
if (mono_thread_info_new_interrupt_enabled ())
mono_posix_add_signal_handler (mono_thread_get_abort_signal (), suspend_signal_handler);
+#endif
}
/*nothing to be done here since suspend always abort syscalls due using signals*/