summaryrefslogtreecommitdiff
path: root/kernel/src/arch/hosted/mod.rs
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-08-27 12:23:38 -0500
committerNathan Ringo <nathan@remexre.com>2024-08-27 12:23:38 -0500
commit15fd8115739da57c6aa64da9a2ac6e0f0b7ba088 (patch)
tree28a9032f3b0a3089f5fc1e8cf7587d6803085071 /kernel/src/arch/hosted/mod.rs
parent251ea035fa2338db7b001af338d65875a9bc65ad (diff)
The start of the buddy allocator.
Diffstat (limited to 'kernel/src/arch/hosted/mod.rs')
-rw-r--r--kernel/src/arch/hosted/mod.rs19
1 files changed, 19 insertions, 0 deletions
diff --git a/kernel/src/arch/hosted/mod.rs b/kernel/src/arch/hosted/mod.rs
new file mode 100644
index 0000000..c1fb0ff
--- /dev/null
+++ b/kernel/src/arch/hosted/mod.rs
@@ -0,0 +1,19 @@
+//! Support for running under an operating system that provides libstd, for testing.
+
+extern crate std;
+
+use std::{thread::sleep, time::Duration};
+
+/// No-opped interrupt support.
+///
+/// TODO: Should this use Unix signals?
+pub mod interrupts {
+ pub fn disable_interrupts() {}
+}
+
+/// Sleeps forever, in one-second chunks.
+pub fn sleep_forever() -> ! {
+ loop {
+ sleep(Duration::from_secs(1));
+ }
+}