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 16 extern "C" { 17 18 status_t _arch_cpu_user_memcpy(void* to, const void* from, size_t size, 19 void (**faultHandler)(void)); 20 ssize_t _arch_cpu_user_strlcpy(char* to, const char* from, size_t size, 21 void (**faultHandler)(void)); 22 status_t _arch_cpu_user_memset(void* s, char c, size_t count, 23 void (**faultHandler)(void)); 24 25 } 26 27 28 static inline status_t 29 arch_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 36 static inline ssize_t 37 arch_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 44 static inline status_t 45 arch_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