Heiko Schocher | 0c06db5 | 2014-06-24 10:10:03 +0200 | [diff] [blame] | 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 | |
Heiko Schocher | 0c06db5 | 2014-06-24 10:10:03 +0200 | [diff] [blame] | 29 | struct kmem_cache *get_mem(int element_sz) |
| 30 | { |
| 31 | struct kmem_cache *ret; |
| 32 | |
| 33 | ret = memalign(ARCH_DMA_MINALIGN, sizeof(struct kmem_cache)); |
| 34 | ret->sz = element_sz; |
| 35 | |
| 36 | return ret; |
| 37 | } |
| 38 | |
| 39 | void *kmem_cache_alloc(struct kmem_cache *obj, int flag) |
| 40 | { |
| 41 | return memalign(ARCH_DMA_MINALIGN, obj->sz); |
| 42 | } |