blob: a3d4675f7ed98cc2d7c05cb460138717abf7c470 [file] [log] [blame]
Heiko Schocher0c06db52014-06-24 10:10:03 +02001
2#include <common.h>
3#include <linux/compat.h>
4
5struct p_current cur = {
6 .pid = 1,
7};
8__maybe_unused struct p_current *current = &cur;
9
10unsigned 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
17void *kmalloc(size_t size, int flags)
18{
19 return memalign(ARCH_DMA_MINALIGN, size);
20}
21
22void *kzalloc(size_t size, int flags)
23{
24 void *ptr = kmalloc(size, flags);
25 memset(ptr, 0, size);
26 return ptr;
27}
28
29void *vzalloc(unsigned long size)
30{
31 return kzalloc(size, 0);
32}
33
34struct 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
44void *kmem_cache_alloc(struct kmem_cache *obj, int flag)
45{
46 return memalign(ARCH_DMA_MINALIGN, obj->sz);
47}