From ec6194f35c09077faa0251ce6d3c489d7a8a2bb2 Mon Sep 17 00:00:00 2001 From: Andrea Barisani Date: Wed, 8 May 2024 09:24:20 +0200 Subject: [PATCH] export text region range --- src/runtime/os_tamago_arm.go | 6 ++++++ src/runtime/os_tamago_riscv64.go | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/runtime/os_tamago_arm.go b/src/runtime/os_tamago_arm.go index e238a437bb842..e9956549062d4 100644 --- a/src/runtime/os_tamago_arm.go +++ b/src/runtime/os_tamago_arm.go @@ -62,6 +62,12 @@ func MemRegion() (start uint32, end uint32) { return ramStart, ramStart + ramSize } +// TextRegion returns the start and end addresses of the physical RAM +// containing the Go runtime executable instructions. +func TextRegion() (start uint32, end uint32) { + return uint32(firstmoduledata.text), uint32(firstmoduledata.etext) +} + // stubs for unused/unimplemented functionality type mOS struct{} type sigset struct{} diff --git a/src/runtime/os_tamago_riscv64.go b/src/runtime/os_tamago_riscv64.go index 96ac52154e51d..c7860d97737f5 100644 --- a/src/runtime/os_tamago_riscv64.go +++ b/src/runtime/os_tamago_riscv64.go @@ -53,6 +53,12 @@ func MemRegion() (start uint64, end uint64) { return ramStart, ramStart + ramSize } +// TextRegion returns the start and end addresses of the physical RAM +// containing the Go runtime executable instructions. +func TextRegion() (start uint64, end uint64) { + return uint64(firstmoduledata.text), uint64(firstmoduledata.etext) +} + // stubs for unused/unimplemented functionality type mOS struct{} type sigset struct{}