#include <arm64/machine_machdep.h>
arm64/machine_machdep.h
macroMACHDEP_TPIDR_CPUNUM_SHIFT
We cache the following in EL0 registers
TPIDRRO_EL0
- the current cthread pointer
TPIDR_EL0
- the current CPU number (12 bits)
- the current logical cluster id (8 bits)
NOTE: Keep this in sync with libsyscall/os/tsd.h,
specifically _os_cpu_number(), _os_cpu_cluster_number()
#define MACHDEP_TPIDR_CPUNUM_SHIFT 0
macroMACHDEP_TPIDR_CPUNUM_MASK
#define MACHDEP_TPIDR_CPUNUM_MASK 0x0000000000000fff
macroMACHDEP_TPIDR_CLUSTERID_SHIFT
#define MACHDEP_TPIDR_CLUSTERID_SHIFT 12
macroMACHDEP_TPIDR_CLUSTERID_MASK
#define MACHDEP_TPIDR_CLUSTERID_MASK 0x00000000000ff000
macroMACHDEP_TPIDR_CPU_DATA_MASK
Mask and count of bits that are CPU-dependent instead of being restored from thread state.
#define MACHDEP_TPIDR_CPU_DATA_MASK (MACHDEP_TPIDR_CPUNUM_MASK | MACHDEP_TPIDR_CLUSTERID_MASK)
macroMACHDEP_TPIDR_CPU_DATA_COUNT
#define MACHDEP_TPIDR_CPU_DATA_COUNT MACHDEP_TPIDR_CLUSTERID_SHIFT
macroMACHDEP_TPIDR_THREAD_DATA_COUNT
Count of bits that are restored from thread state.
#define MACHDEP_TPIDR_THREAD_DATA_COUNT (64 - MACHDEP_TPIDR_CPU_DATA_COUNT)
macroMACHDEP_TPIDR_FLAG_PRESERVE_X18_SHIFT
Do not smash x18 on context switch. This bit will only be honored
if the thread also has an entitlement allowing x18 to be preserved.
This bit is saved and restored during context switch through
ARM_MACHINE_THREAD_PRESERVE_X18_SAVE.
#define MACHDEP_TPIDR_FLAG_PRESERVE_X18_SHIFT 48
macroMACHDEP_TPIDR_FLAG_PRESERVE_X18
#define MACHDEP_TPIDR_FLAG_PRESERVE_X18 0x0001000000000000ULL
macroMACHDEP_TPIDR_THREAD_MASK
Mask of bits that are restored from thread state.
#define MACHDEP_TPIDR_THREAD_MASK MACHDEP_TPIDR_FLAG_PRESERVE_X18