summaryrefslogtreecommitdiff
path: root/lib/sbi/sbi_ecall_hsm.c
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-12-28 15:55:18 +0300
committerAnup Patel <anup@brainfault.org>2021-01-07 07:23:14 +0300
commit80bc5065bb67f9d118b83f64cbe96f2e3e1bc0c6 (patch)
tree034b077172404c2a0b991bb63158af916f9cfea7 /lib/sbi/sbi_ecall_hsm.c
parent7dcb1e1753e9c5daec0580779ea8c31778bff152 (diff)
downloadopensbi-80bc5065bb67f9d118b83f64cbe96f2e3e1bc0c6.tar.xz
lib: sbi: Replace args with trap registers in ecall handler
We had added args pointer in ecall handler to ensure that ecall handler only implements functionality and does not deal with SBI calling convention. This also helped us to keep SBI calling convention related code in one place at sbi_ecall_handler(). The Keystone Enclavce project needs access to the trap regsiters in their ecall handler so that they can context switch enclaves in custom SBI calls. To help the Keystone Enclave project, we replace the args pointer in ecall handler parameter with a const pointer to trap registers. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi/sbi_ecall_hsm.c')
-rw-r--r--lib/sbi/sbi_ecall_hsm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sbi/sbi_ecall_hsm.c b/lib/sbi/sbi_ecall_hsm.c
index 376740c..df29d51 100644
--- a/lib/sbi/sbi_ecall_hsm.c
+++ b/lib/sbi/sbi_ecall_hsm.c
@@ -11,13 +11,15 @@
#include <sbi/sbi_ecall.h>
#include <sbi/sbi_ecall_interface.h>
#include <sbi/sbi_error.h>
+#include <sbi/sbi_trap.h>
#include <sbi/sbi_version.h>
#include <sbi/sbi_hsm.h>
#include <sbi/sbi_scratch.h>
#include <sbi/riscv_asm.h>
static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid,
- unsigned long *args, unsigned long *out_val,
+ const struct sbi_trap_regs *regs,
+ unsigned long *out_val,
struct sbi_trap_info *out_trap)
{
ulong smode;
@@ -29,14 +31,14 @@ static int sbi_ecall_hsm_handler(unsigned long extid, unsigned long funcid,
smode = csr_read(CSR_MSTATUS);
smode = (smode & MSTATUS_MPP) >> MSTATUS_MPP_SHIFT;
ret = sbi_hsm_hart_start(scratch, sbi_domain_thishart_ptr(),
- args[0], args[1], smode, args[2]);
+ regs->a0, regs->a1, smode, regs->a2);
break;
case SBI_EXT_HSM_HART_STOP:
ret = sbi_hsm_hart_stop(scratch, TRUE);
break;
case SBI_EXT_HSM_HART_GET_STATUS:
hstate = sbi_hsm_hart_get_state(sbi_domain_thishart_ptr(),
- args[0]);
+ regs->a0);
ret = sbi_hsm_hart_state_to_status(hstate);
break;
default: