Skip to content

Commit aa94403

Browse files
authored
Merge pull request #58 from kisum9/add-contextidr_el1-register
Add CONTEXTIDR_EL1 register.
2 parents 5f1f194 + d2fe0b9 commit aa94403

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

src/registers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ mod cntv_cval_el0;
3737
mod cntv_tval_el0;
3838
mod cntvct_el0;
3939
mod cntvoff_el2;
40+
mod contextidr_el1;
4041
mod cpacr_el1;
4142
mod cptr_el2;
4243
mod csselr_el1;
@@ -180,6 +181,7 @@ pub use cntv_cval_el0::CNTV_CVAL_EL0;
180181
pub use cntv_tval_el0::CNTV_TVAL_EL0;
181182
pub use cntvct_el0::CNTVCT_EL0;
182183
pub use cntvoff_el2::CNTVOFF_EL2;
184+
pub use contextidr_el1::CONTEXTIDR_EL1;
183185
pub use cpacr_el1::CPACR_EL1;
184186
pub use cptr_el2::CPTR_EL2;
185187
pub use csselr_el1::CSSELR_EL1;

src/registers/contextidr_el1.rs

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
//
3+
// Copyright (c) 2025 by the author(s)
4+
//
5+
// Author(s):
6+
// - Yan Tan <[email protected]>
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

Comments
 (0)