mirror of
https://github.com/darlinghq/darling-newlkm.git
synced 2024-12-12 05:55:43 +00:00
Code for dispatch queue name support in LLDB
This commit is contained in:
parent
80392113f3
commit
bf32e6fbfe
@ -108,6 +108,7 @@ enum { NR_get_api_version = DARLING_MACH_API_BASE,
|
||||
NR_ptrace_thupdate,
|
||||
NR_ptrace_sigexc,
|
||||
NR_thread_suspended,
|
||||
NR_set_thread_handles,
|
||||
};
|
||||
|
||||
struct set_tracer_args
|
||||
@ -557,4 +558,16 @@ struct ptrace_sigexc_args
|
||||
|
||||
#pragma pack (pop)
|
||||
|
||||
struct fileport_makeport_args
|
||||
{
|
||||
int fd;
|
||||
int port_out;
|
||||
};
|
||||
|
||||
struct set_thread_handles_args
|
||||
{
|
||||
unsigned long long pthread_handle;
|
||||
unsigned long long dispatch_qaddr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -179,6 +179,7 @@ static const struct trap_entry mach_traps[80] = {
|
||||
TRAP(NR_fileport_makefd, fileport_makefd_entry),
|
||||
TRAP(NR_sigprocess, sigprocess_entry),
|
||||
TRAP(NR_ptrace_thupdate, ptrace_thupdate_entry),
|
||||
TRAP(NR_set_thread_handles, set_thread_handles_entry),
|
||||
|
||||
// VIRTUAL CHROOT
|
||||
TRAP(NR_vchroot, vchroot_entry),
|
||||
@ -2386,6 +2387,18 @@ int thread_suspended_entry(task_t task, struct thread_suspended_args* in_args)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int set_thread_handles_entry(task_t t, struct set_thread_handles_args* in_args)
|
||||
{
|
||||
copyargs(args, in_args);
|
||||
|
||||
thread_t thread = current_thread();
|
||||
|
||||
thread->pthread_handle = args.pthread_handle;
|
||||
thread->dispatch_qaddr = args.dispatch_qaddr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module_init(mach_init);
|
||||
module_exit(mach_exit);
|
||||
|
||||
|
@ -114,5 +114,6 @@ int sigprocess_entry(task_t task, struct sigprocess_args* args);
|
||||
int ptrace_thupdate_entry(task_t task, struct ptrace_thupdate_args* args);
|
||||
int ptrace_sigexc_entry(task_t task, struct ptrace_sigexc_args* args);
|
||||
int thread_suspended_entry(task_t t, struct thread_suspended_args* args);
|
||||
int set_thread_handles_entry(task_t t, struct set_thread_handles_args* args);
|
||||
|
||||
#endif
|
||||
|
@ -542,6 +542,7 @@ thread_get_tag(thread_t th)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
uint64_t
|
||||
thread_dispatchqaddr(
|
||||
thread_t thread)
|
||||
@ -549,6 +550,7 @@ thread_dispatchqaddr(
|
||||
kprintf("not implemented: thread_dispatchqaddr()\n");
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Export routines to other components for things that are done as macros
|
||||
|
@ -324,6 +324,7 @@ static kern_return_t duct_thread_create_internal (task_t parent_task, integer_t
|
||||
new_thread->ref_count = 2;
|
||||
new_thread->waitq = NULL;
|
||||
new_thread->thread_magic = THREAD_MAGIC;
|
||||
new_thread->dispatch_qaddr = 0;
|
||||
|
||||
thread_lock_init(new_thread);
|
||||
// wake_lock_init(new_thread);
|
||||
@ -930,6 +931,13 @@ thread_swap_mach_voucher(
|
||||
return KERN_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
thread_dispatchqaddr(
|
||||
thread_t thread)
|
||||
{
|
||||
return thread->dispatch_qaddr;
|
||||
}
|
||||
|
||||
#if 0
|
||||
kern_return_t thread_set_cthread_self (uint32_t cthread)
|
||||
{
|
||||
|
@ -135,10 +135,8 @@ thread_info(
|
||||
|
||||
// FIXME: should contain pthread_t for this thread, see macosx-nat-infthread.c
|
||||
// Also used for PROC_PIDTHREADINFO.
|
||||
id->thread_handle = task_pid_vnr(thread->linux_task);
|
||||
id->thread_handle |= ((uint64_t)task_tgid_vnr(thread->linux_task)) << 32;
|
||||
|
||||
id->dispatch_qaddr = 0;
|
||||
id->thread_handle = thread->pthread_handle;
|
||||
id->dispatch_qaddr = thread->dispatch_qaddr;
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
|
@ -564,7 +564,7 @@ mach_vm_remap(
|
||||
if (IS_ERR(f))
|
||||
{
|
||||
kfree(remap);
|
||||
printk(KERN_WARNING "mach_vm_remap(): anon_inode_getfile() failed: %d\n", PTR_ERR(f));
|
||||
printk(KERN_WARNING "mach_vm_remap(): anon_inode_getfile() failed: %ld\n", PTR_ERR(f));
|
||||
ret = KERN_FAILURE;
|
||||
goto err;
|
||||
}
|
||||
|
@ -528,6 +528,7 @@ struct thread {
|
||||
int pending_signal;
|
||||
// linux_wait_queue_t lwait;
|
||||
uint32_t uu_rval[1];
|
||||
unsigned long dispatch_qaddr, pthread_handle;
|
||||
#ifdef __x86_64__
|
||||
unsigned long cont_jmpbuf[8];
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user