| Updated: October 28, 2024 |
Read the given register set.
#include <sys/procfs.h> #define DCMD_PROC_GETREGSET __DIOTF(_DCMD_PROC, __PROC_SUBCMD_PROCFS + 25, procfs_regset)
The arguments to devctl() are:
| Argument | Value |
|---|---|
| filedes | A file descriptor for the process. |
| dcmd | DCMD_PROC_GETREGSET |
| dev_data_ptr | A pointer to a procfs_regset structure |
| n_bytes | The number of bytes that you want to get |
| dev_info_ptr | A pointer to an int where the number of bytes retrieved can be stored |
The argument is a pointer to a procfs_regset structure where the required information can be stored:
typedef struct _procfs_regset {
uint32_t id;
char buf[8192];
} procfs_regset;
Set the id member to indicate the registers you want to get:
For example:
procfs_regset regset; int returned_length; regset.id = REGSET_PERFREGS; devctl( fd, DCMD_PROC_GETREGSET, ®set, sizeof(regset), &returned_length );
(QNX Neutrino 7.0.4 or later) The register sets defined in <sys/debug.h> include some special values, REGSET_STARTCPU and REGSET_STARTPRIV:
In order to get or set registers in the range from REGSET_STARTPRIV and up, your process needs the PROCMGR_AID_PRIVREG ability enabled. See procmgr_ability() in the C Library Reference.
The target-specific registers include the following:
For example:
procfs_regset regset;
int returned_length;
regset.id = AARCH64_REGSET_ACTLR;
*(uint64_t *)®set.buf[0] = 0;
devctl( fd, DCMD_PROC_GETREGSET, ®set, sizeof(uint32_t) + sizeof(uint64_t),
&returned_length );
printf ("The value is %llx.\n", *(uint64_t *)®set.buf[0]);
To set a given register set, use DCMD_PROC_SETREGSET.