Live data from Hacker News

Rewrite Linux Kernel in Rust?

dominuscarnufex.github.io

1–10 of 133 posts

Re: Rewrite Linux Kernel in Rust?

#4
Pretty cool. I decided to take a similar path in trying to improve/ensafen parts of the BEAM VM by finding small chunks I could rewrite in Rust from C.

Most of the headache was build toolchain integration stuff. I did manage to get a few simple things slotted in that appear to work transparently, which made me hopeful for future more complicated things to play with like new process mailbox implementations, etc.

Anyway, great write up and a cool project!

Re: Rewrite Linux Kernel in Rust?

#5
post #3

I wonder what makes AT&T assembly syntax "objectively crap".

You need to explicitly specify what the parameter sizes and types are. Plus, the parameters are backwards compared to Intel syntax:

  Intel: mov eax, 5
  AT&T: movl $5, %eax
In basically every C-like programming language, you assign 5 to eax with `eax=5` not `5=eax`. I can also tell that I'm working with the `long` variant of `mov` just by looking at the types involved.

Intel's syntax for memory access seems more natural. If I don't want to add `ebx` to the address, I can leave it out; I can't in AT&T; I have to have this seemingly random comma. Plus, what's with the format?

  Intel: mov eax, [ds:eax*4+16]
  AT&T: movl ds:16(,%eax,4)

Re: Rewrite Linux Kernel in Rust?

#8
post #3

I wonder what makes AT&T assembly syntax "objectively crap".

You need to explicitly specify what the parameter sizes and types are. Plus, the parameters are backwards compared to Intel syntax: Intel: mov eax, 5 AT&T: movl $5, %eax In basically every C-like programming language, you assign 5 to eax with `eax=5` not `5=eax`. I can also tell that I'm working with the `long` variant of `mov` just by looking at the types involved. Intel's syntax for memory access seems more natural…

Interestingly, in the language you actually wrote that complaint in:

> you assign 5 to eax

AT&T speaks English, basically. We move A to B. Destination goes last.

Both seem sane enough. And in fact both get really balled up when you have three and four-argument instructions.

Re: Rewrite Linux Kernel in Rust?

#9
Without making any assertions as to the benefits or problems of integrating Rust into the Linux kernel to replace components, I just want to point out it's really cool that you can and that someone has gone through the trouble of documenting how. That's just awesome.

Discussion about whether this is a good idea or not, and the problems of doing so, can now commence in earnest, and without the pesky problem of it being mostly theoretical.

Re: Rewrite Linux Kernel in Rust?

#10
This is an interesting idea, but probably won't work out because Linus (and other developers) may not want to transition away from the C language (see Linus's comments about not using C++.) I think it would be excellent to see Rust being used, but the implementation of replacing C with Rust could be very complicated, and Rust's benefits may not be directly visible when having to port/rewrite a lot of the components.
Post reply on HN