News for hackers. Stuff that matters.
Re:Plan 9 ported to the Raspberry Pi by graue on Saturday August 10, 2013 @01:26AM (#6190163)
You can't write a kernel in Go because it has a mandatory runtime system and garbage collection. However, Mozilla's Rust language is similar in some ways, can work runtime-less, and a small demo kernel has been written in it: https://github.com/charliesome/rustboot
Re:Plan 9 ported to the Raspberry Pi by 4ad on Saturday August 10, 2013 @06:00AM (#6190568)
Of course that you can; kernels are not magic. Many kernels have been written in languages with far more heavyweight runtime systems than Go. A few examples have been provided in the comments. Here is a toy example in Go: http://gofy.cat-v.org/

You need some bits of assembly, but that's true for C, C++, Rust and whatever else as well.

Re:Plan 9 ported to the Raspberry Pi by oscargrouch on Saturday August 10, 2013 @01:00PM (#6191754)
he´s not saying that its not possible to use go for that.. its just that the compiler puts the go runtime wich is specific for the userland and that in the end of the line will create a bunch of kernel syscalls for whatever systems you are..

to make this happen, it should be possible to, at least change the runtime , or not use a runtime at all.. so the little boot part in assembly could call a go function in kernel mode

Re:Plan 9 ported to the Raspberry Pi by 4ad on Sunday August 11, 2013 @04:10AM (#6194286)
Of course you'll need a specific runtime just like for C you can't use the user space libc. There's no difference between C and Go here.

You can create your own runtime as you see fit. In fact, the Go distribution used to ship with such a bare metal runtime. Search the repository history for the tiny runtime. Reviving it again should be easier then porting Go to a new architecture, which is quite easy. Making a stub runtime (equivalent to booting a C kernel with no libc) is not more than half an hour of work.

Go can call assembly and C, and assembly and C can call Go. This is used a lot in the runtime, nothing special about it.

Re:Plan 9 ported to the Raspberry Pi by cypher543 on Saturday August 10, 2013 @03:19AM (#6190331)
You can't write a kernel completely in Go. But that's the case with every language except assembly (and, with a GCC-specific x86 extension, C). If you were to implement the core runtime in assembly, there'd be nothing to stop you from writing the higher-level functionality of a kernel in Go.
Re:Plan 9 ported to the Raspberry Pi by ballard on Saturday August 10, 2013 @07:03AM (#6190668)
This maybe true for most system languages on some platforms. My OS internals are rusty, but from hacking on minix, there was an issue for x86 bootstrapping into protected mode stuff to set important things like interrupt handlers and other addresses. Whether this is done in the language by macros, embedded asm or external asm, ultimately a binary is produced that is code and data segments for the architecture.
Re:Plan 9 ported to the Raspberry Pi by read_again on Saturday August 10, 2013 @03:08AM (#6190321)
> You can't write a kernel in Go because it has a mandatory runtime system and garbage collection.

Could you please provide a link or two on that, or give some explanation on why this is not possible?

Re:Plan 9 ported to the Raspberry Pi by foobarbazqux on Saturday August 10, 2013 @03:14AM (#6190327)
It's quite possible, here's an example:

https://en.wikipedia.org/wiki/Singularity_%28operating_syste...

They only used C and assembly for interrupt handling.

Re:Plan 9 ported to the Raspberry Pi by oscargrouch on Saturday August 10, 2013 @12:48PM (#6191699)
how about create a option in the compiler to ditch the standard runtime, or even to put another runtime in place..

suppose you create a kernel kit library/runtime.. instead the one in go.. who assume you are in userspace.. its possible..

i think if only they allowed to create a binary with no runtime in it... and with the binary encoding for the boot (dont remember what it is right now) it would just be feasible.. people could start hacking it