> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to