nintendoswitch: Add experimental Nintendo Switch support without CRT

Bare minimal nintendo switch support using LLD
This commit is contained in:
Lucas Teske
2020-05-09 15:39:19 -03:00
committed by Ayke
parent d4e04e4e49
commit 3650c2c739
19 changed files with 401 additions and 4 deletions
@@ -0,0 +1,31 @@
// +build nintendoswitch
// +build gc.conservative gc.leaking
package runtime
import "unsafe"
const heapSize = 0x2000000 * 16 // Default by libnx
//go:extern _stack_top
var stackTopSymbol [0]byte
var (
heapStart = uintptr(0)
heapEnd = uintptr(0)
stackTop = uintptr(unsafe.Pointer(&stackTopSymbol))
)
//export setHeapSize
func setHeapSize(addr *uintptr, length uint64) uint64
func preinit() {
setHeapSize(&heapStart, heapSize)
if heapStart == 0 {
panic("failed to allocate heap")
}
heapEnd = heapStart + heapSize
}