Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/linux/linux_ptrace.c
Show First 20 Lines • Show All 518 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
linux_msg(td, "PTRACE_SEIZE not implemented; returning EINVAL"); | linux_msg(td, "PTRACE_SEIZE not implemented; returning EINVAL"); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
static int | static int | ||||
linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, | linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, | ||||
l_ulong addr, l_ulong data) | l_ulong len, l_ulong data) | ||||
{ | { | ||||
struct ptrace_lwpinfo lwpinfo; | struct ptrace_lwpinfo lwpinfo; | ||||
struct ptrace_sc_ret sr; | struct ptrace_sc_ret sr; | ||||
struct reg b_reg; | struct reg b_reg; | ||||
struct syscall_info si; | struct syscall_info si; | ||||
int error; | int error; | ||||
error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); | error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | linux_ptrace_get_syscall_info(struct thread *td, pid_t pid, | ||||
error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0); | error = kern_ptrace(td, PT_GETREGS, pid, &b_reg, 0); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
si.arch = LINUX_ARCH_AMD64; | si.arch = LINUX_ARCH_AMD64; | ||||
si.instruction_pointer = b_reg.r_rip; | si.instruction_pointer = b_reg.r_rip; | ||||
si.stack_pointer = b_reg.r_rsp; | si.stack_pointer = b_reg.r_rsp; | ||||
error = copyout(&si, (void *)data, sizeof(si)); | len = MIN(len, sizeof(si)); | ||||
error = copyout(&si, (void *)data, len); | |||||
if (error == 0) | if (error == 0) | ||||
td->td_retval[0] = sizeof(si); | td->td_retval[0] = sizeof(si); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) | linux_ptrace(struct thread *td, struct linux_ptrace_args *uap) | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |