Skip to content

Commit

Permalink
i#1569 AArch64: Implement functions required for threadexit2 test.
Browse files Browse the repository at this point in the history
Implement dynamorio_futex_wake_and_exit, instr_check_xsp_mangling, and
instr_is_inline_syscall_jmp.

Review-URL: https://codereview.appspot.com/301790044
  • Loading branch information
egrimley-arm committed Jun 8, 2016
1 parent d966e7d commit 2f4ee9d
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
5 changes: 0 additions & 5 deletions core/arch/aarch64/aarch64.asm
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,6 @@ GLOBAL_LABEL(dynamorio_sys_exit:)
bl GLOBAL_REF(unexpected_return)
END_FUNC(dynamorio_sys_exit)

DECLARE_FUNC(dynamorio_futex_wake_and_exit)
GLOBAL_LABEL(dynamorio_futex_wake_and_exit:)
bl GLOBAL_REF(unexpected_return) /* FIXME i#1569: NYI */
END_FUNC(dynamorio_futex_wake_and_exit)

# ifndef NOT_DYNAMORIO_CORE_PROPER

# ifndef HAVE_SIGALTSTACK
Expand Down
21 changes: 21 additions & 0 deletions core/arch/aarchxx/aarchxx.asm
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,25 @@ GLOBAL_LABEL(xfer_to_new_libdr:)
# endif /* !STANDALONE_UNIT_TEST && !STATIC_LIBRARY */
#endif /* UNIX */

/* we need to call futex_wakeall without using any stack, to support
* THREAD_SYNCH_TERMINATED_AND_CLEANED.
* takes int* futex in r0.
*/
DECLARE_FUNC(dynamorio_futex_wake_and_exit)
GLOBAL_LABEL(dynamorio_futex_wake_and_exit:)
mov REG_R5, #0 /* arg6 */
mov REG_R4, #0 /* arg5 */
mov REG_R3, #0 /* arg4 */
mov REG_R2, #0x7fffffff /* arg3 = INT_MAX */
mov REG_R1, #1 /* arg2 = FUTEX_WAKE */
/* arg1 = &futex, already in r0 */
#ifdef AARCH64
mov w8, #98 /* SYS_futex */
#else
mov r7, #240 /* SYS_futex */
#endif
svc #0
b GLOBAL_REF(dynamorio_sys_exit)
END_FUNC(dynamorio_futex_wake_and_exit)

END_FILE
7 changes: 1 addition & 6 deletions core/arch/aarchxx/mangle.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,16 +755,11 @@ insert_push_immed_arch(dcontext_t *dcontext, instr_t *src_inst, byte *encode_est
bool
instr_check_xsp_mangling(dcontext_t *dcontext, instr_t *inst, int *xsp_adjust)
{
#ifdef AARCH64
ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */
return false;
#else
ASSERT(xsp_adjust != NULL);
/* No current ARM mangling splits an atomic push/pop into emulated pieces:
/* No current ARM/AArch64 mangling splits an atomic push/pop into emulated pieces:
* the OP_ldm/OP_stm splits shouldn't need special translation handling.
*/
return false;
#endif
}

void
Expand Down
18 changes: 0 additions & 18 deletions core/arch/arm/arm.asm
Original file line number Diff line number Diff line change
Expand Up @@ -572,24 +572,6 @@ GLOBAL_LABEL(dynamorio_sys_exit:)
END_FUNC(dynamorio_sys_exit)


/* we need to call futex_wakeall without using any stack, to support
* THREAD_SYNCH_TERMINATED_AND_CLEANED.
* takes int* futex in r0.
*/
DECLARE_FUNC(dynamorio_futex_wake_and_exit)
GLOBAL_LABEL(dynamorio_futex_wake_and_exit:)
mov r5, #0 /* arg6 */
mov r4, #0 /* arg5 */
mov r3, #0 /* arg4 */
mov r2, #0x7fffffff /* arg3 = INT_MAX */
mov r1, #1 /* arg2 = FUTEX_WAKE */
/* arg1 = &futex, already in r0 */
mov r7, #240 /* SYS_futex */
svc 0
b GLOBAL_REF(dynamorio_sys_exit)
END_FUNC(dynamorio_futex_wake_and_exit)


#ifndef NOT_DYNAMORIO_CORE_PROPER

#ifndef HAVE_SIGALTSTACK
Expand Down
7 changes: 5 additions & 2 deletions core/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,16 @@ instr_is_inline_syscall_jmp(dcontext_t *dcontext, instr_t *inst)
return (instr_get_opcode(inst) == OP_jmp_short &&
opnd_is_instr(instr_get_target(inst)));
# elif defined(AARCH64)
ASSERT_NOT_IMPLEMENTED(false); /* FIXME i#1569 */
return false;
return (instr_get_opcode(inst) == OP_b &&
opnd_is_instr(instr_get_target(inst)));
# elif defined(ARM)
return ((instr_get_opcode(inst) == OP_b_short ||
/* A32 uses a regular jump */
instr_get_opcode(inst) == OP_b) &&
opnd_is_instr(instr_get_target(inst)));
# else
ASSERT_NOT_IMPLEMENTED(false);
return false;
# endif /* X86/ARM */
}

Expand Down

0 comments on commit 2f4ee9d

Please sign in to comment.