Skip to content

Probe {riscv,loongarch,arm}64 virtual memory address - #133380

Open
am11 wants to merge 8 commits into
dotnet:mainfrom
am11:patch-60
Open

Probe {riscv,loongarch,arm}64 virtual memory address#133380
am11 wants to merge 8 commits into
dotnet:mainfrom
am11:patch-60

Conversation

@am11

@am11 am11 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Modern riscv64 systems are using sv48 and GC remains limited to sv39. PR probes it at run-time.

@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 7, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @anicka-net, @dotnet/gc
See info in area-owners.md if you want to be subscribed.

@am11 am11 added the arch-riscv Related to the RISC-V architecture label Sep 7, 2026
@am11

am11 commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

cc @t-mustafin, @dotnet/samsung

Comment thread src/coreclr/gc/unix/gcenv.unix.cpp Outdated
@janvorli

janvorli commented Sep 8, 2026

Copy link
Copy Markdown
Member

It seems we need similar treatment for arm64 too (e.g. for Android). See #85556 (comment) that mentions that Android ships with 39-bit VA size.
Would you mind extending this PR to handle that?

@am11 am11 changed the title Probe riscv64 virtual memory address Probe riscv64 and arm64 virtual memory address Sep 8, 2026
@am11 am11 added the arch-arm64 label Sep 8, 2026
Comment thread src/coreclr/gc/unix/gcenv.unix.cpp Outdated
@am11 am11 changed the title Probe riscv64 and arm64 virtual memory address Probe {riscv,loongarch,arm}64 virtual memory address Sep 8, 2026
@am11

am11 commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

cc @LuckyXu-HF, @shushanhf, included LA64.

@janvorli janvorli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

Comment thread src/coreclr/gc/unix/gcenv.unix.cpp Outdated
static const int candidates[] = { 56, 47 };
const int minVaBits = 38;
#else // TARGET_LOONGARCH64
static const int candidates[] = { 47, 39 };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#memory-address-space

In LA64, the range of memory address space accessible by application is: 0-2VALEN-1-1. Generally VALEN is in the range of [40,48]. Application can determine the specific value of VALEN by executing the CPUCFG instruction to read the VALEN field of the 0x1 configuration word.

@shushanhf shushanhf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LA64 LGTM, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arch-arm64 arch-loongarch64 arch-riscv Related to the RISC-V architecture area-GC-coreclr community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants