diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-06-14 08:28:19 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-06-14 08:28:19 +0300 |
| commit | 900831a55b9d1c74c5ff0de043ad5982270e2cbc (patch) | |
| tree | fe4560c2d7ac9366a3a70f3d45dd938eaaf09223 /common/uapi | |
| parent | 83e44b4f5d02cfd5aad7d03ddb075f4b94bf35b9 (diff) | |
| download | kmi-900831a55b9d1c74c5ff0de043ad5982270e2cbc.tar.gz kmi-900831a55b9d1c74c5ff0de043ad5982270e2cbc.zip | |
move rpc check to ipc_respo
Diffstat (limited to 'common/uapi')
| -rw-r--r-- | common/uapi/ipc.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/uapi/ipc.c b/common/uapi/ipc.c index 9cbdce8..74b5732 100644 --- a/common/uapi/ipc.c +++ b/common/uapi/ipc.c @@ -160,11 +160,6 @@ static struct stack_diff enter_rpc(struct tcb *t, struct sys_ret a) */ static void leave_rpc(struct tcb *t, struct sys_ret a) { - /* if we're not in an rpc, the user messed something up. */ - /** @todo choose or come up with more fitting error value. */ - if (unlikely(!is_rpc(t))) - return_args(t, SYS_RET1(ERR_MISC)); - vm_t rpc_stack = t->rpc_stack + BASE_PAGE_SIZE; struct call_ctx *ctx = (struct call_ctx *)(rpc_stack) - 1; t->regs = ctx->regs; @@ -314,6 +309,12 @@ SYSCALL_DEFINE4(ipc_resp)(struct tcb *t, sys_arg_t d0, sys_arg_t d1, sys_arg_t d2, sys_arg_t d3) { + /* if we're not in an rpc, the user messed something up. */ + /** @todo choose or come up with more fitting error value. */ + if (unlikely(!is_rpc(t))) + return_args(t, SYS_RET1(ERR_MISC)); + + /* we need the current proc before leaving the rpc */ struct tcb *r = get_cproc(t); leave_rpc(t, SYS_RET6(OK, t->tid, d0, d1, d2, d3)); detach_rpc(r, t); |
