Skip to content

Instantly share code, notes, and snippets.

@mdmarek
mdmarek / riscv.md
Created March 2, 2023 19:58 — forked from cb372/riscv.md
Writing an OS in Rust to run on RISC-V

(This is a translation of the original article in Japanese by moratorium08.)

(UPDATE (22/3/2019): Added some corrections provided by the original author.)

Writing your own OS to run on a handmade CPU is a pretty ambitious project, but I've managed to get it working pretty well so I'm going to write some notes about how I did it.

@mdmarek
mdmarek / Film
Created June 9, 2017 20:42
Films to watch
There Will Be Blood
Spirited Away
Million Dollar Baby
A Touch of Sin
The Death of Mr. Lazarescu
Yi Yi
Inside Out
Boyhood
Summer Hours
The Hurt Locker
@mdmarek
mdmarek / paxos.txt
Created March 22, 2017 18:40
Paxos in 25 lines
--- Paxos Proposer ---
1 proposer(v):
2 while not decided:
2 choose n, unique and higher than any n seen so far
3 send prepare(n) to all servers including self
4 if prepare_ok(n, na, va) from majority:
5 v' = va with highest na; choose own v otherwise
6 send accept(n, v') to all
@mdmarek
mdmarek / pprof-in-gcloud
Created December 24, 2016 06:25
Profiling Go Processes in Google Cloud
gcloud compute copy-files --zone <zone> <host>:<path>/<binary> /tmp/<binary>.sym
gcloud compute ssh --zone <zone> <host> --ssh-flag="-L <port>:localhost:<port>" --ssh-flag="-N" --ssh-flag="-n"
go tool pprof -lines /tmp/<binary>.sym http://localhost:<port>/debug/pprof/heap
@mdmarek
mdmarek / Links
Last active January 22, 2018 16:10
Links (non PDF)
@mdmarek
mdmarek / OneBitClock.cfg
Created November 3, 2016 16:18
TLA+ One Bit Clock
INIT
Init
NEXT
Next
INVARIANT
TypeOK
@mdmarek
mdmarek / HourClock.cfg
Created November 3, 2016 16:17
TLA+ Hour Clock
INIT
Init
NEXT
Next
@mdmarek
mdmarek / GCD.tla
Created November 3, 2016 16:16
TLA+ GCD
---- MODULE GCD ----
EXTENDS Integers, TLC
Divides(p, n) == \E q \in -1000..1000 : n = q * p
DivisorsOf(n) == {p \in -1000..1000 : Divides(p, n)}
SetMax(S) == CHOOSE i \in S : \A j \in S : i >= j
@mdmarek
mdmarek / DieHard.cfg
Created November 3, 2016 16:14
TLA+ DieHard
INIT
Init
NEXT
Next
INVARIANT
TypeOK
@mdmarek
mdmarek / Chan.cfg
Created November 3, 2016 16:12
TLA+ Channel
INIT
Init
NEXT
Next
INVARIANT
TypeOK
CONSTANTS