News for hackers. Stuff that matters.
Re:RISC-V OS using Rust: Filesystems by jeffdavis on Tuesday May 12, 2020 @01:27PM (#23156763)
Is the asm!() macro going to stabilize? It seems important to ever make a real OS, right?
Re:RISC-V OS using Rust: Filesystems by steveklabnik on Tuesday May 12, 2020 @01:32PM (#23156845)
It's closer than it's ever been! The rough plan:

* move asm! to llvm_asm. https://github.com/rust-lang/rust/pull/68404

* implement the actual asm! we want to stabilize: https://github.com/rust-lang/rfcs/pull/2873

* stabilize it

Re:RISC-V OS using Rust: Filesystems by pavehawk2007 on Tuesday May 12, 2020 @01:32PM (#23156852)
I stand corrected! Thanks for the info!
Re:RISC-V OS using Rust: Filesystems by steveklabnik on Tuesday May 12, 2020 @01:35PM (#23156880)
It's all good. I think that was the prevailing sentiment for years, but Amanieu put in the work, and things are looking bright. It hasn't been accepted yet, of course, so anything could happen. But stuff is moving in that direction, it seems.
Re:RISC-V OS using Rust: Filesystems by jeffdavis on Tuesday May 12, 2020 @03:30PM (#23158588)
Cool!

Curious why not WASM also? I have no use case for that, just asking.

Re:RISC-V OS using Rust: Filesystems by steveklabnik on Tuesday May 12, 2020 @03:38PM (#23158694)
Sorry, I'm not entirely sure what you're asking?
Re:RISC-V OS using Rust: Filesystems by steveklabnik on Tuesday May 12, 2020 @06:22PM (#23160768)
Relying to myself rather than replying to three people: this would be a good question on the RFC, but I would imagine that this would be possible, just not super useful. Usually inline asm is useful for doing stuff you cannot do in the higher level language, but wasm doesn’t have anything like that currently. I would imagine that it would be a fairly straightforward extension though.
Re:RISC-V OS using Rust: Filesystems by skavi on Tuesday May 12, 2020 @06:08PM (#23160603)
They are probably asking why WASM (probably in .wat format) is not an option alongside x86/x86-64, ARM, AArch64, and RISC-V.
Re:RISC-V OS using Rust: Filesystems by monadic2 on Tuesday May 12, 2020 @05:37PM (#23160215)
Perhaps why there is no wasm equivalent directive? Just a guess.
Re:RISC-V OS using Rust: Filesystems by pavehawk2007 on Tuesday May 12, 2020 @01:29PM (#23156801)
Hello, all signs point to no. I've seen many threads about stabilizing asm, but most seem to say no this won't happen. In fact, the Rust compiler now throws a warning that asm!() is deprecated in favor of llvm_asm!().

This is the only reason I am still using nightly builds...because I'm forced to use the asm language feature, which is unstable, and because it's unstable, it cannot be used on the stable channel.

Edit: to respond to the second half, for out-of-the-box Rust builds, yes, I need global_asm! and asm!. However, asm! is for inline assembly only. Originally, I used GNU's assembler to assemble and then linked using GNU's ld. However, I have since switched to trying to make Rust do everything through its build manager, cargo.

Re:RISC-V OS using Rust: Filesystems by jcranmer on Tuesday May 12, 2020 @01:35PM (#23156896)
There is a proposal for a new asm! macro: https://github.com/Amanieu/rfcs/blob/inline-asm/text/0000-in... (note that the last updated date was 2 days ago, as of the time of this comment).

It looks like what you're referring to is the interim plan to rename asm! to llvm_asm! (which will never be stabilized), since it's a very thin wrapper over the current LLVM inline asm support, and then replace asm! with a better implementation.

There is a working group specifically for inline asm, so it will happen eventually... but it's not going to be a quick process--think about how long async/await takes, and inline asm is actually rather close to that in terms of all the issues that come out of it.

Re:RISC-V OS using Rust: Filesystems by pavehawk2007 on Tuesday May 12, 2020 @01:44PM (#23157040)
Wow, that looks like a lot of work went into this RFC. I'm glad it's being taken seriously, and I anxiously await the outcome--whatever that might be.

Thank you!

Re:RISC-V OS using Rust: Filesystems by pjmlp on Tuesday May 12, 2020 @01:59PM (#23157314)
Not really, one can always make use of an external assembler.