You copied the Doc URL to your clipboard.

3.3.37. 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:

  • in CP15 c13

  • three 32-bit read/write registers:

    • User Read/Write Thread and Process ID Register

    • User Read Only Thread and Process ID Register

    • Privileged Only Thread and Process ID Register

  • only available from the rev1 (r1p0) release of the ARM1136JF-S processor.

The register names indicate the modes from which they can be accessed, and Table 3.130 shows the results of attempted accesses to each register for each mode.

Table 3.130. Results of access to the thread and process ID registers
RegisterPrivilegedUser
ReadWriteReadWrite
User Read/Write Thread and Process ID RegisterData readData writeData readData write
User Read Only Thread and Process ID RegisterData readData writeData readUndefined Instruction exception
Privileged Only Thread and Process ID RegisterData readData writeUndefined Instruction exceptionUndefined Instruction exception

Reading or writing the thread and process ID registers has no effect on 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. The reset value of these registers is 0.

Accessing the Thread and process ID registers

Table 3.130 shows the results of attempted accesses to each register for each mode.

To access the Thread and process ID registers you read or write CP15 with:

  • Opcode_1 set to 0

  • CRn set to c13

  • CRm set to c0

  • Opcode_2 set to:

    • 2, User Read/Write Thread and Process ID Register

    • 3, User Read Only Thread and Process ID Register

    • 4, Privileged Only Thread and Process ID Register.

For example:

                  MRC p15, 0, <Rd>, c13, c0, 2     ; Read  User Read/Write Thread and Proc. ID Register
                  MCR p15, 0, <Rd>, c13, c0, 2     ; Write User Read/Write Thread and Proc. ID Register
                  MRC p15, 0, <Rd>, c13, c0, 3     ; Read  User Read Only Thread and Proc. ID Register
                  MCR p15, 0, <Rd>, c13, c0, 3     ; Write User Read Only Thread and Proc. ID Register
                  MRC p15, 0, <Rd>, c13, c0, 4     ; Read  Privileged Only Thread and Proc. ID Register
                  MCR p15, 0, <Rd>, c13, c0, 4     ; Write Privileged Only Thread and Proc. ID Register