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
580
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.5k
着信時氏名表示させたいエンジニア vs 簡単には着信時氏名表示できない電話番号 (iOS13対応版) / iosdcjapan-2020-lt-calldirectory
kotetuco
2
1.1k
UIImage and CIImage for Image Processing
kotetuco
9
6.3k
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
550
Other Decks in Programming
See All in Programming
RubyLSPのマルチバイト文字対応
notfounds
0
120
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
Amazon Qを使ってIaCを触ろう!
maruto
0
420
Jakarta EE meets AI
ivargrimstad
0
250
距離関数を極める! / SESSIONS 2024
gam0022
0
290
ActiveSupport::Notifications supporting instrumentation of Rails apps with OpenTelemetry
ymtdzzz
1
250
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
900
Flutterを言い訳にしない!アプリの使い心地改善テクニック5選🔥
kno3a87
1
210
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
OSSで起業してもうすぐ10年 / Open Source Conference 2024 Shimane
furukawayasuto
0
110
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Figma Dev Modeで変わる!Flutterの開発体験
watanave
0
150
Featured
See All Featured
Adopting Sorbet at Scale
ufuk
73
9.1k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Writing Fast Ruby
sferik
627
61k
Building an army of robots
kneath
302
43k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
The World Runs on Bad Software
bkeepers
PRO
65
11k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Docker and Python
trallard
40
3.1k
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