~kameliya/syso

ref: e1e59ca17a1649d2102744770310c62b671e3ee3 syso/src/lib.rs -rw-r--r-- 726 bytes
e1e59ca1 — Yuki Izumi Add placement allocator until we get a heap 4 years ago
                                                                                
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
#![feature(alloc)]
#![feature(bit_set)]
#![feature(collections)]
#![feature(lang_items)]
#![feature(asm)]
#![feature(const_fn)]
#![no_std]

extern crate alloc;
#[macro_use]
extern crate collections;
extern crate rlibc;
extern crate cpuio;
extern crate multiboot2;
extern crate hole_list_allocator;

use core::fmt::Write;

pub mod support;

mod console;
mod debug;
mod mem;

#[no_mangle]
pub extern fn rust_entry(multiboot_addr: usize) {
    let mut console = unsafe { &mut console::CONSOLE };

    console.set_color(0x07);
    write!(console, "syso :)\n").unwrap();

    let multiboot = unsafe { multiboot2::load(multiboot_addr) };
    mem::init(&multiboot);

    write!(console, "> ").unwrap();

    unsafe { asm!("hlt") }
}