From owner-freebsd-hackers Wed Jan 19 14:53:25 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from lor.watermarkgroup.com (lor.watermarkgroup.com [207.202.73.33]) by hub.freebsd.org (Postfix) with ESMTP id 10529152EC for ; Wed, 19 Jan 2000 14:53:17 -0800 (PST) (envelope-from luoqi@watermarkgroup.com) Received: (from luoqi@localhost) by lor.watermarkgroup.com (8.8.8/8.8.8) id RAA01221; Wed, 19 Jan 2000 17:53:12 -0500 (EST) (envelope-from luoqi) Date: Wed, 19 Jan 2000 17:53:12 -0500 (EST) From: Luoqi Chen Message-Id: <200001192253.RAA01221@lor.watermarkgroup.com> To: freebsd-hackers@FreeBSD.ORG, zzhang@cs.binghamton.edu Subject: Re: Accessing user data from kernel Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > When the kernel wants to access any user data, it either copies them into > the kernel or maps them into kernel address space. Can anyone tell me the > reasons why this is done? When a process enters the kernel mode, the > page tables are not changed. > > I have taken this for granted for a long time without knowing the reasons. > > Thanks, > > -Zhihui > In theory, the kernel and user address spaces are separate. But in practice, for performance reasons, the kernel address space is always mapped at the top of user address space, so the kernel can directly access the current process' address space (copyin/copyout are just normal bcopy with bound check and guard against page fault). Under certain circumstances, you might want them to be truely separate, for example, if you have to use the full 4G in a user process, the tradeoff of course is the user/kernel context switch overhead. -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message