Re:Writing an x86 bootloader in Rust that can launch vmlinux
by uxp100 on Saturday September 19, 2020 @03:59PM
(#24529987)
Because nothing the C code is doing would be "unsafe" in rust terms. What is the advantage rust has for following an SDMMC controller init sequence?
Re:Writing an x86 bootloader in Rust that can launch vmlinux
by zaarn on Monday September 21, 2020 @10:50AM
(#24544121)
Once you define a safe interface, you only have to audit the implementation of that interface for errors that aren't guarded for in unsafe code.
The safe interface you can then use without fearing memory corruption or having to audit that code for unsafety. Any safe code is pretty much only logic errors.
Why exactly? Once you write an abstraction on top of the raw addresses for configuring the hardware (usually already provided by a library) you don't need to use unsafe at all. One of the first things you do in C is write macros for all the addresses you use, writing safe wrappers isn't that much more complex than that.