| |||
| Home > System Control Coprocessor > System control coprocessor registers > c13, Thread and Process ID Registers | |||
The purpose of the Thread and Process ID Registers is to provide locations to store the IDs of software threads and processes for OS management purposes.
The Thread and Process ID Registers are:
three read/write registers banked for Secure and Nonsecure states:
user read/write Thread and Process ID Register
user read-only Thread and Process ID Register
privileged only Thread and Process ID Register.
accessible in different modes:
the user read/write Thread and Process ID Register is read/write in User and privileged modes
the user read-only Thread and Process ID Register is read-only in User mode, and read/write in privileged modes
the privileged only Thread and Process ID Register is only accessible in privileged modes, and is read/write.
Table 3.146 shows the results of attempted access to each register for each mode.
Table 3.146. Results of access to the Thread and Process ID Registers[62]
| Secure privileged | Nonsecure privileged | Secure User | Nonsecure User | |||||
|---|---|---|---|---|---|---|---|---|
| Register[1] | Read | Write | Read | Write | Read | Write | Read | Write |
| User read/write | Secure data | Secure data | Nonsecure data | Nonsecure data | Secure data | Secure data | Nonsecure data | Nonsecure data |
| User read-only | Secure data | Secure data | Nonsecure data | Nonsecure data | Secure data | Undefined | Nonsecure data | Undefined |
| Privileged only | Secure data | Secure data | Nonsecure data | Nonsecure data | Undefined | Undefined | Undefined | Undefined |
[1] Each row refers to a Thread and Process ID Register. For example, the User read/write row refers to the User read/write Thread and Process ID Register. | ||||||||
To access the Thread and Process ID Registers, read or write CP15 with:
MRC p15, 0, <Rd>, c13, c0, 2 ; Read User read/write Thread and Process ID Register
MCR p15, 0, <Rd>, c13, c0, 2 ; Write User read/write Thread and Process ID Register
MRC p15, 0, <Rd>, c13, c0, 3 ; Read User read-only Thread and Process ID Register
MCR p15, 0, <Rd>, c13, c0, 3 ; Write User read-only Thread and Process ID Register
MRC p15, 0, <Rd>, c13, c0, 4 ; Read Privileged only Thread and Process ID Register
MCR p15, 0, <Rd>, c13, c0, 4 ; Write Privileged only Thread and Process ID Register
Reading or writing the Thread and Process ID Registers has no effect on the processor state or operation. These registers provide OS support and must be managed by the OS.
You must clear the contents of all Thread and Process ID Registers on process switches to prevent data leaking from one process to another. This is important to ensure the security of secure data.