4 #include <minix/config.h>
5 #include <minix/const.h>
6 #include <machine/asm.h>
7 #include <machine/interrupt.h>
8 #include <machine/vm.h>
10 #include "kernel/const.h"
12 #include <machine/multiboot.h>
15 /*===========================================================================*/
16 /* copy_msg_from_user */
17 /*===========================================================================*/
19 * int copy_msg_from_user(message * user_mbuf, message * dst);
21 * Copies a message of 64 bytes from user process space to a kernel buffer. This
22 * function assumes that the process address space is installed (ttbr loaded).
24 * This function from the callers point of view either succeeds or returns an
25 * error which gives the caller a chance to respond accordingly. In fact it
26 * either succeeds or if it generates a pagefault, general protection or other
27 * exception, the trap handler has to redirect the execution to
28 * __user_copy_msg_pointer_failure where the error is reported to the caller
29 * without resolving the pagefault. It is not kernel's problem to deal with
30 * wrong pointers from userspace and the caller should return an error to
31 * userspace as if wrong values or request were passed to the kernel
33 ENTRY(copy_msg_from_user)
35 /* load the source pointer */
37 /* load the destination pointer */
39 /* do the copy, first 32 bytes */
49 LABEL(__copy_msg_from_user_end)
54 /*===========================================================================*/
55 /* copy_msg_to_user */
56 /*===========================================================================*/
58 * void copy_msg_to_user(message * src, message * user_mbuf);
60 * Copies a message of 64 bytes to user process space from a kernel buffer.
62 * All the other copy_msg_from_user() comments apply here as well!
64 ENTRY(copy_msg_to_user)
66 /* load the source pointer */
68 /* load the destination pointer */
70 /* do the copy, first 32 bytes */
80 LABEL(__copy_msg_to_user_end)
86 * if a function from a selected set of copies from or to userspace fails, it is
87 * because of a wrong pointer supplied by the userspace. We have to clean up and
88 * and return -1 to indicated that something wrong has happend. The place it was
89 * called from has to handle this situation. The exception handler redirect us
90 * here to continue, clean up and report the error
92 ENTRY(__user_copy_msg_pointer_failure)
98 ENTRY(interrupts_enable)
104 ENTRY(interrupts_disable)