mirror of
https://github.com/google/alioth.git
synced 2024-11-28 09:26:21 +00:00
feat: add definitions for aarch64 registers
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
This commit is contained in:
parent
468080b5b0
commit
6368c4fb38
3 changed files with 85 additions and 0 deletions
15
alioth/src/arch/aarch64/aarch64.rs
Normal file
15
alioth/src/arch/aarch64/aarch64.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2024 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
pub mod reg;
|
64
alioth/src/arch/aarch64/reg.rs
Normal file
64
alioth/src/arch/aarch64/reg.rs
Normal file
|
@ -0,0 +1,64 @@
|
|||
// Copyright 2024 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::c_enum;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
|
||||
pub enum Reg {
|
||||
X0,
|
||||
X1,
|
||||
X2,
|
||||
X3,
|
||||
X4,
|
||||
X5,
|
||||
X6,
|
||||
X7,
|
||||
X8,
|
||||
X9,
|
||||
X10,
|
||||
X11,
|
||||
X12,
|
||||
X13,
|
||||
X14,
|
||||
X15,
|
||||
X16,
|
||||
X17,
|
||||
X18,
|
||||
X19,
|
||||
X20,
|
||||
X21,
|
||||
X22,
|
||||
X23,
|
||||
X24,
|
||||
X25,
|
||||
X26,
|
||||
X27,
|
||||
X28,
|
||||
X29,
|
||||
X30,
|
||||
Sp,
|
||||
Pc,
|
||||
Pstate,
|
||||
}
|
||||
|
||||
pub const fn encode(op0: u32, op1: u32, crn: u32, crm: u32, op2: u32) -> u32 {
|
||||
(op0 << 19) | (op1 << 16) | (crn << 12) | (crm << 8) | (op2 << 5)
|
||||
}
|
||||
|
||||
c_enum! {
|
||||
pub struct SReg(u32);
|
||||
{
|
||||
MPIDR_EL1 = encode(3, 0, 0, 0, 5);
|
||||
}
|
||||
}
|
|
@ -12,8 +12,14 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[path = "aarch64/aarch64.rs"]
|
||||
mod aarch64;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[path = "x86_64/x86_64.rs"]
|
||||
mod x86_64;
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use aarch64::*;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
pub use x86_64::*;
|
||||
|
|
Loading…
Reference in a new issue