Go

From OSDev Wiki
Jump to navigation Jump to search

This article is a stub! This page or section is a stub. You can help the wiki by accurately contributing to it.

Go (also called Go-lang) is a language developed at Google. It was never designed to be a bare metal language, but with some tricks you can compile a kernel with it.

Operating System Development

Go has a comparable amount of runtime to C and C++, and the language needs some callbacks in order to work. Most notably Go can't convert an integer into a pointer (which is trivial in C and very important in a kernel), you'll have to write a small Assembly wrapper for that. Expect the need for creating wrappers just like that to workaround the language and make suitable for bare metal. Some of the projects below simply use C for the parts which cannot be written in Go natively (Multiboot header being one of them).

Details were discussed at GolangUK2017 talk "Bare Metal Gophers: Can you write a kernel in Go?", see slides here.

Projects

  • Bare Metal Gophers - code repository for the talk (does not compile with latest Go compiler)
  • EggOS - a fairly complete environment to run Go applications on bare metal (some parts written in C)
  • Goose - the bare minimum environment and a protected mode "Hello World" kernel in Go
  • mykernel a simplistic, long mode "Hello World" kernel in Go

See Also

External Links