<commit_before>#[crate_id="kern64"];
#[crate_type="staticlib"];
#[no_std];
#[feature(globs)];

extern mod std;
extern mod extra;
extern mod arch;

use std::cast;
use std::int;
use std::option::{Some, None};
use std::iter::Iterator;
use std::vec::ImmutableVector;
use extra::term;

static SPLASH0: &'static str = "    ____                  ____  _____\n";
static SPLASH1: &'static str = "   / __ \\__  ______ ___  / __ \\/ ___/\n";
static SPLASH2: &'static str = "  / /_/ / / / / __ `__ \\/ / / /\\__ \\\n";
static SPLASH3: &'static str = " / _, _/ /_/ / / / / / / /_/ /___/ /\n";
static SPLASH4: &'static str = "/_/ |_|\\__,_/_/ /_/ /_/\\____//____/\n";

static FORTUNE: &'static str = "\n2014 = 1024 + 512 + 256 + 128 + 64 + 16 + 8 + 4 + 2!\n";

#[no_mangle]
pub extern "C" fn init() {
    use arch::drivers::vga;

    init_bss();

    vga::init();
    vga::puts(SPLASH0, term::color::WHITE);
    vga::puts(SPLASH1, term::color::WHITE);
    vga::puts(SPLASH2, term::color::WHITE);
    vga::puts(SPLASH3, term::color::WHITE);
    vga::puts(SPLASH4, term::color::WHITE);
    vga::puts(FORTUNE, term::color::BRIGHT_GREEN);
    int::to_str_bytes(2014, 16, |buf| for c in buf.iter() { vga::putc(*c as char, term::color::WHITE); });

    loop {}
}

//
// Use linker provided symbols to zero the bss section, so the kernel
// is properly loaded.
//
fn init_bss() {
    use arch::cpu;
    extern {
        static edata: u64;
        static end: u64;
    }

    unsafe {
        // The linker provided symbols are actually pointers.
        // What matters is where they point to, not what.
        let edata_ptr = cast::transmute::<*u64, uint>(&edata);
        let end_ptr = cast::transmute::<*u64, uint>(&end);
        cpu::memset(edata_ptr, 0, end_ptr - edata_ptr);<commit_msg>Used str::from_utf8<commit_after>#[crate_id="kern64"];
#[crate_type="staticlib"];
#[no_std];
#[feature(globs)];

extern mod std;
extern mod extra;
extern mod arch;

use std::cast;
use std::int;
use std::str;
use extra::term;

static SPLASH0: &'static str = "    ____                  ____  _____\n";
static SPLASH1: &'static str = "   / __ \\__  ______ ___  / __ \\/ ___/\n";
static SPLASH2: &'static str = "  / /_/ / / / / __ `__ \\/ / / /\\__ \\\n";
static SPLASH3: &'static str = " / _, _/ /_/ / / / / / / /_/ /___/ /\n";
static SPLASH4: &'static str = "/_/ |_|\\__,_/_/ /_/ /_/\\____//____/\n";

static FORTUNE: &'static str = "\n2014 = 1024 + 512 + 256 + 128 + 64 + 16 + 8 + 4 + 2!\n";

#[no_mangle]
pub extern "C" fn init() {
    use arch::drivers::vga;

    init_bss();

    vga::init();
    vga::puts(SPLASH0, term::color::WHITE);
    vga::puts(SPLASH1, term::color::WHITE);
    vga::puts(SPLASH2, term::color::WHITE);
    vga::puts(SPLASH3, term::color::WHITE);
    vga::puts(SPLASH4, term::color::WHITE);
    vga::puts(FORTUNE, term::color::BRIGHT_GREEN);
    int::to_str_bytes(2014, 16, |buf| vga::puts(str::from_utf8(buf), term::color::WHITE));

    loop {}
}

//
// Use linker provided symbols to zero the bss section, so the kernel
// is properly loaded.
//
fn init_bss() {
    use arch::cpu;
    extern {
        static edata: u64;
        static end: u64;
    }

    unsafe {
        // The linker provided symbols are actually pointers.
        // What matters is where they point to, not what.
        let edata_ptr = cast::transmute::<*u64, uint>(&edata);
        let end_ptr = cast::transmute::<*u64, uint>(&end);
        cpu::memset(edata_ptr, 0, end_ptr - edata_ptr);
{'fraction_non_alphanumeric': 0.1970528748916498, 'fraction_numerical': 0.030049118751805836, 'mean_word_length': 2.829646017699115, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4761894', 'n_tokens_mistral': 1435, 'n_tokens_neox': 1355, 'n_words': 297}