Cleanup Redox repo, update Rust, remove old target
This commit is contained in:
parent
98c76d36fd
commit
7cd2eff74c
97 changed files with 24 additions and 79 deletions
3
kernel/arch/test/Cargo.toml
Normal file
3
kernel/arch/test/Cargo.toml
Normal file
|
@ -0,0 +1,3 @@
|
|||
[package]
|
||||
name = "arch_test"
|
||||
version = "0.1.0"
|
43
kernel/arch/test/src/interrupt.rs
Normal file
43
kernel/arch/test/src/interrupt.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
//! Interrupt instructions
|
||||
|
||||
static mut INTERRUPTS_ENABLED: bool = false;
|
||||
|
||||
/// Clear interrupts
|
||||
#[inline(always)]
|
||||
pub unsafe fn disable() {
|
||||
println!("CLEAR INTERRUPTS");
|
||||
INTERRUPTS_ENABLED = false;
|
||||
}
|
||||
|
||||
/// Set interrupts
|
||||
#[inline(always)]
|
||||
pub unsafe fn enable() {
|
||||
println!("SET INTERRUPTS");
|
||||
INTERRUPTS_ENABLED = true;
|
||||
}
|
||||
|
||||
/// Halt instruction
|
||||
#[inline(always)]
|
||||
pub unsafe fn halt() {
|
||||
assert!(INTERRUPTS_ENABLED);
|
||||
::std::thread::yield_now();
|
||||
}
|
||||
|
||||
/// Pause instruction
|
||||
#[inline(always)]
|
||||
pub unsafe fn pause() {
|
||||
|
||||
}
|
||||
|
||||
/// Set interrupts and nop
|
||||
#[inline(always)]
|
||||
pub unsafe fn enable_and_nop() {
|
||||
enable();
|
||||
}
|
||||
|
||||
/// Set interrupts and halt
|
||||
#[inline(always)]
|
||||
pub unsafe fn enable_and_halt() {
|
||||
enable();
|
||||
halt();
|
||||
}
|
43
kernel/arch/test/src/lib.rs
Normal file
43
kernel/arch/test/src/lib.rs
Normal file
|
@ -0,0 +1,43 @@
|
|||
//! Architecture support for testing
|
||||
|
||||
pub use std::io;
|
||||
|
||||
/// Print to console
|
||||
#[macro_export]
|
||||
macro_rules! print {
|
||||
($($arg:tt)*) => ({
|
||||
use $crate::io::Write;
|
||||
let _ = write!($crate::io::stdout(), $($arg)*);
|
||||
});
|
||||
}
|
||||
|
||||
/// Print with new line to console
|
||||
#[macro_export]
|
||||
macro_rules! println {
|
||||
($fmt:expr) => (print!(concat!($fmt, "\n")));
|
||||
($fmt:expr, $($arg:tt)*) => (print!(concat!($fmt, "\n"), $($arg)*));
|
||||
}
|
||||
|
||||
/// Create an interrupt function that can safely run rust code
|
||||
#[macro_export]
|
||||
macro_rules! interrupt {
|
||||
($name:ident, $func:block) => {
|
||||
pub unsafe extern fn $name () {
|
||||
unsafe fn inner() {
|
||||
$func
|
||||
}
|
||||
|
||||
// Call inner rust function
|
||||
inner();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// Interrupt instructions
|
||||
pub mod interrupt;
|
||||
|
||||
/// Initialization and main function
|
||||
pub mod main;
|
||||
|
||||
/// Time functions
|
||||
pub mod time;
|
11
kernel/arch/test/src/main.rs
Normal file
11
kernel/arch/test/src/main.rs
Normal file
|
@ -0,0 +1,11 @@
|
|||
/// This function is where the kernel sets up IRQ handlers
|
||||
/// It is increcibly unsafe, and should be minimal in nature
|
||||
|
||||
extern {
|
||||
fn kmain() -> !;
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern fn kstart() -> ! {
|
||||
kmain();
|
||||
}
|
7
kernel/arch/test/src/time.rs
Normal file
7
kernel/arch/test/src/time.rs
Normal file
|
@ -0,0 +1,7 @@
|
|||
pub fn monotonic() -> (u64, u64) {
|
||||
(0, 0)
|
||||
}
|
||||
|
||||
pub fn realtime() -> (u64, u64) {
|
||||
(0, 0)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue