diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2023-04-28 10:19:08 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2023-04-28 10:19:08 +0000 |
commit | 1679d1dc45aaa9282b4cffb0217adb940d00ae17 (patch) | |
tree | 45fdeface53a5d04173c52ffe3a668f9a49626c5 | |
parent | a999cd8e0cb9a88d632d2559c89e1d89020992a5 (diff) |
Fix memory constraints in the inline-assembly stub that calls into secure
mode. Without this change the compiler doesn't realize that the memory
behind the array that contains the return values might have changed and
optimizes the access away. With this change it properly access the array
to retrieve the returned values.
ok drahn@
-rw-r--r-- | sys/dev/fdt/qcscm.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/sys/dev/fdt/qcscm.c b/sys/dev/fdt/qcscm.c index 35096350fb1..4c590869515 100644 --- a/sys/dev/fdt/qcscm.c +++ b/sys/dev/fdt/qcscm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: qcscm.c,v 1.2 2023/01/21 10:34:49 kettenis Exp $ */ +/* $OpenBSD: qcscm.c,v 1.3 2023/04/28 10:19:07 patrick Exp $ */ /* * Copyright (c) 2022 Patrick Wildt <patrick@blueri.se> * @@ -189,20 +189,19 @@ void qcscm_smc_exec(uint64_t *in, uint64_t *out) { __asm( - "ldp x0, x1, [%0, %2]\n" - "ldp x2, x3, [%0, %3]\n" - "ldp x4, x5, [%0, %4]\n" - "ldp x6, x7, [%0, %5]\n" + "ldp x0, x1, [%0, #0]\n" + "ldp x2, x3, [%0, #16]\n" + "ldp x4, x5, [%0, #32]\n" + "ldp x6, x7, [%0, #48]\n" "smc #0\n" - "stp x0, x1, [%1, %2]\n" - "stp x2, x3, [%1, %3]\n" - "stp x4, x5, [%1, %4]\n" - "stp x6, x7, [%1, %5]\n" :: - "r" (in), "r" (out), - "i"(0), "i"(16), "i"(32), "i"(48), - "m" (*in), "m" (*out) : + "stp x0, x1, [%1, #0]\n" + "stp x2, x3, [%1, #16]\n" + "stp x4, x5, [%1, #32]\n" + "stp x6, x7, [%1, #48]\n" :: + "r" (in), "r" (out) : "x0", "x1", "x2", "x3", - "x4", "x5", "x6", "x7"); + "x4", "x5", "x6", "x7", + "memory"); } int |