HP-UX Reference (11i v1 05/09) - 2 System Calls (vol 5)

r
regctl(2) regctl(2)
NAME
regctl() - privileged register control
SYNOPSIS
#include <machine/regctl.h>
int regctl(regctl_request_t request, unsigned int register, int64_t val,
uint64_t *retval);
Remarks
Much of the functionality of this capability is highly dependent on underlying hardware. An application that
uses this system call should not be expected to be portable across architectures or implementations.
Improper use of this system call may destroy system state and may cause system crashes and data corrup-
tion.
DESCRIPTION
The Real Time Extensions require capability for real-time applications to access the privileged registers
of the underlying processor. In the current implementation,
regctl() provides access to privileged regis-
ters of PA-RISC processors, namely Processor Status Word (PSW) and Control Registers CR8 - CR31. Refer
to the Hewlett-Packard PA-RISC 2.0 Architecture Manual for description on usage of these registers, bit
definitions and valid values.
This system call should only be used by threads that have a mandatory binding to a specific processor. All
operations are performed with respect to the underlying processor on which the calling thread is running.
Further, this system call can only be used by real-time applications running in real-time processor
domain. Refer to __pset_rtctl (2) for further details on real-time applications and real-time proces-
sors.
This system call is implemented as a lightweight call, hence the memory location specified by retval for
reading register contents must be in memory to avoid a page fault which will cause the system call to
return without performing the requested operation.
The request argument determines the precise action to be taken by
regctl() and is one of the following:
RTE_PA_MTSM
Write contents of val parameter to PSW register of the PA processor. The register and retval
parameters are ignored. Refer to architecture manuals to see which bits of PSW register can be
modified. This operation has potential to corrupt the processor and system state.
RTE_PA_MFSM
Read contents of PSW register of the PA processor into the memory location pointed to by the
retval parameter. The register and val parameter are ignored. Refer to architecture manuals
for interpretation of the PSW register contents.
RTE_PA_POLL_EIRR
Returns when all the bits specified by the mask in the val parameter are set in EIRR register of
the PA processor. Upon successful return, the bits in the EIRR matching mask are cleared and
the value of the EIRR register at the time the mask matched is returned in the memory location
pointed to by retval . The system call polls EIRR register in a loop for the count specified by
register parameter waiting for the specified bit(s) to be set. If all the mask bits are not seen even
after polling for specified count, the system call returns -1 and errno is set to [ETIMEDOUT] to
indicate failure.
RTE_PA_MTCTL
Write contents of val parameter to the control register specified by register parameter. The ret-
val parameter is ignored. Refer to architecture manuals to see valid control registers for this
operation. This operation has potential to corrupt the processor and system state.
RTE_PA_MFCTL
Read contents of the control register specified by the register parameter into the memory loca-
tion pointed to by retval parameter. The val parameter is ignored. Refer to architecture manuals
to see valid control registers for this operation.
To use this system call, link in the RTE library by specifying -lrte on the compiler or linker command
line.
Section 2280 Hewlett-Packard Company 1 HP-UX 11i Version 1: September 2005