mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-03 02:27:48 +00:00
UEFI target groundwork: runtime: split baremetal memory setup (#5360)
* runtime: split baremetal memory setup * add missing unsafe import
This commit is contained in:
@@ -7,36 +7,6 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
//go:extern _heap_start
|
||||
var heapStartSymbol [0]byte
|
||||
|
||||
//go:extern _heap_end
|
||||
var heapEndSymbol [0]byte
|
||||
|
||||
//go:extern _globals_start
|
||||
var globalsStartSymbol [0]byte
|
||||
|
||||
//go:extern _globals_end
|
||||
var globalsEndSymbol [0]byte
|
||||
|
||||
//go:extern _stack_top
|
||||
var stackTopSymbol [0]byte
|
||||
|
||||
var (
|
||||
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
|
||||
heapEnd = uintptr(unsafe.Pointer(&heapEndSymbol))
|
||||
globalsStart = uintptr(unsafe.Pointer(&globalsStartSymbol))
|
||||
globalsEnd = uintptr(unsafe.Pointer(&globalsEndSymbol))
|
||||
stackTop = uintptr(unsafe.Pointer(&stackTopSymbol))
|
||||
)
|
||||
|
||||
// growHeap tries to grow the heap size. It returns true if it succeeds, false
|
||||
// otherwise.
|
||||
func growHeap() bool {
|
||||
// On baremetal, there is no way the heap can be grown.
|
||||
return false
|
||||
}
|
||||
|
||||
//export malloc
|
||||
func libc_malloc(size uintptr) unsafe.Pointer {
|
||||
// Note: this zeroes the returned buffer which is not necessary.
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
//go:build baremetal
|
||||
|
||||
package runtime
|
||||
|
||||
import "unsafe"
|
||||
|
||||
//go:extern _heap_start
|
||||
var heapStartSymbol [0]byte
|
||||
|
||||
//go:extern _heap_end
|
||||
var heapEndSymbol [0]byte
|
||||
|
||||
//go:extern _globals_start
|
||||
var globalsStartSymbol [0]byte
|
||||
|
||||
//go:extern _globals_end
|
||||
var globalsEndSymbol [0]byte
|
||||
|
||||
//go:extern _stack_top
|
||||
var stackTopSymbol [0]byte
|
||||
|
||||
var (
|
||||
heapStart = uintptr(unsafe.Pointer(&heapStartSymbol))
|
||||
heapEnd = uintptr(unsafe.Pointer(&heapEndSymbol))
|
||||
globalsStart = uintptr(unsafe.Pointer(&globalsStartSymbol))
|
||||
globalsEnd = uintptr(unsafe.Pointer(&globalsEndSymbol))
|
||||
stackTop = uintptr(unsafe.Pointer(&stackTopSymbol))
|
||||
)
|
||||
|
||||
// growHeap tries to grow the heap size. It returns true if it succeeds, false
|
||||
// otherwise.
|
||||
func growHeap() bool {
|
||||
// On baremetal, there is no way the heap can be grown.
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user