cortex_a/registers/
spsel.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//! Stack Pointer Select
9//!
10//! Allows the Stack Pointer to be selected between SP_EL0 and SP_ELx.
11
12use tock_registers::{
13    interfaces::{Readable, Writeable},
14    register_bitfields,
15};
16
17register_bitfields! {u64,
18    pub SPSel [
19        /// Stack pointer to use. Possible values of this bit are:
20        ///
21        /// 0 Use SP_EL0 at all Exception levels.
22        /// 1 Use SP_ELx for Exception level ELx.
23        ///
24        /// When this register has an architecturally-defined reset value, this field resets to 1.
25        SP OFFSET(0) NUMBITS(1) [
26            EL0 = 0,
27            ELx = 1
28        ]
29    ]
30}
31
32pub struct Reg;
33
34impl Readable for Reg {
35    type T = u64;
36    type R = SPSel::Register;
37
38    sys_coproc_read_raw!(u64, "SPSEL", "x");
39}
40
41impl Writeable for Reg {
42    type T = u64;
43    type R = SPSel::Register;
44
45    sys_coproc_write_raw!(u64, "SPSEL", "x");
46}
47
48#[allow(non_upper_case_globals)]
49pub const SPSel: Reg = Reg {};