-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rs
144 lines (125 loc) · 3.84 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
//! ACLE in Rust
//!
//! # Developer notes
//!
//! Below is a list of built-in targets that are representative of the different ARM
//! architectures; the list includes the `target_feature`s they possess.
//!
//! - `armv4t-unknown-linux-gnueabi` - **ARMv4** - `+v4t`
//! - `armv5te-unknown-linux-gnueabi` - **ARMv5TE** - `+v4t +v5te`
//! - `arm-unknown-linux-gnueabi` - **ARMv6** - `+v4t +v5te +v6`
//! - `thumbv6m-none-eabi` - **ARMv6-M** - `+v4t +v5te +v6 +thumb-mode +mclass`
//! - `armv7-unknown-linux-gnueabihf` - **ARMv7-A** - `+v4t +v5te +v6 +v6k +v6t2 +v7 +dsp +thumb2 +aclass`
//! - `armv7r-none-eabi` - **ARMv7-R** - `+v4t +v5te +v6 +v6k +v6t2 +v7 +dsp +thumb2 +rclass`
//! - `thumbv7m-none-eabi` - **ARMv7-M** - `+v4t +v5te +v6 +v6k +v6t2 +v7 +thumb2 +thumb-mode +mclass`
//! - `thumbv7em-none-eabi` - **ARMv7E-M** - `+v4t +v5te +v6 +v6k +v6t2 +v7 +dsp +thumb2 +thumb-mode +mclass`
//! - `aarch64-unknown-linux-gnu` - **ARMv8-A (AArch64)** - `+fp +neon`
//!
//! From section 10.1 of ACLE:
//!
//! - "In the sequence of Arm architectures { v5, v5TE, v6, v6T2, v7 } each architecture includes
//! its predecessor instruction set."
//!
//! - "In the sequence of Thumb-only architectures { v6-M, v7-M, v7E-M } each architecture includes
//! its predecessor instruction set."
//!
//! From that info and from looking at how LLVM features work (using custom targets) we can identify
//! features that are subsets of others:
//!
//! Legend: `a < b` reads as "`a` is a subset of `b`"; this means that if `b` is enabled then `a` is
//! enabled as well.
//!
//! - `v4t < v5te < v6 < v6k < v6t2 < v7 < v8`
//! - `v6 < v8m < v6t2`
//! - `v7 < v8m.main`
//!
//! # References
//!
//! - [ACLE Q2 2018](https://developer.arm.com/docs/101028/latest)
#![deny(missing_docs)]
#![feature(asm)]
#![feature(rustc_attrs)]
#![no_std]
// Supported arches: 8, 7, 6-M. See Section 10.1 of ACLE (e.g. DMB)
// But this is further refined within the module
#[cfg(any(
// v8
target_arch = "aarch64",
// v7
target_feature = "v7",
// v6-M
target_feature = "mclass"
))]
mod barrier;
#[cfg(any(
target_arch = "aarch64",
target_feature = "v7",
target_feature = "mclass"
))]
pub use barrier::*;
mod hints;
pub use hints::*;
mod registers;
pub use registers::*;
// Supported arches: 5TE, 7E-M. See Section 10.1 of ACLE (e.g. QADD)
// But we also exclude the A profile because DSP is deprecated on that profile as of ACLE 2.0 (see
// section 5.4.7)
#[cfg(any(
// >= v5TE but excludes v7-A
all(target_feature = "v5te", not(target_feature = "mclass"), not(target_feature = "aclass")),
// v7E-M
all(target_feature = "mclass", target_feature = "dsp"),
))]
mod dsp;
#[cfg(any(
all(
target_feature = "v5te",
not(target_feature = "mclass"),
not(target_feature = "aclass")
),
all(target_feature = "mclass", target_feature = "dsp"),
))]
pub use dsp::*;
// Deprecated in ACLE 2.0 for the A profile but they are fully supported for the M and R profiles,
// says Section 5.4.9 of ACLE.
#[cfg(any(
// v7-R
target_feature = "rclass",
// v7E-M
all(target_feature = "mclass", target_feature = "dsp")
))]
mod simd32;
#[cfg(any(
target_feature = "rclass",
all(target_feature = "mclass", target_feature = "dsp")
))]
pub use simd32::*;
mod sealed {
pub trait Dmb {
unsafe fn __dmb(&self);
}
pub trait Dsb {
unsafe fn __dsb(&self);
}
pub trait Isb {
unsafe fn __isb(&self);
}
pub trait Rsr {
unsafe fn __rsr(&self) -> u32;
}
pub trait Rsr64 {
unsafe fn __rsr64(&self) -> u64;
}
pub trait Rsrp {
unsafe fn __rsrp(&self) -> *const u8;
}
pub trait Wsr {
unsafe fn __wsr(&self, value: u32);
}
pub trait Wsr64 {
unsafe fn __wsr64(&self, value: u64);
}
pub trait Wsrp {
unsafe fn __wsrp(&self, value: *const u8);
}
}