Upgrade to Pro — share decks privately, control downloads, hide ads and more …

OS Developer として Rustを使ってみる/using-rust-for-os-d...

OS Developer として Rustを使ってみる/using-rust-for-os-developer

Rust入門者の集い (2016.11.21)でLT発表を行った際に使った資料です。

kotetu (kotetuco)

November 21, 2016
Tweet

More Decks by kotetu (kotetuco)

Other Decks in Programming

Transcript

  1. ܀ࢁ ప (@kotetu) • Github : kotetuco • SansanגࣜձࣾͰiOSΞϓϦ࡞ͬͯ·͢ •

    ໊ࢗ؅ཧΞϓϦͷձࣾ • ʮͦΕɺૣ͘ݴͬͯΑ͒ʯͷCMͰ͓ͳ͡Έ
  2. RustͰOSΛॻ͘ϝϦοτ(2/2) • OS meets ؔ਺ܕݴޠ (࢖ͬͯΈ͍ͨ) • OS meets Reactive

    Programing ɹɹɹɹ (RxRust࢖ͬͯΈ͍ͨ) • Cargo(ϏϧυɾύοέʔδϚωʔδϟ)ͷଘࡏ • C/C++ͱͷI/F
  3. ͓·͚ɿനృΓࣦഊίʔυ(ൈਮ) fn write_mem8(addr:u32, data:u8) { unsafe { asm!("mov BYTE PTR

    [$0], $1" : : "r"(addr), "r"(data) : : "intel"); } } pub extern fn init_os() { let vram_address = 0x000a0000; for offset in 0x00000000..0x00010000 { let vram: *mut u8 = 0x000a0000 as *mut u8; write_mem8(vram_address + offset, 0x0f); } }