Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
OS Developer として Rustを使ってみる/using-rust-for-os-d...
Search
kotetu (kotetuco)
November 21, 2016
Programming
0
590
OS Developer として Rustを使ってみる/using-rust-for-os-developer
Rust入門者の集い (2016.11.21)でLT発表を行った際に使った資料です。
kotetu (kotetuco)
November 21, 2016
Tweet
Share
More Decks by kotetu (kotetuco)
See All by kotetu (kotetuco)
認証体験向上のために passkeys (パスキー) に対応する 〜 メリット・対応方法について / iosdcjapan-2023-passkeys
kotetuco
3
1.6k
着信時氏名表示させたいエンジニア vs 簡単には着信時氏名表示できない電話番号 (iOS13対応版) / iosdcjapan-2020-lt-calldirectory
kotetuco
2
1.1k
UIImage and CIImage for Image Processing
kotetuco
9
6.4k
Metal for data-parallel computations
kotetuco
1
1.3k
Preparing for Swift 5 Ownership
kotetuco
0
4.8k
プログラミング言語RustとOS開発/rust-os-develop-introduction
kotetuco
0
1.6k
Sansan iOSアプリと R&Dとの共同研究について/sansan-ios-and-reearch
kotetuco
0
560
Other Decks in Programming
See All in Programming
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
940
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
340
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
SymfonyCon Vienna 2025: Twig, still relevant in 2025?
fabpot
3
1.2k
Haze - Real time background blurring
chrisbanes
1
520
テストコード書いてみませんか?
onopon
2
140
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
【re:Growth 2024】 Aurora DSQL をちゃんと話します!
maroon1st
0
780
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
260
モバイルアプリにおける自動テストの導入戦略
ostk0069
0
110
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Making Projects Easy
brettharned
116
5.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Adopting Sorbet at Scale
ufuk
73
9.1k
The Language of Interfaces
destraynor
154
24k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
RailsConf 2023
tenderlove
29
940
How GitHub (no longer) Works
holman
311
140k
Six Lessons from altMBA
skipperchong
27
3.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.9k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Transcript
OS Developer ͱͯ͠ RustΛͬͯΈΔ Rustೖऀͷू͍ (2016.11.21) @kotetu
܀ࢁ ప (@kotetu) • Github : kotetuco • SansanגࣜձࣾͰiOSΞϓϦ࡞ͬͯ·͢ •
໊ཧΞϓϦͷձࣾ • ʮͦΕɺૣ͘ݴͬͯΑ͒ʯͷCMͰ͓ͳ͡Έ
͔͜͜Β iOS OS ͷͰ͢ɻ
ࣗ࡞OS • ֶੜ࣌ʹগ͍ͬͯͨ͠ • ʮ30ͰͰ͖ΔOSࣗ࡞ೖʯ(໊ஶ) Ͱݴ͏ͱ 23͘Β͍·Ͱ
Rustͱͷग़ձ͍ • OS͕ॻ͚Δݴޠ͕͋Δͧ • SwiftͬΆ͍ॻ͖ํ͕ग़དྷΔͬΆ͍ͧɹɹɹɹ (ྺ࢙తʹRustͷํ͕ઌͰ͚͢Ͳɾɾ) • ੲॻ͍͍ͯͨOSΛRustͰॻ͖ͯ͠ΈΔʁ
ͱ͍͏Θ͚Ͱɺ࢝ΊͯΈͨ • ructiss • https://github.com/kotetuco/ructiss • OSͱͯ͠·ͩԿͰ͖͍ͯͳ͍ (ٽ • Rust΄ͱΜͲॻ͍͍ͯͳ͍
(ٽ
ը໘ΛനృΓͰ͖ͳ͍ (ٽ
։ൃڥʁ
DockerfileίϯςφԽ͠·ͨ͠ • rust-baremetal • https://github.com/kotetuco/rust- baremetal • ΤϛϡϨʔλʹ͍ͭͯผ్QEMUͳͲΛ ༻ҙ͍ͯͩ͘͠͞
RustͰOSΛॻ͘ϝϦοτ(1/2) • ҆શੑɺϝϞϦཧ • ඪ४͕Πϛϡʔλϒϧͳͷྑ͍ͳ • “unsafe”ϒϩοΫͰΞϯηʔϑίʔυΛݶఆ • ιϑτΣΞͷ҆શੑ͕ٻΊΒΕΔʹ ͑ΔͷͰʁ
RustͰOSΛॻ͘ϝϦοτ(2/2) • OS meets ؔܕݴޠ (ͬͯΈ͍ͨ) • OS meets Reactive
Programing ɹɹɹɹ (RxRustͬͯΈ͍ͨ) • Cargo(ϏϧυɾύοέʔδϚωʔδϟ)ͷଘࡏ • C/C++ͱͷI/F
RustͰOSΛॻ͘ࡍͷཹҙ • NightlyϏϧυͰ͔͠։ൃͰ͖ͳ͍ • IntelΞʔΩςΫνϟҎ֎ͷϓϥοτϑΥʔϜ ʹ͍֤ͭͯίϛϡχςΟʹґଘ
ϓϥοτϑΥʔϜαϙʔτঢ়گ (Getting StartedΑΓ) • 1ڃ(Ϗϧυग़དྷ͔ͭಈ͘͜ͱΛอূ͢Δ) • IntelΞʔΩςΫνϟ(32/64bit, Win/Mac/Linux) • ARMܥAndroid,
iOSͳͲ3ڃ (αϙʔτର ͕ͩɺެࣜͰมߋཧߦ͍ͬͯͳ͍)
·ͱΊ • ͜Ε·ͰC/C++͡Όͳ͍ͱॻ͚ͳ͔ͬͨ ʹ͍ͭͯɺ༗ྗͳผͳબࢶ͕Ͱ͖ͨ • ίϛϡχςΟΛΓ্͍͛ͯͬͯɺC/C++Έ ͍ͨʹ༷ʑͳͰΘΕͯ΄͍͠ͳ
͓·͚ɿനృΓࣦഊίʔυ(ൈਮ) 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); } }
༨ஊɿࣗ࡞OSͷํͷʹ͍ͭͯ • ʮࣗ࡞OS͘͘ձʯʹࢀՃ͍ͯ͠·͢ • ࣍ճ 11/26() ։࠵ • https://atnd.org/events/82288