Page MenuHomeFreeBSD

D27135.diff
No OneTemporary

D27135.diff

Index: sys/riscv/riscv/trap.c
===================================================================
--- sys/riscv/riscv/trap.c
+++ sys/riscv/riscv/trap.c
@@ -46,6 +46,7 @@
#include <sys/ptrace.h>
#include <sys/syscall.h>
#include <sys/sysent.h>
+#include <sys/sysproto.h>
#ifdef KDB
#include <sys/kdb.h>
#endif
@@ -95,32 +96,31 @@
int
cpu_fetch_syscall_args(struct thread *td)
{
- struct proc *p;
- register_t *ap, *dst_ap;
+ struct sysentvec *sv;
struct syscall_args *sa;
+ register_t *ap;
- p = td->td_proc;
sa = &td->td_sa;
+ sv = td->td_proc->p_sysent;
ap = &td->td_frame->tf_a[0];
- dst_ap = &sa->args[0];
sa->code = td->td_frame->tf_t[0];
- if (__predict_false(sa->code == SYS_syscall || sa->code == SYS___syscall)) {
- sa->code = *ap++;
- } else {
- *dst_ap++ = *ap++;
- }
-
- if (__predict_false(sa->code >= p->p_sysent->sv_size))
- sa->callp = &p->p_sysent->sv_table[0];
+ if (__predict_false(sa->code >= sv->sv_size))
+ sa->callp = &sv->sv_table[0];
else
- sa->callp = &p->p_sysent->sv_table[sa->code];
+ sa->callp = &sv->sv_table[sa->code];
KASSERT(sa->callp->sy_narg <= nitems(sa->args),
("Syscall %d takes too many arguments", sa->code));
- memcpy(dst_ap, ap, (NARGREG - 1) * sizeof(register_t));
+ if (__predict_false(sa->callp->sy_call == (sy_call_t *)nosys) &&
+ (sa->code == SYS_syscall || sa->code == SYS___syscall)) {
+ sa->code = td->td_frame->tf_a[0];
+ memcpy(sa->args, ap + 1, (NARGREG - 1) * sizeof(register_t));
+ } else {
+ memcpy(sa->args, ap, NARGREG * sizeof(register_t));
+ }
td->td_retval[0] = 0;
td->td_retval[1] = 0;

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 22, 10:26 AM (11 h, 35 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27841778
Default Alt Text
D27135.diff (1 KB)

Event Timeline