Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
RustでOS作りたい話
Search
segfo
August 05, 2018
Technology
1.1k
4
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RustでOS作りたい話
第13回:自作OSもくもく会LT
segfo
August 05, 2018
More Decks by segfo
See All by segfo
Claudeと作った7つの作品
segfo
0
34
OpenMythosとは何者なのか
segfo
0
130
AI/LLM入門
segfo
0
150
ELFバイナリ静的解析入門
segfo
0
890
Other Decks in Technology
See All in Technology
Classmethod Company Deck
satoshi7
1
830
AWSDirectConnectの構築の進め方を整理してみた
masa_my
1
160
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
1.1k
AI時代のGraphQL
joere
3
370
freeeにおける AI を用いた ブラウザ動作確認の自動化の取り組み
freee
PRO
0
170
Kiro Crewで「みのるん式」仕事術やってみた
minorun365
PRO
3
1.1k
Browser Spec: Testing Hotwire with Ruby
takahashim
1
170
AI時代、つくる力を自分たちの手に。 ──電通×KAG、アジャイルとAI駆動開発で挑む開発の変革
yuukiyo
2
190
Turning Repos into the Product Second Brain with an LLM Wiki
linedevth
0
150
プロダクトが成長すると、 プロダクトマネージャーの仕事はどう変わるのか - 「まず作る」から「小さく学び、確かめながら進む」へ
sansantech
PRO
0
130
ガチで放置できるClaude Code実行環境の作り方.pdf
lamaglama39
5
8.8k
価値について
gree_tech
PRO
0
160
Featured
See All Featured
Color Theory Basics | Prateek | Gurzu
gurzu
1
490
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
640
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
580
Design in an AI World
tapps
1
360
Rebuilding a faster, lazier Slack
samanthasiow
85
9.7k
Balancing Empowerment & Direction
lara
6
1.3k
エンジニアに許された特別な時間の終わり
watany
109
250k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
2
960
Ethics towards AI in product and experience design
skipperchong
2
440
Transcript
RustでOS作りたい そんな話
はじめに
自己紹介 Twitter: @segfo Qiitaとかでいろいろ書いてます。 https://qiita.com/segfo 30日で作る本(30日では書けないけど)でこの世界に入門しました。
C言語難しくない???? 作りたいものを作れず、そこらじゅうエラー・例外ハンドラだらけ ちょっとコード書くとバッファオーバーフロー ちゃんと書かないとすぐ汚くなる。(だんだん混乱してくる) プログラミングが下手なので厳しさだけを感じる
つらい C言語以外でデバイス叩きたい
「RustでOSを作る」という選択肢 今回は「Rust」という言語を紹介します。 • 速度はC++並み • コンパイル時にバッファオーバーフローを一部検出できる • プログラミングが下手でも、ほぼ正常系で記述できる
Rustってなに? Mozillaが開発しているプログラミング言語 マルチパラダイムで、割と今風(※OOPとか)に書ける
そこでRust 簡潔に言うとC++の上位互換っぽい(C++よくわからない) クラス・継承の概念が使える GCを使わないけど、リソース管理ができる(Drop Traitという仕組みを使う) BOFするコードが有ったらコンパイルできない もしコンパイルできたとしても、実行時エラーで確実に止まってくれる
デモ x86_64 UEFI (LONGモード(64bit)で動作) デモで使用するプログラム https://github.com/segfo/rust-uefi-sample
コード コンパイルエラー
コード 実行時エラー(QEMU上)
panicの実装 panicしたらとりあえず、無限ルー プしとく実装。 RebootでもOK
UEFIブート&RustでOSを作る意味 • やりたいことに集中できる ◦ BIOSブート:Real mode→Protected mode→Long mode ▪ しかもコード書ける領域が
512バイト縛り(1セクタ分)しかない ◦ UEFIブート:Long mode ▪ コード書ける領域が実質無限 ◦ Rustは例外処理やパターンマッチが書きやすい ▪ 例外処理ばっかりなコードとはお別れできる • C/C++では「未定義動作」が一番OS作る上では一番厄介 ◦ Rustでは、未定義動作が徹底的に排除されている ◦ 典型的な「配列の溢れ」なんかは すべて定義された動作 (基本はpanic)に移行する ◦ 安全かつ安心して書きたいものを書ける 未定義を踏まないのでデバッグもしやすい
おわり