user_memory.h revision 95e97463
1/*
2 * Copyright 2014, Pawe�� Dziepak, pdziepak@quarnos.org.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _KERNEL_ARCH_USER_MEMORY_H
6#define _KERNEL_ARCH_USER_MEMORY_H
7
8
9#include <OS.h>
10
11#include <thread.h>
12
13
14#ifdef __x86_64__
15#	include <arch/generic/user_memory.h>
16#else
17
18extern "C" {
19
20status_t _arch_cpu_user_memcpy(void* to, const void* from, size_t size,
21	void (**faultHandler)(void));
22ssize_t _arch_cpu_user_strlcpy(char* to, const char* from, size_t size,
23	void (**faultHandler)(void));
24status_t _arch_cpu_user_memset(void* s, char c, size_t count,
25	void (**faultHandler)(void));
26
27}
28
29
30static inline status_t
31arch_cpu_user_memcpy(void* to, const void* from, size_t size)
32{
33	return _arch_cpu_user_memcpy(to, from, size,
34		&thread_get_current_thread()->fault_handler);
35}
36
37
38static inline ssize_t
39arch_cpu_user_strlcpy(char* to, const char* from, size_t size)
40{
41	return _arch_cpu_user_strlcpy(to, from, size,
42		&thread_get_current_thread()->fault_handler);
43}
44
45
46static inline status_t
47arch_cpu_user_memset(void* s, char c, size_t count)
48{
49	return _arch_cpu_user_memset(s, c, count,
50		&thread_get_current_thread()->fault_handler);
51}
52
53
54#endif
55
56#endif	// _KERNEL_ARCH_USER_MEMORY_H
57
58