* what the client is expecting.
*/
if (count < ARM_UNIFIED_THREAD_STATE_COUNT) {
+ if (!is_saved_state32(saved_state)) {
+ return (KERN_INVALID_ARGUMENT);
+ }
return handle_set_arm32_thread_state(tstate, count, saved_state);
}
const arm_unified_thread_state_t *unified_state = (const arm_unified_thread_state_t *) tstate;
#if __arm64__
if (is_thread_state64(unified_state)) {
+ if (!is_saved_state64(saved_state)) {
+ return (KERN_INVALID_ARGUMENT);
+ }
(void)thread_state64_to_saved_state(const_thread_state64(unified_state), saved_state);
} else
#endif
{
+ if (!is_saved_state32(saved_state)) {
+ return (KERN_INVALID_ARGUMENT);
+ }
(void)thread_state32_to_saved_state(const_thread_state32(unified_state), saved_state);
}
return (KERN_SUCCESS);
}
+/*
+ * Translate thread state arguments to userspace representation
+ */
+
+kern_return_t
+machine_thread_state_convert_to_user(
+ thread_t thread,
+ thread_flavor_t flavor,
+ thread_state_t tstate,
+ mach_msg_type_number_t *count)
+{
+ // No conversion to userspace representation on this platform
+ (void)thread; (void)flavor; (void)tstate; (void)count;
+ return KERN_SUCCESS;
+}
+
+/*
+ * Translate thread state arguments from userspace representation
+ */
+
+kern_return_t
+machine_thread_state_convert_from_user(
+ thread_t thread,
+ thread_flavor_t flavor,
+ thread_state_t tstate,
+ mach_msg_type_number_t count)
+{
+ // No conversion from userspace representation on this platform
+ (void)thread; (void)flavor; (void)tstate; (void)count;
+ return KERN_SUCCESS;
+}
+
+/*
+ * Translate signal context data pointer to userspace representation
+ */
+
+kern_return_t
+machine_thread_siguctx_pointer_convert_to_user(
+ __assert_only thread_t thread,
+ user_addr_t *uctxp)
+{
+ // No conversion to userspace representation on this platform
+ (void)thread; (void)uctxp;
+ return KERN_SUCCESS;
+}
+
+/*
+ * Translate array of function pointer syscall arguments from userspace representation
+ */
+
+kern_return_t
+machine_thread_function_pointers_convert_from_user(
+ __assert_only thread_t thread,
+ user_addr_t *fptrs,
+ uint32_t count)
+{
+ // No conversion from userspace representation on this platform
+ (void)thread; (void)fptrs; (void)count;
+ return KERN_SUCCESS;
+}
+
/*
* Routine: machine_thread_get_state
*
tstate[0] = ARM_THREAD_STATE;
tstate[1] = ARM_VFP_STATE;
- tstate[2] = thread_is_64bit(thread) ? ARM_EXCEPTION_STATE64 : ARM_EXCEPTION_STATE;
- tstate[3] = thread_is_64bit(thread) ? ARM_DEBUG_STATE64 : ARM_DEBUG_STATE32;
+ tstate[2] = thread_is_64bit_data(thread) ? ARM_EXCEPTION_STATE64 : ARM_EXCEPTION_STATE;
+ tstate[3] = thread_is_64bit_data(thread) ? ARM_DEBUG_STATE64 : ARM_DEBUG_STATE32;
*count = 4;
break;
}
case ARM_THREAD_STATE32:
{
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return KERN_INVALID_ARGUMENT;
kern_return_t rn = handle_get_arm32_thread_state(tstate, count, thread->machine.upcb);
#if __arm64__
case ARM_THREAD_STATE64:
{
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return KERN_INVALID_ARGUMENT;
kern_return_t rn = handle_get_arm64_thread_state(tstate, count, thread->machine.upcb);
if (*count < ARM_EXCEPTION_STATE_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (struct arm_exception_state *) tstate;
if (*count < ARM_EXCEPTION_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (struct arm_exception_state64 *) tstate;
if (*count < ARM_LEGACY_DEBUG_STATE_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_legacy_debug_state_t *) tstate;
if (*count < ARM_DEBUG_STATE32_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_debug_state32_t *) tstate;
if (*count < ARM_DEBUG_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_debug_state64_t *) tstate;
arm_neon_state_t *state;
arm_neon_saved_state32_t *thread_state;
- if (*count < ARM_NEON_STATE_COUNT)
+ if (*count < ARM_NEON_STATE_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_neon_state_t *)tstate;
arm_neon_state64_t *state;
arm_neon_saved_state64_t *thread_state;
- if (*count < ARM_NEON_STATE64_COUNT)
+ if (*count < ARM_NEON_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_neon_state64_t *)tstate;
void
machine_thread_switch_addrmode(thread_t thread)
{
- if (task_has_64BitAddr(thread->task)) {
+ if (task_has_64Bit_data(thread->task)) {
thread->machine.upcb->ash.flavor = ARM_SAVED_STATE64;
thread->machine.upcb->ash.count = ARM_SAVED_STATE64_COUNT;
thread->machine.uNeon->nsh.flavor = ARM_NEON_SAVED_STATE64;
break;
case ARM_THREAD_STATE32:
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
rn = handle_set_arm32_thread_state(tstate, count, thread->machine.upcb);
#if __arm64__
case ARM_THREAD_STATE64:
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
rn = handle_set_arm64_thread_state(tstate, count, thread->machine.upcb);
if (count != ARM_EXCEPTION_STATE_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
break;
if (count != ARM_EXCEPTION_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
break;
if (count != ARM_LEGACY_DEBUG_STATE_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_legacy_debug_state_t *) tstate;
if (count != ARM_DEBUG_STATE32_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_debug_state32_t *) tstate;
if (count != ARM_DEBUG_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_debug_state64_t *) tstate;
if (count != ARM_NEON_STATE_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (thread_is_64bit(thread))
+ if (thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_neon_state_t *)tstate;
if (count != ARM_NEON_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!thread_is_64bit(thread))
+ if (!thread_is_64bit_data(thread))
return (KERN_INVALID_ARGUMENT);
state = (arm_neon_state64_t *)tstate;
thread->machine.DebugData = NULL;
+
return KERN_SUCCESS;
}
kern_return_t
machine_thread_dup(
thread_t self,
- thread_t target)
+ thread_t target,
+ __unused boolean_t is_corpse)
{
struct arm_saved_state *self_saved_state;
struct arm_saved_state *target_saved_state;
*/
kern_return_t
thread_userstack(
- thread_t thread,
- int flavor,
- thread_state_t tstate,
- unsigned int count,
- mach_vm_offset_t * user_stack,
- int *customstack,
- boolean_t is64bit
+ __unused thread_t thread,
+ int flavor,
+ thread_state_t tstate,
+ unsigned int count,
+ mach_vm_offset_t * user_stack,
+ int *customstack,
+ boolean_t is_64bit_data
)
{
register_t sp;
case ARM_THREAD_STATE:
if (count == ARM_UNIFIED_THREAD_STATE_COUNT) {
#if __arm64__
- if (thread_is_64bit(thread)) {
+ if (is_64bit_data) {
sp = ((arm_unified_thread_state_t *)tstate)->ts_64.sp;
} else
#endif
case ARM_THREAD_STATE32:
if (count != ARM_THREAD_STATE32_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (is64bit)
+ if (is_64bit_data)
return (KERN_INVALID_ARGUMENT);
sp = ((arm_thread_state32_t *)tstate)->sp;
case ARM_THREAD_STATE64:
if (count != ARM_THREAD_STATE64_COUNT)
return (KERN_INVALID_ARGUMENT);
- if (!is64bit)
+ if (!is_64bit_data)
return (KERN_INVALID_ARGUMENT);
sp = ((arm_thread_state32_t *)tstate)->sp;
}
#if __ARM_VFP__
- if (thread_is_64bit(thread)) {
+ if (thread_is_64bit_data(thread)) {
val = ARM_NEON_STATE64_COUNT;
kret = machine_thread_get_state(thread,
ARM_NEON_STATE64,
goto out;
#if __ARM_VFP__
- if (thread_is_64bit(thread)) {
+ if (thread_is_64bit_data(thread)) {
kret = machine_thread_set_state(thread,
ARM_NEON_STATE64,
(thread_state_t) & ic->ns,
thread_t curth = current_thread();
spl_t s=0;
- assert(!thread_is_64bit(thread));
+ assert(!thread_is_64bit_data(thread));
saved_state = thread->machine.upcb;
saved_state_32 = saved_state32(saved_state);
thread_t curth = current_thread();
spl_t s=0;
- assert(thread_is_64bit(thread));
+ assert(thread_is_64bit_data(thread));
saved_state = thread->machine.upcb;
saved_state_64 = saved_state64(saved_state);
* like sp.
*/
thread_state64_to_saved_state(state, saved_state);
- saved_state_64->cpsr = PSR64_USER64_DEFAULT;
+ set_saved_state_cpsr(saved_state, PSR64_USER64_DEFAULT);
if (curth != thread) {
thread_unlock(thread);