3 ms·
Go has an assembler: https://golang.org/doc/asm https://golang.org/doc/asm I have used it in sticky situations, like the trampoline for a signal handler, and w
by crawshaw 11y ago
Go has an assembler: https://golang.org/doc/asm https://golang.org/doc/asm
I have used it in sticky situations, like the trampoline for a signal handler, and writing functions that have to conform to a C ABI because they are called by the OS. (In particular, a loader .init function.)
To minimize how much assembly a theoretical OS author has to write, there are a couple of extra tricks in the runtime package they could borrow, like //go:noescape annotations. You have to be careful when writing code like that, but it does the job.
Before the Go runtime was rewritten in Go, I worried that for a task like writing a kernel there would be a lot of assembly. But I have been pleasantly surprised by how little is needed in the runtime, and that gives me some hope for a project like that.
Of course this is speculation on my part, I could be wrong.