Repository navigation
Expand file tree
/
Copy pathlib.rs
More file actions
277 lines (264 loc) · 11 KB
/
Copy pathlib.rs
File metadata and controls
277 lines (264 loc) · 11 KB
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
#![allow(dead_code, unused_variables, unused_imports)]
// `regs!` recurses once per constant, and the Hub register file has 133.
#![recursion_limit = "256"]
#[cfg(all(feature = "lightning", feature = "developer"))]
compile_error!(
"features `lightning` and `developer` are mutually exclusive: lightning strips \
debuggability for speed (fixed jitv2 dispatch, no jitcheck/inline-compile \
switching, etc.) while developer exists specifically to add it back — pick one"
);
#[cfg(all(feature = "jitv2_lockstep", feature = "lightning"))]
compile_error!(
"features `jitv2_lockstep` and `lightning` are mutually exclusive: lockstep \
verifies every JIT instruction against a real interpreter run and breaks \
into the monitor on divergence, which needs the debuggability lightning \
strips (it also implies `opcodefusion`, refused below for its own \
reasons). lockstep already pulls in `developer`, which lightning \
separately conflicts with — build lockstep without lightning"
);
#[cfg(all(feature = "jitv2_lockstep", feature = "opcodefusion"))]
compile_error!(
"features `jitv2_lockstep` and `opcodefusion` are mutually exclusive: a \
fused pair's second instruction is never independently fetched, decoded \
or dispatched, so lockstep's per-instruction interpreter reference run \
has nothing to bracket it against — the JIT would execute it while the \
comparison silently skipped it. Build lockstep without opcodefusion \
(note `lightning` implies opcodefusion)"
);
#[cfg(all(feature = "jitv2_lockstep", feature = "jitv2_opcodefusion"))]
compile_error!(
"features `jitv2_lockstep` and `jitv2_opcodefusion` are mutually \
exclusive, for the same reason as `opcodefusion`: codegen's fusion sites \
(`try_emit_fused_nop_slot`, `try_emit_fused_lui`) already disable \
themselves under lockstep because a fused instruction cannot be \
individually step-bracketed — enabling the feature would be a silent \
no-op that misrepresents what was built. Build lockstep without it"
);
#[cfg(all(feature = "instr_stats", feature = "jitv2"))]
compile_error!(
"features `instr_stats` and `jitv2` together are meaningless: instr_stats' \
execution counters are interpreter-path only (see its own Cargo.toml doc \
comment) and a jitv2 build routes the vast majority of instructions \
through compiled code, bypassing them entirely — the resulting counts \
would silently undercount almost everything rather than erroring. Build \
instr_stats without jitv2 to get real interpreter-only counts."
);
#[cfg(feature = "r5ksc_triton")]
compile_error!(
"`r5ksc_triton` is an unfinished O2/Triton R5000 secondary-cache model. \
It is not the cache used by the supported O2 profile and cannot be \
enabled: cache_op_index_inv_l1i fails with this model. The separate \
external R5000 secondary-cache model (`r5ksc`) is also disabled. See \
src/cpu/mips_cache_v2.rs and clanker/cpu/r5k-l1i-cache-bugs.md."
);
#[cfg(feature = "r5ksc")]
compile_error!(
"`r5ksc` (external R4600SC-style secondary cache — what a real Indy \
R5000 board has) does not currently work: `cargo test --features \
r5ksc` fails mips_cache_v2's L1I tests. There is currently no working \
R5000 secondary-cache configuration. Refusing to build rather than silently \
shipping a broken cache model. See src/cpu/mips_cache_v2.rs and \
clanker/cpu/r5k-l1i-cache-bugs.md. The R5000 without a secondary \
cache (`--cpu r5000`) is unaffected."
);
/// The version this binary was built as: `RELEASE_VERSION` from the
/// distribution build (`nightly.YYYY.MM.DD` or `X.Y.Z`, see
/// scripts/dist/version.sh), or the crate version for a plain `cargo build`.
/// Cargo tracks `option_env!`, so changing it rebuilds this crate.
pub const VERSION: &str = match option_env!("RELEASE_VERSION") {
Some(v) if !v.is_empty() => v,
_ => env!("CARGO_PKG_VERSION"),
};
/// Compile-time feature flags exposed for tooling (e.g. iris-gui) so it can
/// surface "rebuild with ..." hints without duplicating the cargo feature set.
pub mod build_features {
pub const PCAP: bool = cfg!(feature = "pcap");
pub const JITV2: bool = cfg!(feature = "jitv2");
pub const REX_JIT: bool = cfg!(feature = "rex-jit");
pub const GR4_JIT: bool = cfg!(feature = "gr4-jit");
pub const GR2_JIT: bool = cfg!(feature = "gr2-jit");
/// Lightning build strips breakpoint checks and the traceback buffer
/// from the MIPS executor hot path. Interactive debugging (GDB stub,
/// monitor breakpoints) is non-functional in this build.
pub const LIGHTNING: bool = cfg!(feature = "lightning");
pub const IDLE_PAUSE: bool = cfg!(feature = "idle-pause");
/// Host services for IRIX programs (private syscalls 3000-3009,
/// `iris-hostcall`). No per-machine config — a guest either gets the trap
/// or doesn't, decided at build time.
pub const HOSTCALL: bool = cfg!(feature = "hostcall");
/// Host OpenGL for IRIX programs over host call 3000 (`iris-hostgl`).
/// Implies `hostcall`. macOS (CGL) and Linux (EGL) have backends —
/// `hostgl` can be built elsewhere, but `register()` then has nothing to
/// register, so this is `false` there even in a `--features hostgl` build.
pub const HOSTGL: bool = cfg!(feature = "hostgl") && cfg!(any(target_os = "macos", target_os = "linux"));
// There is deliberately no `CPU` constant here any more. The emulated CPU
// stopped being a build-time property: all three CPU/cache models are
// monomorphised into every binary and `Machine::new` picks between them
// from `cfg.machine.cpu`. A constant derived from cargo features could only
// report how the binary was compiled, which is no longer the same question
// as which CPU is running — and it was being displayed to users as though
// it were. Ask the config (`MachineConfig::machine.cpu`), or the guest,
// which reads PRId.
/// Every compile-time flag this binary was built with, in a fixed order.
///
/// Execution-engine flags come first: these change what the guest sees,
/// not just how fast it sees it, and a benchmark result is meaningless
/// without them. The CPU model is not here — it is a runtime setting.
///
/// In the library rather than in `main.rs` because a saved benchmark result
/// records this list, and the in-process runner has no startup banner to
/// read it back out of.
pub fn enabled() -> Vec<&'static str> {
const FEATURES: &[(&str, bool)] = &[
("r5ksc", cfg!(feature = "r5ksc")),
("r5ksc_triton", cfg!(feature = "r5ksc_triton")),
("jitv2", cfg!(feature = "jitv2")),
("jitv2_opcodefusion", cfg!(feature = "jitv2_opcodefusion")),
("opcodefusion", cfg!(feature = "opcodefusion")),
("idle-pause", cfg!(feature = "idle-pause")),
("rex-jit", cfg!(feature = "rex-jit")),
("gr4-jit", cfg!(feature = "gr4-jit")),
("gr2-jit", cfg!(feature = "gr2-jit")),
("lightning", cfg!(feature = "lightning")),
("hostcall", cfg!(feature = "hostcall")),
("hostgl", cfg!(feature = "hostgl")),
("tcache", cfg!(feature = "tcache")),
("tlbvmap", cfg!(feature = "tlbvmap")),
("tlbstats", cfg!(feature = "tlbstats")),
("tlbcheck", cfg!(feature = "tlbcheck")),
("instr_stats", cfg!(feature = "instr_stats")),
("pcap", cfg!(feature = "pcap")),
("ci_clock", cfg!(feature = "ci_clock")),
("developer", cfg!(feature = "developer")),
("developer_ip7", cfg!(feature = "developer_ip7")),
("debug_cache", cfg!(feature = "debug_cache")),
("jitv2_lockstep", cfg!(feature = "jitv2_lockstep")),
("jitv2_smc_check", cfg!(feature = "jitv2_smc_check")),
("fetchverify", cfg!(feature = "fetchverify")),
("j2wp", cfg!(feature = "j2wp")),
("llstats", cfg!(feature = "llstats")),
("perfetto", cfg!(feature = "perfetto")),
];
FEATURES.iter().filter(|(_, e)| *e).map(|(n, _)| *n).collect()
}
/// `enabled()` as the emulator prints it at startup.
pub fn banner() -> String {
let on = enabled();
if on.is_empty() { "(none)".to_string() } else { on.join(" ") }
}
}
pub mod validate_config;
pub mod config;
pub mod identity;
pub mod traits;
#[macro_use]
pub mod devlog;
pub mod ppmem;
pub mod memory_map;
pub mod machine;
pub mod workstation;
/// The SGI O2 (IP32): its bus and devices -- see `docs/o2-ip32.md` (and, for how it was built, `clanker/devices/ip32-o2-bringup-log.md`).
/// Not yet wired into `Physical`; `ip32_machine` drives the CPU against it.
pub mod ip32;
pub mod ip32_screen;
pub mod ip32_machine;
/// The SGI Octane (IP30): its bus and machine -- see `docs/octane-ip30-address-map.md`.
pub mod ip30;
pub mod ip30_machine;
/// The IP27 node: its processor bus, memory and uncached views. The Origin 200 and
/// the Origin 2000 and Onyx2 desksides are built from it.
pub mod ip27;
pub mod ip27_machine;
pub mod ip29_machine;
/// Fuel has an IP34 board and uses the IP35 software platform and processor views.
pub mod ip35;
pub mod ip34_machine;
pub mod ip35_machine;
pub mod ip53_machine;
/// Bounded MMIO windows and the sparse map of them the SN machines place in
/// an address map, and the physical address masks they share.
pub mod window_map;
/// The Scalable Node (SN) layer both IP27 and IP35 boards build on: nodes, their memory and uncached views.
pub mod sn;
pub mod machine_state;
pub mod platform;
pub mod clock;
pub mod physical;
pub mod ip22_bus;
pub mod monitor;
pub mod console_edit;
pub mod locks;
pub mod sync;
pub mod net;
pub mod bench_report;
pub mod benchsuite;
pub mod bench_runner;
pub mod junit;
pub mod guest_steps;
pub mod cow_disk;
pub mod chd_disk;
pub mod block_node;
pub mod http_disk;
pub mod scsi;
pub mod scsi_monitor;
pub mod irq;
pub mod host_audio;
pub mod pci;
pub mod xtalk;
pub mod ui;
pub mod cpu;
pub mod dev;
pub mod gfifo;
#[cfg(feature = "wgpu")]
pub mod wgpu;
pub mod trace_writer;
pub mod gfx_display;
pub mod display;
pub mod hostinput;
pub mod keysym;
pub mod vnc;
pub mod compositor;
pub mod gl_compositor;
pub mod headless_gl;
pub mod debug_overlay;
pub mod disp;
pub mod status;
pub mod ports;
pub mod exp;
pub mod gdb_stub;
pub mod snapshot;
pub mod sgi_vh;
pub mod elf;
pub mod chunk_store;
pub mod validate;
pub mod registry;
pub mod thread_affinity;
pub mod perf_monitor;
pub mod ci;
pub mod hptimer;
pub mod hptimer_tests;
pub mod vga_font;
pub mod video_source;
pub mod ultra_proto;
pub mod crash_diag;
mod nv_storage;
pub mod hwwatch;
#[macro_use]
mod perfetto_macros;
pub use perfetto_macros::{PfBits, PfLevel, PfValue};
#[cfg(feature = "perfetto")]
pub mod perfetto;
#[cfg(test)]
mod display_stop_tests;
#[cfg(test)]
mod platform_profile_tests;
#[cfg(test)]
mod exit_persistence_tests;
#[cfg(test)]
mod chime_tests;
#[cfg(test)]
mod block_node_sync_bench;
#[cfg(test)]
pub(crate) mod test_board;
#[cfg(test)]
pub(crate) mod test_temp;