Skip to content

Commit

Permalink
arm_smcc_1_0_*: Fix to work on purecap.
Browse files Browse the repository at this point in the history
- Load a capability pointer from the stack for purecap.

- Store capability registers to the results structure.  Even though
  the current firmware only returns integer registers, storing the
  full capability is ok as the values will just be null-derived.
  However, this approach matches the current structure's layout and
  will work with any future firmware that may return capabilities.
  • Loading branch information
bsdjhb committed Jul 14, 2023
1 parent cd2c740 commit 5897443
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/dev/psci/smccc_arm64.S
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ ENTRY(arm_smccc_\insn)
#ifdef __CHERI_PURE_CAPABILITY__
restore_registers
#endif
ldr x4, [PTRN(sp)]
ldr PTR(4), [PTRN(sp)]
cbz x4, 1f
stp x0, x1, [PTR(4), #16 * 0]
stp x2, x3, [PTR(4), #16 * 1]
stp PTR(0), PTR(1), [PTR(4), #(2 * PTR_WIDTH) * 0]
stp PTR(2), PTR(3), [PTR(4), #(2 * PTR_WIDTH) * 1]
1: ret
END(arm_smccc_\insn)
.endm
Expand Down

0 comments on commit 5897443

Please sign in to comment.