Date: Tue, 22 Apr 2003 14:42:56 -0700 (PDT) From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 29459 for review Message-ID: <200304222142.h3MLguGf016958@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=29459 Change 29459 by peter@peter_overcee on 2003/04/22 14:42:45 implement syscalls. XXX there is much evilness here, but it is sufficient for now. struct trapframe should be reordered so that the first 6 args can be taken directly from there, or or the args pointer set to point to it. Only copy the args when we need > 6 syscall args and need to suck in the remaining 2 args from the stack. Affected files ... .. //depot/projects/hammer/sys/x86_64/x86_64/trap.c#26 edit Differences ... ==== //depot/projects/hammer/sys/x86_64/x86_64/trap.c#26 (text+ko) ==== @@ -652,7 +652,7 @@ u_int sticks; int error; int narg; - int args[8]; + register_t args[8]; u_int code; /* @@ -676,7 +676,7 @@ cred_update_thread(td); if (p->p_flag & P_THREADED) thread_user_enter(p, td); - params = (caddr_t)frame.tf_rsp + sizeof(int); + params = (caddr_t)frame.tf_rsp + sizeof(long); code = frame.tf_rax; orig_tf_rflags = frame.tf_rflags; @@ -684,7 +684,7 @@ /* * The prep code is MP aware. */ - (*p->p_sysent->sv_prepsyscall)(&frame, args, &code, ¶ms); + (*p->p_sysent->sv_prepsyscall)(&frame, (int *)args, &code, ¶ms); } else { /* * Need to check if this is a 32 bit or 64 bit syscall. @@ -719,10 +719,25 @@ /* * copyin and the ktrsyscall()/ktrsysret() code is MP-aware */ - if (params != NULL && narg != 0) - error = copyin(params, (caddr_t)args, - (u_int)(narg * sizeof(int))); - else + if (params != NULL && narg != 0) { + error = 0; + /* XXX reorder trapframe so we can just copy the first 6 args */ + if (narg > 0) + args[0] = frame->tf_rdi; + if (narg > 1) + args[1] = frame->tf_rsi; + if (narg > 2) + args[2] = frame->tf_rdx; + if (narg > 3) + args[3] = frame->tf_rcx; + if (narg > 4) + args[4] = frame->tf_r8; + if (narg > 5) + args[5] = frame->tf_r9; + if (narg > 6) + error = copyin(params, (caddr_t)&args[6], + (u_int)((narg - 6) * sizeof(register_t))); + } else error = 0; #ifdef KTRACE
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200304222142.h3MLguGf016958>