Skip to content

Add initial support for LoongArch64 - #113

Merged
Jake-Shadle merged 3 commits into
EmbarkStudios:mainfrom
heiher:loong64
Jul 15, 2026
Merged

Jake-Shadle merged 3 commits into
EmbarkStudios:mainfrom
heiher:loong64

Conversation

@heiher

@heiher heiher commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

Add initial support for LoongArch64 Linux to crash-context, crash-handler and sadness-generator.

Related Issues

None

@xry111 xry111 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

and should we also fill the FP or SIMD context?

Comment on lines +45 to +50
"li.w $t0, 0", // mcontext_t.__flags
"st.w $t0, $a0, 440",
"li.w $t0, 0", // sctx_info.magic
"st.w $t0, $a0, 448",
"li.w $t0, 0", // sctx_info.size
"st.w $t0, $a0, 452",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
"li.w $t0, 0", // mcontext_t.__flags
"st.w $t0, $a0, 440",
"li.w $t0, 0", // sctx_info.magic
"st.w $t0, $a0, 448",
"li.w $t0, 0", // sctx_info.size
"st.w $t0, $a0, 452",
"st.w $zero, $a0, 440", // mcontext_t.__flags
"st.d $zero, $a0, 448", // sctx_info.magic and sctx_info.size

@heiher

heiher commented Mar 4, 2026

Copy link
Copy Markdown
Contributor Author

and should we also fill the FP or SIMD context?

I think it's better to do it that way. The fact that LoongArch's struct mcontext_t doesn't reserved space for extcontext also exposes a drawback here, it prevents LoongArch from using the common allocation logic. Also, since LSX and LASX are both optional, we need to probe runtime support for them. I'll improve that part as well. Thanks!

@Jake-Shadle Jake-Shadle mentioned this pull request Mar 4, 2026

@Jake-Shadle Jake-Shadle 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.

I'll merge this even though I can't test it, feel free to send more patches, I will try to merge them more quickly next time.

@Jake-Shadle
Jake-Shadle merged commit f796a83 into EmbarkStudios:main Jul 15, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants