Skip to content
This repository was archived by the owner on Nov 7, 2022. It is now read-only.

Commit ffcb3eb

Browse files
committed
Add minimal PAR_EL1.
1 parent 719aeae commit ffcb3eb

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cortex-a"
3-
version = "5.1.3"
3+
version = "5.1.4"
44
authors = ["Andre Richter <andre.o.richter@gmail.com>"]
55
description = "Low level access to Cortex-A processors"
66
homepage = "https://github.com/rust-embedded/cortex-a"

src/regs/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ mod lr;
2929
mod mair_el1;
3030
mod midr_el1;
3131
mod mpidr_el1;
32+
mod par_el1;
3233
mod scr_el3;
3334
mod sctlr_el1;
3435
mod sp;
@@ -72,6 +73,7 @@ pub use self::lr::LR;
7273
pub use self::mair_el1::MAIR_EL1;
7374
pub use self::midr_el1::MIDR_EL1;
7475
pub use self::mpidr_el1::MPIDR_EL1;
76+
pub use self::par_el1::PAR_EL1;
7577
pub use self::scr_el3::SCR_EL3;
7678
pub use self::sctlr_el1::SCTLR_EL1;
7779
pub use self::sp::SP;

src/regs/par_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) 2021 by the author(s)
4+
//
5+
// Author(s):
6+
// - Andre Richter <andre.o.richter@gmail.com>
7+
8+
//! Physical Address Register - EL1
9+
//!
10+
//! Returns the output address (OA) from an Address translation instruction that executed
11+
//! successfully, or fault information if the instruction did not execute successfully.
12+
13+
use register::{cpu::RegisterReadWrite, register_bitfields};
14+
15+
register_bitfields! {u64,
16+
pub PAR_EL1 [
17+
/// Output address. The output address (OA) corresponding to the supplied input address.
18+
/// This field returns address bits[47:12].
19+
///
20+
/// When ARMv8.2-LPA is implemented, and 52-bit addresses and a 64KB translation granule are
21+
/// in use, the PA[51:48] bits form the upper part of the address value. Otherwise the
22+
/// PA[51:48] bits are RES0.
23+
///
24+
/// For implementations with fewer than 48 physical address bits, the corresponding upper
25+
/// bits in this field are RES0.
26+
///
27+
/// This field resets to an architecturally UNKNOWN value.
28+
PA OFFSET(12) NUMBITS(36) [],
29+
30+
/// Indicates whether the instruction performed a successful address translation.
31+
///
32+
/// 0 Address translation completed successfully.
33+
///
34+
/// 1 Address translation aborted.
35+
///
36+
/// This field resets to an architecturally UNKNOWN value.
37+
F OFFSET(0) NUMBITS(1) [
38+
TranslationSuccessfull = 0,
39+
TranslationAborted = 1
40+
]
41+
]
42+
}
43+
44+
pub struct Reg;
45+
46+
impl RegisterReadWrite<u64, PAR_EL1::Register> for Reg {
47+
sys_coproc_read_raw!(u64, "PAR_EL1", "x");
48+
sys_coproc_write_raw!(u64, "PAR_EL1", "x");
49+
}
50+
51+
pub static PAR_EL1: Reg = Reg {};

0 commit comments

Comments
 (0)