CS350 COS
COS
|
#include <stdbool.h>
#include <stdint.h>
#include <errno.h>
#include <sys/kassert.h>
#include <machine/pmap.h>
Go to the source code of this file.
Functions | |
int | copy_unsafe (void *to_addr, void *from_addr, uintptr_t len) |
int | copystr_unsafe (void *to_addr, void *from_addr, uintptr_t len) |
int | Copy_In (uintptr_t fromuser, void *tokernel, uintptr_t len) |
int | Copy_Out (void *fromkernel, uintptr_t touser, uintptr_t len) |
int | Copy_StrIn (uintptr_t fromuser, void *tokernel, uintptr_t len) |
int | Copy_StrOut (void *fromkernel, uintptr_t touser, uintptr_t len) |
Copy_In –
Safely copy memory from userspace. Prevents userspace pointers from reading kernel memory.
Side effects: Kernel page fault may have occurred.
[in] | fromuser | User address to copy from. |
[in] | tokernel | Kernel address to copy to. |
[in] | len | Length of the data to copy. |
EFAULT | if the address is invalid or causes a fault. |
Definition at line 34 of file copy.c.
Copy_Out –
Safely copy memory to userspace. Prevents userspace pointers from writing kernel memory.
Side effects: Kernel page fault may have occurred.
[in] | fromkernel | Kernel address to copy from. |
[in] | touser | User address to copy to. |
[in] | len | Length of the data to copy. |
EFAULT | if the address is invalid or causes a fault. |
Definition at line 70 of file copy.c.
Copy_StrIn –
Safely copy a string from userspace. Prevents userspace pointers from reading kernel memory.
Side effects: Kernel page fault may have occurred.
[in] | fromuser | User address to copy from. |
[in] | tokernel | Kernel address to copy to. |
[in] | len | Maximum string length. |
EFAULT | if the address is invalid or causes a fault. |
Definition at line 106 of file copy.c.
Copy_StrOut –
Safely copy a string to userspace. Prevents userspace pointers from writing kernel memory.
Side effects: Kernel page fault may have occurred.
[in] | fromkernel | Kernel address to copy from. |
[in] | touser | User address to copy to. |
[in] | len | Maximum string length. |
EFAULT | if the address is invalid or causes a fault. |
Definition at line 142 of file copy.c.
int copy_unsafe | ( | void * | to_addr, |
void * | from_addr, | ||
uintptr_t | len | ||
) |
int copystr_unsafe | ( | void * | to_addr, |
void * | from_addr, | ||
uintptr_t | len | ||
) |