News for hackers. Stuff that matters.
Re:Go 1.7 toolchain improvements by JoeAltmaier on Saturday April 02, 2016 @10:16AM (#11411585)
An OS often has to generate nearly every opcode on the target machine (many are there just for this purpose). Can Go generate arbitrary ASM instructions?

An OS has to deal with often strange calling conventions (interrupt routines, OS entry point traps, multiple language support). Can Go express the calling stack in any way?

Drivers are often interested in controlling timing and latency down to the instruction. Can generated Go code be examined by the developer for instruction counts?

A good kernel language is pretty low-level. Used to write them all in assembler.

Re:Go 1.7 toolchain improvements by crawshaw on Saturday April 02, 2016 @10:24AM (#11411615)
Go has an assembler: 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.