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 __i386__
15
16extern "C" {
17
18status_t _arch_cpu_user_memcpy(void* to, const void* from, size_t size,
19	void (**faultHandler)(void));
20ssize_t _arch_cpu_user_strlcpy(char* to, const char* from, size_t size,
21	void (**faultHandler)(void));
22status_t _arch_cpu_user_memset(void* s, char c, size_t count,
23	void (**faultHandler)(void));
24
25}
26
27
28static inline status_t
29arch_cpu_user_memcpy(void* to, const void* from, size_t size)
30{
31	return _arch_cpu_user_memcpy(to, from, size,
32		&thread_get_current_thread()->fault_handler);
33}
34
35
36static inline ssize_t
37arch_cpu_user_strlcpy(char* to, const char* from, size_t size)
38{
39	return _arch_cpu_user_strlcpy(to, from, size,
40		&thread_get_current_thread()->fault_handler);
41}
42
43
44static inline status_t
45arch_cpu_user_memset(void* s, char c, size_t count)
46{
47	return _arch_cpu_user_memset(s, c, count,
48		&thread_get_current_thread()->fault_handler);
49}
50
51
52#else
53#	include <arch/generic/user_memory.h>
54#endif
55
56#endif	// _KERNEL_ARCH_USER_MEMORY_H
57
58