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