]> Cypherpunks repositories - gostls13.git/commit
runtime: identify virtual memory layout for riscv64
authorJoel Sing <joel@sing.id.au>
Tue, 22 Jul 2025 15:26:56 +0000 (15:26 +0000)
committerJoel Sing <joel@sing.id.au>
Tue, 26 Aug 2025 08:38:57 +0000 (01:38 -0700)
commitdae9e456ae6992b3c19a8c5039090ee9ca4d9b7d
tree663ee7faf103bd6633b59a320d729d834b6cedd9
parent25c2d4109f5061425ca2633fb12450d43839bb79
runtime: identify virtual memory layout for riscv64

Identify sv39, sv48 and sv57 based on the system stack address.
The current approach to memory allocation is less than ideal on
RISC-V hardware that is using sv39 mode. On sv39 we currently end
up doing around 85 mmap and 66 munmap, since we are trying to map
an unusable range. With this change we do 22 mmap and 0 munmap at
runtime initialisation.

This will also be necessary to support the race detector on sv39.

Updates #64345

Cq-Include-Trybots: luci.golang.try:gotip-linux-riscv64
Change-Id: I4f8ba6763b5ecfedfad5438e025d633820e8265c
Reviewed-on: https://go-review.googlesource.com/c/go/+/690495
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meng Zhuo <mengzhuo1203@gmail.com>
Reviewed-by: Jorropo <jorropo.pgm@gmail.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/runtime/malloc.go