From owner-p4-projects@FreeBSD.ORG Tue Apr 22 14:42:59 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 74AD837B404; Tue, 22 Apr 2003 14:42:58 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0D97037B401 for ; Tue, 22 Apr 2003 14:42:58 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A56B943FDF for ; Tue, 22 Apr 2003 14:42:57 -0700 (PDT) (envelope-from peter@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h3MLgv0U016969 for ; Tue, 22 Apr 2003 14:42:57 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3MLguGf016958 for perforce@freebsd.org; Tue, 22 Apr 2003 14:42:56 -0700 (PDT) Date: Tue, 22 Apr 2003 14:42:56 -0700 (PDT) Message-Id: <200304222142.h3MLguGf016958@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm To: Perforce Change Reviews Subject: PERFORCE change 29459 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Apr 2003 21:42:59 -0000 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