summaryrefslogtreecommitdiff
path: root/crates/kernel/src/arch/hosted.rs
blob: df62babb38169d0385697fee679e671532ce6e56 (plain)
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
//! Support for running under an operating system that provides libstd, for testing.

extern crate std;

use std::{thread::sleep, time::Duration};

/// The size of a page of memory.
///
/// Obviously, this value is unrealistic, but for now we just need the hosted arch to compile.
pub const PAGE_SIZE: usize = 64;

/// The number of bits in the size of a page of memory.
///
/// Obviously, this value is unrealistic, but for now we just need the hosted arch to compile.
pub const PAGE_SIZE_BITS: usize = 6;

/// 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));
    }
}