cortex_a/registers/currentel.rs
1// SPDX-License-Identifier: Apache-2.0 OR MIT
2//
3// Copyright (c) 2018-2022 by the author(s)
4//
5// Author(s):
6// - Andre Richter <andre.o.richter@gmail.com>
7
8//! Current Exception Level
9//!
10//! Holds the current Exception level.
11
12use tock_registers::{interfaces::Readable, register_bitfields};
13
14register_bitfields! {u64,
15 pub CurrentEL [
16 /// Current Exception level. Possible values of this field are:
17 ///
18 /// 00 EL0
19 /// 01 EL1
20 /// 10 EL2
21 /// 11 EL3
22 ///
23 /// When the HCR_EL2.NV bit is 1, Non-secure EL1 read accesses to the CurrentEL register
24 /// return the value of 0x2 in this field.
25 ///
26 /// This field resets to a value that is architecturally UNKNOWN.
27 EL OFFSET(2) NUMBITS(2) [
28 EL0 = 0,
29 EL1 = 1,
30 EL2 = 2,
31 EL3 = 3
32 ]
33 ]
34}
35
36pub struct Reg;
37
38impl Readable for Reg {
39 type T = u64;
40 type R = CurrentEL::Register;
41
42 sys_coproc_read_raw!(u64, "CurrentEL", "x");
43}
44
45#[allow(non_upper_case_globals)]
46pub const CurrentEL: Reg = Reg {};