blob: 8c7a7b57525aed4ef7ab53507950d470db5c3d51 [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
Heiko Schocher0c06db52014-06-24 10:10:03 +020029struct 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
39void *kmem_cache_alloc(struct kmem_cache *obj, int flag)
40{
41 return memalign(ARCH_DMA_MINALIGN, obj->sz);
42}