Discussion about Rust OS Development and bare-metal in general
People
Repo info
Activity
rybot666
@rybot666
why does that exist
Berkus Decker
@berkus
to pick same version info from both C and asm :)
rybot666
@rybot666
but why
Berkus Decker
@berkus
good question, that was in the beginning of 2000-s
I don't remember now )
I think I was really fond of version information at that point
Andrew Cooper
@andyhhp
don't laugh - we really use that trick in Xen to share assembler macros between C and ASM
rybot666
@rybot666
it sounds unnecessary
Berkus Decker
@berkus
@andyhhp yep, many years later I've seen that again in Xen and chuckled
@rybot666 it's probably absolutely not needed; i mean - version is updated via a script anyway, it can update two files with the same lack of effort
Andrew Cooper
@andyhhp
what's unnecessary is (or rather, ought to be) the 3 years it has taken to get superscalar speculation under control
its the reason why we need to do totally gross things like redefining the ret instruction to be ret; int3
or the utter magic with retpoline thunks
rybot666
@rybot666
#define true rand() > 0.5
Andrew Cooper
@andyhhp
yes - that magic across the Linux ecosystem is all my fault - but OTOH, it is the only way we can sanely support booting one binary on a system which may or may not be vulnerable, and be safe
rybot666
@rybot666
guess so
or you could just do what I do and ignore the problem until it goes away :)
Andrew Cooper
@andyhhp
I'm on the receiving end of security@xen, and there are literally millions of public cloud servers running Xen. Ignoring it wasn't exactly an option
rybot666
@rybot666
ah
Andrew Cooper
@andyhhp
even if it was certainly what I felt like doing ;)
rybot666
@rybot666
ok plan B - tell someone else to deal with it
and then ignore it in the hopes that they'll fix it
Andrew Cooper
@andyhhp
:) if only
In some copious free time (lol), I'm looking to pick up some work a colleague started, to properly support some Xen based microkernels as real cargo targets
(also as a decent project to learn Rust)
but when it comes to actually doing kernel level things (virtualised microkernels, or native), it is my opinion that current kernels have proved that C isn't low enough level to avoid needing non-trivial amounts of assembly
Andrew Cooper
@andyhhp
and that in a primarily-Rust world, the same would be true. There can and should be C and ASM where appropriate, including the usual rule of keeping it to a minimum
Berkus Decker
@berkus
I like when i write like 20 lines of rust it actually compiles into 1-2 arm assembly instructions.
Still have to embed a bit of asm here and there but with Rust it's extremely more handy to do than in C.
rybot666
@rybot666
yeah
also rusts assembly is clean
Berkus Decker
@berkus
new asm!() syntax is great
rybot666
@rybot666
yeah
I tend to end up passing a lot of unneeded options though
Andrew Cooper
@andyhhp
I attempted to get them to fix immediate syntax :( they said no
Berkus Decker
@berkus
what's wrong with it?
Andrew Cooper
@andyhhp
nonexistent
rybot666
@rybot666
ah yes
Berkus Decker
@berkus
i think it was possible to pass consts?
rybot666
@rybot666
"fix"
you can pass consts though, function addresses and stuff
Andrew Cooper
@andyhhp
still gets spilled into a register rather than encoded as an immediate operand when possible
Berkus Decker
@berkus
i think this could be improved on the lowering side?
Andrew Cooper
@andyhhp
hopefully it is something which can be addressed in future
the problem is that what you need to do is say "this thing is either a register, or can be an immediate if it falls within $RANGE"