blob: a936a7eac21437fd4ac0d24d32b71e418345ac03 [file] [log] [blame]
Heiko Schocher4f7a9a32014-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{
Masahiro Yamada7b5ec7e2015-07-13 13:17:07 +090019 void *p;
20
21 p = memalign(ARCH_DMA_MINALIGN, size);
22 if (flags & __GFP_ZERO)
23 memset(p, 0, size);
Heiko Schocher4f7a9a32014-06-24 10:10:03 +020024
Masahiro Yamada7b5ec7e2015-07-13 13:17:07 +090025 return p;
Heiko Schocher4f7a9a32014-06-24 10:10:03 +020026}
27
Heiko Schocher4f7a9a32014-06-24 10:10:03 +020028struct kmem_cache *get_mem(int element_sz)
29{
30 struct kmem_cache *ret;
31
32 ret = memalign(ARCH_DMA_MINALIGN, sizeof(struct kmem_cache));
33 ret->sz = element_sz;
34
35 return ret;
36}
37
38void *kmem_cache_alloc(struct kmem_cache *obj, int flag)
39{
40 return memalign(ARCH_DMA_MINALIGN, obj->sz);
41}