|
| 1 | +// SPDX-License-Identifier: Apache-2.0 OR MIT |
| 2 | +// |
| 3 | +// Copyright (c) 2025 by the author(s) |
| 4 | +// |
| 5 | +// Author(s): |
| 6 | + |
| 7 | + |
| 8 | +//! Context ID Register |
| 9 | +//! |
| 10 | +//! Holds the Process Context ID (PCID) for the current process. |
| 11 | +//! This register is used to identify the current process context. |
| 12 | +
|
| 13 | +use tock_registers::{ |
| 14 | + interfaces::{Readable, Writeable}, |
| 15 | + register_bitfields, |
| 16 | +}; |
| 17 | + |
| 18 | +register_bitfields! {u64, |
| 19 | + pub CONTEXTIDR_EL1 [ |
| 20 | + // Reserved, RES0,[63:32] |
| 21 | + |
| 22 | + /// Process Identifier |
| 23 | + /// |
| 24 | + /// This field must be programmed with a unique value that identifies the current process. |
| 25 | + /// |
| 26 | + /// - In AArch32 state, when TTBCR.EAE is set to 0, CONTEXTIDR.ASID holds the ASID |
| 27 | + /// - In AArch64 state, CONTEXTIDR_EL1 is independent of the ASID, \ |
| 28 | + /// and for the EL1&0 translation regime either TTBR0_EL1 or TTBR1_EL1 holds the ASID. |
| 29 | + /// |
| 30 | + /// On a Cold reset, this field resets to an architecturally UNKNOWN value |
| 31 | + PROCID OFFSET(0) NUMBITS(32) [] |
| 32 | + ] |
| 33 | +} |
| 34 | + |
| 35 | +pub struct Reg; |
| 36 | + |
| 37 | +impl Readable for Reg { |
| 38 | + type T = u64; |
| 39 | + type R = CONTEXTIDR_EL1::Register; |
| 40 | + |
| 41 | + sys_coproc_read_raw!(u64, "S3_0_C13_C0_1", "x"); |
| 42 | +} |
| 43 | + |
| 44 | +impl Writeable for Reg { |
| 45 | + type T = u64; |
| 46 | + type R = CONTEXTIDR_EL1::Register; |
| 47 | + |
| 48 | + sys_coproc_write_raw!(u64, "S3_0_C13_C0_1", "x"); |
| 49 | +} |
| 50 | + |
| 51 | +pub const CONTEXTIDR_EL1: Reg = Reg {}; |
0 commit comments