mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:27:35 +00:00
Kernel: Add ptrace commands for reading/writing the debug registers
This adds PT_PEEKDEBUG and PT_POKEDEBUG to allow for reading/writing the debug registers, and updates the Kernel's debug handler to read the new information from the debug status register.
This commit is contained in:
parent
97a4c627cb
commit
3123ffb19d
6 changed files with 79 additions and 5 deletions
|
@ -40,7 +40,8 @@ int ptrace(int request, pid_t tid, void* addr, int data)
|
|||
|
||||
u32 out_data;
|
||||
Syscall::SC_ptrace_peek_params peek_params;
|
||||
if (request == PT_PEEK) {
|
||||
auto is_peek_type = request == PT_PEEK || request == PT_PEEKDEBUG;
|
||||
if (is_peek_type) {
|
||||
peek_params.address = reinterpret_cast<u32*>(addr);
|
||||
peek_params.out_data = &out_data;
|
||||
addr = &peek_params;
|
||||
|
@ -54,7 +55,7 @@ int ptrace(int request, pid_t tid, void* addr, int data)
|
|||
};
|
||||
int rc = syscall(SC_ptrace, ¶ms);
|
||||
|
||||
if (request == PT_PEEK) {
|
||||
if (is_peek_type) {
|
||||
if (rc < 0) {
|
||||
errno = -rc;
|
||||
return -1;
|
||||
|
|
|
@ -39,6 +39,8 @@ __BEGIN_DECLS
|
|||
#define PT_PEEK 7
|
||||
#define PT_POKE 8
|
||||
#define PT_SETREGS 9
|
||||
#define PT_POKEDEBUG 10
|
||||
#define PT_PEEKDEBUG 11
|
||||
|
||||
// FIXME: PID/TID ISSUE
|
||||
// Affects the entirety of LibDebug and Userland/strace.cpp.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue