mirror of
https://github.com/taigrr/gopher-os
synced 2025-01-18 04:43:13 -08:00
This allows us to remove the allocFn argument from the vmm functions which causes the compiler's escape analysis to sometimes incorectly flag it as escaping to the heap.
18 lines
501 B
Go
18 lines
501 B
Go
package vmm
|
|
|
|
import (
|
|
"github.com/achilleasa/gopher-os/kernel"
|
|
"github.com/achilleasa/gopher-os/kernel/mem/pmm"
|
|
)
|
|
|
|
var frameAllocator FrameAllocatorFn
|
|
|
|
// FrameAllocatorFn is a function that can allocate physical frames.
|
|
type FrameAllocatorFn func() (pmm.Frame, *kernel.Error)
|
|
|
|
// SetFrameAllocator registers a frame allocator function that will be used by
|
|
// the vmm code when new physical frames need to be allocated.
|
|
func SetFrameAllocator(allocFn FrameAllocatorFn) {
|
|
frameAllocator = allocFn
|
|
}
|