Skip to content

Commit 4e9c005

Browse files
committed
Sync il2cpp revision 2e4b359d645856654955f175c11bdfc733005222
1 parent 9d0be98 commit 4e9c005

File tree

4 files changed

+27
-4
lines changed

4 files changed

+27
-4
lines changed

mono/arch/arm64/arm64-codegen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ arm_is_bl_disp (void *code, void *target)
170170
static G_GNUC_UNUSED inline unsigned int
171171
arm_get_disp (void *p, void *target)
172172
{
173-
unsigned int disp = ((char*)target - (char*)p) / 4;
173+
unsigned int disp = (unsigned int)(((char*)target - (char*)p) / 4);
174174

175175
if (target)
176176
g_assert (arm_is_bl_disp (p, target));
@@ -196,7 +196,7 @@ arm_is_disp19 (void *code, void *target)
196196
static G_GNUC_UNUSED inline unsigned int
197197
arm_get_disp19 (void *p, void *target)
198198
{
199-
unsigned int disp = ((char*)target - (char*)p) / 4;
199+
unsigned int disp = (unsigned int)(((char*)target - (char*)p) / 4);
200200

201201
if (target)
202202
g_assert (arm_is_disp19 (p, target));
@@ -224,7 +224,7 @@ arm_get_disp19 (void *p, void *target)
224224
static G_GNUC_UNUSED inline unsigned int
225225
arm_get_disp15 (void *p, void *target)
226226
{
227-
unsigned int disp = ((char*)target - (char*)p) / 4;
227+
unsigned int disp = (unsigned int)(((char*)target - (char*)p) / 4);
228228
return (disp & 0x7fff);
229229
}
230230

mono/utils/mono-context.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,21 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *ctx)
458458

459459
#include <mono/utils/mono-context.h>
460460

461+
#ifdef HOST_WIN32
462+
#include <windows.h>
463+
#endif
464+
461465
void
462466
mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
463467
{
464468
#ifdef MONO_CROSS_COMPILE
465469
g_assert_not_reached ();
470+
#elif defined(HOST_WIN32)
471+
CONTEXT *context = (CONTEXT*)sigctx;
472+
473+
mctx->pc = context->Pc;
474+
memcpy(&mctx->regs, &context->X0, sizeof(mgreg_t) * 31);
475+
memcpy(&mctx->fregs, &context->V, sizeof(MonoContextSimdReg) * 32);
466476
#else
467477
memcpy (mctx->regs, UCONTEXT_GREGS (sigctx), sizeof (mgreg_t) * 31);
468478
mctx->pc = UCONTEXT_REG_PC (sigctx);
@@ -484,6 +494,12 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
484494
{
485495
#ifdef MONO_CROSS_COMPILE
486496
g_assert_not_reached ();
497+
#elif defined(HOST_WIN32)
498+
CONTEXT *context = (CONTEXT*)sigctx;
499+
500+
context->Pc = mctx->pc;
501+
memcpy(&context->X0, &mctx->regs, sizeof(mgreg_t) * 31);
502+
memcpy(&context->V, &mctx->fregs, sizeof(MonoContextSimdReg) * 32);
487503
#else
488504
memcpy (UCONTEXT_GREGS (sigctx), mctx->regs, sizeof (mgreg_t) * 31);
489505
UCONTEXT_REG_PC (sigctx) = mctx->pc;

mono/utils/mono-context.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ typedef struct _libc_xmmreg MonoContextSimdReg;
4141
typedef __m128d MonoContextSimdReg;
4242
#endif
4343
#elif defined(TARGET_ARM64)
44+
#if defined(HOST_WIN32)
45+
#include <arm64_neon.h>
46+
typedef __n128 MonoContextSimdReg;
47+
#else
4448
typedef __uint128_t MonoContextSimdReg;
4549
#endif
50+
#endif
4651

4752
/*
4853
* General notes about mono-context.

mono/utils/mono-sigcontext.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,9 @@ typedef struct ucontext {
461461
#define UCONTEXT_REG_R0(ctx) (((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__x [ARMREG_R0])
462462
#define UCONTEXT_GREGS(ctx) (&(((ucontext64_t*)(ctx))->uc_mcontext64->__ss.__x))
463463
#else
464-
#include <ucontext.h>
464+
# if HAVE_UCONTEXT_H
465+
# include <ucontext.h>
466+
# endif
465467
#define UCONTEXT_REG_PC(ctx) (((ucontext_t*)(ctx))->uc_mcontext.pc)
466468
#define UCONTEXT_REG_SP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.sp)
467469
#define UCONTEXT_REG_R0(ctx) (((ucontext_t*)(ctx))->uc_mcontext.regs [ARMREG_R0])

0 commit comments

Comments
 (0)