18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com) 38c2ecf20Sopenharmony_ci * Licensed under the GPL 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <errno.h> 78c2ecf20Sopenharmony_ci#include <ptrace_user.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciint ptrace_getregs(long pid, unsigned long *regs_out) 108c2ecf20Sopenharmony_ci{ 118c2ecf20Sopenharmony_ci if (ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0) 128c2ecf20Sopenharmony_ci return -errno; 138c2ecf20Sopenharmony_ci return 0; 148c2ecf20Sopenharmony_ci} 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciint ptrace_setregs(long pid, unsigned long *regs) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci if (ptrace(PTRACE_SETREGS, pid, 0, regs) < 0) 198c2ecf20Sopenharmony_ci return -errno; 208c2ecf20Sopenharmony_ci return 0; 218c2ecf20Sopenharmony_ci} 22