~kameliya/syso

ref: bffd41fe2792776713f93bd38d461d8c4a882417 syso/src/lib.rs -rw-r--r-- 833 bytes
bffd41fe — Yuki Izumi ugly idt 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
39
40
41
42
#![feature(alloc)]
#![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;
extern crate x86;

use core::fmt::Write;

pub mod support;

mod console;
mod debug;
mod mem;
mod desc;

#[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);
    desc::init();

//     unsafe { asm!("mov dx, 0; div dx" ::: "ax", "dx" : "volatile", "intel") }

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

    unsafe { asm!("hlt") }
}