aboutsummaryrefslogtreecommitdiff
path: root/src/kernel.rs
blob: c25e1480c291eb9015241d3bb79e1d5808c2e568 (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
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
//! # Kernel Code
//!
//! ## Initializes the peripherals
//!  - UART
//!  - Allocators

#![doc(html_logo_url = "https://raw.githubusercontent.com/rust-embedded/wg/master/assets/logo/ewg-logo-blue-white-on-transparent.png")]

#![allow(non_snake_case)]
#![allow(clippy::upper_case_acronyms,dead_code)]
#![feature(format_args_nl)]
#![feature(panic_info_message)]
#![feature(trait_alias)]
#![feature(exclusive_range_pattern)]
#![feature(default_alloc_error_handler)]
#![no_main]
#![no_std]

extern crate alloc;
use alloc::boxed::Box;

mod mem;
mod console;
mod cpu;
mod panic_wait;
mod print;
mod sync;
mod uart;
use crate::console::console;
use crate::mem::alloc::*;

/// # Initialization Code
///
/// Initializes
///  - Allocators
///  - UART
///
/// After initialization, jump to
/// the regular main.
unsafe fn kernel_init() -> ! {
	console().init().unwrap();
	ALLOCATOR.init();
	kernel_main()
}

/// # Post-initialization
///
/// TODO: Figure out what to do here
fn kernel_main() -> ! {
	println!("I should be able to print {} here!", 5);
	{
		let a: Box<u8> = Box::new(u8::MAX);
		let b: Box<u8> = Box::new(5);
		println!("{:?} {:?}", a, b);
	}
	loop { }
}