From owner-p4-projects@FreeBSD.ORG Fri Apr 25 14:12:43 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CF56537B404; Fri, 25 Apr 2003 14:12:42 -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 69BFB37B401 for ; Fri, 25 Apr 2003 14:12:42 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EBA2543F93 for ; Fri, 25 Apr 2003 14:12:41 -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 h3PLCf0U029962 for ; Fri, 25 Apr 2003 14:12:41 -0700 (PDT) (envelope-from peter@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h3PLCfoN029953 for perforce@freebsd.org; Fri, 25 Apr 2003 14:12:41 -0700 (PDT) Date: Fri, 25 Apr 2003 14:12:41 -0700 (PDT) Message-Id: <200304252112.h3PLCfoN029953@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 29731 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: Fri, 25 Apr 2003 21:12:44 -0000 http://perforce.freebsd.org/chv.cgi?CH=29731 Change 29731 by peter@peter_daintree on 2003/04/25 14:12:33 Make some guesses about what fast_syscall could look like. It isn't enabled on the cpu yet though. This is still pretty rough, and the swapgs stuff is commented out since the PCPU stuff is commented out, hence it doesn't gain anything yet. Affected files ... .. //depot/projects/hammer/sys/x86_64/x86_64/exception.s#24 edit Differences ... ==== //depot/projects/hammer/sys/x86_64/x86_64/exception.s#24 (text+ko) ==== @@ -191,6 +191,68 @@ MEXITCOUNT jmp doreti +/* + * Fast syscall entry point. We enter here with just our new %cs/%ss set, + * and the new privilige level. We are still running on the old user stack + * pointer. We have to juggle a few things around to find our stack etc. + * swapgs gives us access to our PCPU space only. + * XXX The PCPU stuff is stubbed out right now... + */ +IDTVEC(fast_syscall) + #swapgs + movq %rsp,PCPU(SCRATCH_RSP) + movq common_tss+COMMON_TSS_RSP0,%rsp + sti + /* Now emulate a trapframe. Ugh. */ + subq $TF_SIZE,%rsp + movq $KUDSEL,TF_SS(%rsp) + /* defer TF_RSP till we have a spare register */ + movq %r11,TF_RFLAGS(%rsp) + movq $KUCSEL,TF_CS(%rsp) + movq %rcx,TF_RIP(%rsp) /* %rcx original value is in %r10 */ + movq $2,TF_ERR(%rsp) + movq %rdi,TF_RDI(%rsp) /* arg 1 */ + movq %rsi,TF_RSI(%rsp) /* arg 2 */ + movq %rdx,TF_RDX(%rsp) /* arg 3 */ + movq %r10,TF_RCX(%rsp) /* arg 4 */ + movq %r8,TF_R8(%rsp) /* arg 5 */ + movq %r9,TF_R9(%rsp) /* arg 6 */ + movq %rax,TF_RAX(%rsp) /* syscall number */ + movq %rbx,TF_RBX(%rsp) /* C preserved */ + movq %rbp,TF_RBP(%rsp) /* C preserved */ + movq %r12,TF_R12(%rsp) /* C preserved */ + movq %r13,TF_R13(%rsp) /* C preserved */ + movq %r14,TF_R14(%rsp) /* C preserved */ + movq %r15,TF_R15(%rsp) /* C preserved */ + movq PCPU(SCRATCH_RSP),%r12 /* %r12 already saved */ + movq %r12,TF_RSP(%rsp) /* user stack pointer */ + call syscall + /* simplified from doreti */ +1: /* Check for and handle AST's on return to userland */ + cli + movq PCPU(CURTHREAD),%rax + testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax) + je 2f + sti + movq %rsp, %rdi + call ast + jmp 1b +2: /* restore preserved registers */ + movq TF_RSP(%rsp),%rdi /* user stack pointer */ + movq TF_RAX(%rsp),%rax /* return value 1 */ + movq TF_RDX(%rsp),%rdx /* return value 2 */ + movq TF_RBX(%rsp),%rbx /* C preserved */ + movq TF_RBP(%rsp),%rbp /* C preserved */ + movq TF_R12(%rsp),%r12 /* C preserved */ + movq TF_R13(%rsp),%r13 /* C preserved */ + movq TF_R14(%rsp),%r14 /* C preserved */ + movq TF_R15(%rsp),%r15 /* C preserved */ + movq TF_R11(%rsp),%r11 /* original %rflags */ + movq TF_RIP(%rsp),%rcx /* original %rip */ + sti + #swapgs + sysret + ENTRY(fork_trampoline) movq %r12, %rdi /* function */ movq %rbx, %rsi /* arg1 */