OS in Golang

0316320 吳赫倫

outline

  • gopher-os
  • implementation 
  • conclusion

gopher-os

  • https://github.com/achilleasa/gopher-os
  • experimental OS in Go
  • without interrupt
  • virtual memory system in progress

rt0_32.s

  • the entrance of kernel
  • bootloader jump to kernel in protected mode
  • interrupt and paging are disable
  • flow
    • copy multiboot data
    • check processor features
    • initial page table, enable paging and longmode

rt0_32.s

rt0_32.s

rt0_32.s

rt0_32.s

rt0_32.s

rt0_32.s

rt0_32.s

rt0_32.s

rt0_64.s

  • enter kernel written in golang

rt0_64.s

kmain.go

  • core functions written in golang
  • setup multiboot data pointer
  • initial terminal
  • physical memory initialize (just print memory map)

kmain.go

hal.go

conclusion

  • symbol issue
  • asm issue
    • no c-like inline asm
  • communication between asm and go
    • sharing data structure
    • sharing 
  • switching between asm and go

conclusion

  • using gccgo
    • gcc compiler with go-frontend
    • gccgo / go are different tool chain

gopher-os

By allenwhale

gopher-os

  • 487