Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port callgate generation code to ARM #333

Merged
merged 30 commits into from
Oct 14, 2024
Merged

Port callgate generation code to ARM #333

merged 30 commits into from
Oct 14, 2024

Conversation

ayrtonm
Copy link
Contributor

@ayrtonm ayrtonm commented Mar 26, 2024

I also added some basic prologue/epilogue stuff in the rewriter to get calls to scrub_registers working.

@ayrtonm ayrtonm force-pushed the am/scrub_registers branch from 15acb9c to d983cde Compare March 26, 2024 17:30
@ayrtonm ayrtonm changed the base branch from sim/arm_rewriter to main March 26, 2024 18:35
@ayrtonm ayrtonm force-pushed the am/scrub_registers branch 2 times, most recently from 2e9aaa1 to 914ca4b Compare March 26, 2024 20:45
@ayrtonm
Copy link
Contributor Author

ayrtonm commented Mar 26, 2024

TODO: missing ret on scrub registers

@ayrtonm
Copy link
Contributor Author

ayrtonm commented Mar 26, 2024

Also x16 and x17 probably shouldn't be zeroed

@ayrtonm ayrtonm force-pushed the am/scrub_registers branch 2 times, most recently from a2d1277 to 49c38f0 Compare March 27, 2024 16:19
@ayrtonm ayrtonm mentioned this pull request Mar 28, 2024
28 tasks
@ayrtonm ayrtonm force-pushed the am/scrub_registers branch from 49c38f0 to 87f14f7 Compare March 28, 2024 17:53
@ayrtonm ayrtonm force-pushed the am/scrub_registers branch 3 times, most recently from 05c6280 to 00e8246 Compare April 4, 2024 19:34
@ayrtonm ayrtonm changed the title Add basic register scrubbing for ARM Port callgate generation code to ARM Apr 4, 2024
@ayrtonm
Copy link
Contributor Author

ayrtonm commented Apr 5, 2024

This now has stack switching so the main thing missing from the callgates is copying arguments and return values between stacks

@ayrtonm ayrtonm force-pushed the am/scrub_registers branch from e8384e6 to e7402cc Compare April 30, 2024 02:48
@ayrtonm ayrtonm changed the base branch from main to am/arm_main April 30, 2024 02:49
Base automatically changed from am/arm_main to main April 30, 2024 03:25
@ayrtonm ayrtonm force-pushed the am/scrub_registers branch from e7402cc to 73be867 Compare April 30, 2024 03:26
@sim-immunant sim-immunant force-pushed the am/scrub_registers branch from 229d760 to ea7c19b Compare May 3, 2024 03:33
ayrtonm added a commit that referenced this pull request May 28, 2024
This is only for testing the threads test and should be replaced by the
implementation in PR #333.
@rinon rinon force-pushed the am/scrub_registers branch 2 times, most recently from 55e584e to 19e64bd Compare September 27, 2024 16:41
@rinon rinon force-pushed the am/scrub_registers branch from 22c3ad1 to 8ad5097 Compare October 2, 2024 18:05
@rinon
Copy link
Collaborator

rinon commented Oct 2, 2024

This is ready for review, it should handle all of the ARM ABI now (not including scalable vectors).

ayrtonm and others added 26 commits October 11, 2024 14:09
Structs containing only an array are classed as arrays on ARM, in
contrast to x86 where they are structs. We have to handle this case
separately.
Stack relative access does not get MTE enforcement, so we can write into the destination stack before switching to the destination compartment.
Clang and its target specific ABI functions already do most of the work for us. We should rely on that instead of trying to re-create the mapping from argument types to direct or indirect argument passing.
We need more information in GenCallAsm to correctly handle indirect memory args, so we should just use the same type across DetermineAbi and GenCallAsm. This change combines the two and allows us to allocate registers directly into the abi signature. We should probably move this out of GenCallAsm but that can be done later.
X86 includes "indirect" args in the stack argument region, while ARM passes them indirectly by reference. This change simplifies how we compute the size of the stack args region to copy and does not include indirect args for ARM.
Memory returns on AArch64 are classified as indirect, but we don't need to preserve the address in a register after the callee.
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