Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/linux/linux_machdep.c
Show First 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | linux_ptrace_getregs_machdep(struct thread *td, pid_t pid, | ||||
l_regset->fs_base = pcb->pcb_fsbase; | l_regset->fs_base = pcb->pcb_fsbase; | ||||
l_regset->gs_base = pcb->pcb_gsbase; | l_regset->gs_base = pcb->pcb_gsbase; | ||||
error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); | error = kern_ptrace(td, PT_LWPINFO, pid, &lwpinfo, sizeof(lwpinfo)); | ||||
if (error != 0) { | if (error != 0) { | ||||
linux_msg(td, "PT_LWPINFO failed with error %d", error); | linux_msg(td, "PT_LWPINFO failed with error %d", error); | ||||
return (error); | return (error); | ||||
} | } | ||||
if ((lwpinfo.pl_flags & PL_FLAG_SCE) != 0) { | |||||
/* | |||||
* Undo the mangling done in exception.S:fast_syscall_common(). | |||||
*/ | |||||
l_regset->r10 = l_regset->rcx; | |||||
} | |||||
if ((lwpinfo.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)) != 0) { | if ((lwpinfo.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX)) != 0) { | ||||
/* | /* | ||||
* In Linux, the syscall number - passed to the syscall | * In Linux, the syscall number - passed to the syscall | ||||
* as rax - is preserved in orig_rax; rax gets overwritten | * as rax - is preserved in orig_rax; rax gets overwritten | ||||
* with syscall return value. | * with syscall return value. | ||||
*/ | */ | ||||
l_regset->orig_rax = lwpinfo.pl_syscall_code; | l_regset->orig_rax = lwpinfo.pl_syscall_code; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 109 Lines • Show Last 20 Lines |