Pass implicit PID into syscalls

This commit is contained in:
2025-10-18 12:10:59 +02:00
parent d1d777ec75
commit a5fe64b253
15 changed files with 56 additions and 34 deletions

View File

@ -102,7 +102,7 @@ done:
return ret;
}
int32_t SYSCALL5(sys_dev_cmd, dev1, cmd1, argbuf1, len1, extra1) {
int32_t SYSCALL4(sys_dev_cmd, dev1, cmd1, argbuf1, len1) {
uint64_t *devh = (uint64_t *)dev1;
uint64_t cmd = cmd1;
int32_t ret = E_OK;
@ -127,7 +127,7 @@ int32_t SYSCALL5(sys_dev_cmd, dev1, cmd1, argbuf1, len1, extra1) {
goto done;
}
spinlock_acquire(&dev->spinlock);
ret = dev->fns[cmd](dev, (uint8_t *)argbuf1, (size_t)len1, (void *)extra1);
ret = dev->fns[cmd](dev, (uint8_t *)argbuf1, (size_t)len1, _caller_pid);
spinlock_release(&dev->spinlock);
done:

View File

@ -8,6 +8,6 @@
int32_t SYSCALL2(sys_dev_gethandle, dev1, devname1);
int32_t SYSCALL0(sys_dev_listsize);
int32_t SYSCALL2(sys_dev_stat, devstat1, idx1);
int32_t SYSCALL5(sys_dev_cmd, dev1, cmd1, argbuf1, len1, extra1);
int32_t SYSCALL4(sys_dev_cmd, dev1, cmd1, argbuf1, len1);
#endif // SYSCALL_DEV_H_

View File

@ -9,6 +9,7 @@
#define SYSCALL0(name) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
UNUSED uint64_t _1, \
UNUSED uint64_t _2, \
UNUSED uint64_t _3, \
@ -19,6 +20,7 @@
#define SYSCALL1(name, arg1) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
uint64_t arg1, \
UNUSED uint64_t _2, \
UNUSED uint64_t _3, \
@ -29,6 +31,7 @@
#define SYSCALL2(name, arg1, arg2) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
uint64_t arg1, \
uint64_t arg2, \
UNUSED uint64_t _3, \
@ -39,6 +42,7 @@
#define SYSCALL3(name, arg1, arg2, arg3) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
uint64_t arg1, \
uint64_t arg2, \
uint64_t arg3, \
@ -49,6 +53,7 @@
#define SYSCALL4(name, arg1, arg2, arg3, arg4) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
uint64_t arg1, \
uint64_t arg2, \
uint64_t arg3, \
@ -59,6 +64,7 @@
#define SYSCALL5(name, arg1, arg2, arg3, arg4, arg5) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
uint64_t arg1, \
uint64_t arg2, \
uint64_t arg3, \
@ -69,6 +75,7 @@
#define SYSCALL6(name, arg1, arg2, arg3, arg4, arg5, arg6) \
name(UNUSED IntrStackFrame *frame, \
UNUSED uint64_t _caller_pid, \
uint64_t arg1, \
uint64_t arg2, \
uint64_t arg3, \
@ -77,7 +84,13 @@
uint64_t arg6 \
)
typedef int32_t (*SyscallFn)(IntrStackFrame *, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
typedef int32_t (*SyscallFn)(IntrStackFrame *, uint64_t,
uint64_t,
uint64_t,
uint64_t,
uint64_t,
uint64_t,
uint64_t);
extern SyscallFn SYSCALL_TABLE[SYSCALLS_MAX];