Add copy.c into build
This commit is contained in:
parent
7c0d1cae67
commit
fa86208a82
@ -36,6 +36,7 @@ src_amd64 = [
|
||||
]
|
||||
|
||||
src_common = [
|
||||
"kern/copy.c",
|
||||
"kern/debug.c",
|
||||
"kern/disk.c",
|
||||
"kern/diskcache.c",
|
||||
|
@ -6,6 +6,8 @@
|
||||
#ifndef __AMD64_H__
|
||||
#define __AMD64_H__
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
/*
|
||||
* Page Tables
|
||||
*/
|
||||
|
@ -59,8 +59,8 @@ void Handle_Remove(Thread *thr, Handle *handle);
|
||||
Handle *Handle_Lookup(Thread *thr, uint64_t fd);
|
||||
|
||||
// CopyIn/CopyOut Functions
|
||||
int CopyIn(void *fromuser, void *tokernel, uintptr_t len);
|
||||
int CopyOut(void *fromkernel, void *touser, uintptr_t len);
|
||||
int CopyIn(uintptr_t fromuser, void *tokernel, uintptr_t len);
|
||||
int CopyOut(void *fromkernel, uintptr_t touser, uintptr_t len);
|
||||
|
||||
#endif /* __SYS_THREAD_H__ */
|
||||
|
||||
|
@ -2,10 +2,17 @@
|
||||
* Generic Copyin/Copyout routines
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include <machine/pmap.h>
|
||||
|
||||
extern int copy_unsafe(void *to_addr, void *from_addr, uintptr_t len);
|
||||
|
||||
int
|
||||
CopyIn(void *fromuser, void *tokernel, uintptr_t len)
|
||||
CopyIn(uintptr_t fromuser, void *tokernel, uintptr_t len)
|
||||
{
|
||||
if (len == 0)
|
||||
return 0;
|
||||
@ -18,11 +25,11 @@ CopyIn(void *fromuser, void *tokernel, uintptr_t len)
|
||||
if (len < (MEM_USERSPACE_TOP - fromuser))
|
||||
return EFAULT;
|
||||
|
||||
return copy_unsafe(tokernel, fromuser, len);
|
||||
return copy_unsafe(tokernel, (void *)fromuser, len);
|
||||
}
|
||||
|
||||
int
|
||||
CopyOut(void *fromkernel, void *touser, uintptr_t len)
|
||||
CopyOut(void *fromkernel, uintptr_t touser, uintptr_t len)
|
||||
{
|
||||
if (len == 0)
|
||||
return 0;
|
||||
@ -35,6 +42,6 @@ CopyOut(void *fromkernel, void *touser, uintptr_t len)
|
||||
if (len < (MEM_USERSPACE_TOP - touser))
|
||||
return EFAULT;
|
||||
|
||||
return copy_unsafe(touser, fromkernel, len);
|
||||
return copy_unsafe((void *)touser, fromkernel, len);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user