copyinout - /* * User/kernel memory copying functions. * *...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/* * User/kernel memory copying functions. * * These are arranged to prevent fatal kernel memory faults if invalid * addresses are supplied by user-level code. This code is itself * machine-independent; it uses the machine-dependent C setjmp/longjmp * facility to perform recovery. * * However, it assumes things about the memory subsystem that may not * be true on all platforms. * * (1) It assumes that access to user memory from the kernel behaves * the same way as access to user memory from user space: for * instance, that the processor honors read-only bits on memory pages * when in kernel mode. * * (2) It assumes that the user-space region of memory is contiguous * and extends from 0 to some virtual address USERSPACETOP, and so if * a user process passes a kernel address the logic in copycheck() * will trap it. * * (3) It assumes that if a proper user-space address that is valid * but not present, or not valid at all, is touched from the kernel, * that the correct faults will occur and the VM system will load the * necessary pages and whatnot. * * (4) It assumes that the machine-dependent trap logic provides and * honors a pcb_badfaultfunc field: if an otherwise fatal fault occurs * in kernel mode, and pcb_badfaultfunc is set, execution resumes in * the function pointed to by pcb_badfaultfunc. * * If these four assumptions are satisfied, the mechanism by which * this code works, namely, setting pcb_badfaultfunc and then copying * memory in an ordinary fashion, should function correctly. If the * assumptions are not satisfied on some platform (for instance, * certain old 80386 processors violate assumption 1), this code * cannot be used, and platform-specific code must be written. */ #include <types.h>
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

copyinout - /* * User/kernel memory copying functions. * *...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online