1 2 #include <common.h> 3 #include <linux/compat.h> 4 5 struct p_current cur = { 6 .pid = 1, 7 }; 8 __maybe_unused struct p_current *current = &cur; 9 10 unsigned long copy_from_user(void *dest, const void *src, 11 unsigned long count) 12 { 13 memcpy((void *)dest, (void *)src, count); 14 return 0; 15 } 16 17 void *kmalloc(size_t size, int flags) 18 { 19 return memalign(ARCH_DMA_MINALIGN, size); 20 } 21 22 void *kzalloc(size_t size, int flags) 23 { 24 void *ptr = kmalloc(size, flags); 25 memset(ptr, 0, size); 26 return ptr; 27 } 28 29 void *vzalloc(unsigned long size) 30 { 31 return kzalloc(size, 0); 32 } 33 34 struct kmem_cache *get_mem(int element_sz) 35 { 36 struct kmem_cache *ret; 37 38 ret = memalign(ARCH_DMA_MINALIGN, sizeof(struct kmem_cache)); 39 ret->sz = element_sz; 40 41 return ret; 42 } 43 44 void *kmem_cache_alloc(struct kmem_cache *obj, int flag) 45 { 46 return memalign(ARCH_DMA_MINALIGN, obj->sz); 47 } 48