From owner-freebsd-current Sat Nov 27 21:45:25 1999 Delivered-To: freebsd-current@freebsd.org Received: from overcee.netplex.com.au (overcee.netplex.com.au [202.12.86.7]) by hub.freebsd.org (Postfix) with ESMTP id B645814C10 for ; Sat, 27 Nov 1999 21:45:20 -0800 (PST) (envelope-from peter@netplex.com.au) Received: from netplex.com.au (localhost [127.0.0.1]) by overcee.netplex.com.au (Postfix) with ESMTP id 2CB181C6D; Sun, 28 Nov 1999 13:45:19 +0800 (WST) (envelope-from peter@netplex.com.au) X-Mailer: exmh version 2.1.1 10/15/1999 To: Matthew Dillon Cc: David Greenman , Julian Elischer , current@FreeBSD.ORG Subject: Re: Which is the truth? (sycalls and traps) In-Reply-To: Message from Matthew Dillon of "Sat, 27 Nov 1999 19:11:41 PST." <199911280311.TAA40521@apollo.backplane.com> Date: Sun, 28 Nov 1999 13:45:19 +0800 From: Peter Wemm Message-Id: <19991128054519.2CB181C6D@overcee.netplex.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matthew Dillon wrote: > Oops, let me add an addendum, I didn't answer the original question! > > :(Julian wrote...) > : > :Am I also right in assuming that all the registers that the user was > :running when they did the KERNCALL have been saved on the KERNEL stack by > :the time that the above routines are called? > : > :(It's a pitty because if they were saved on the USER stack before teh > :kernel switched to the kernel stack it would have a great simplifying > :effect on kernel threads support :-) (I know that could lead to traps > :during saving the context but..) > [..] > Julian, you shouldn't worry about userland<->kernel context switch so muc h. > The overhead for going into the kernel and coming out again, if all the > cruft is removed, is *very* tiny -- it's almost like a subroutine call. I was rather suprised when I found out just how expensive kernel entry was some time ago.. What I was doing was a reentrant syscall that aquired no locks and ran about 5 instructions in kernel context.. Anyway, it took something like 300 times longer to do that (called via int $0x81) than to do a 'call' to equivalent code in userland. Anyway, with overheads on that scale, whether we push 5 or 8 or whatever registers in the handler is almost lost in the noise. Cheers, -Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message