]>
Commit | Line | Data |
---|---|---|
0c06db59 HS |
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 | { | |
6b9f9ead | 19 | void *p; |
0c06db59 | 20 | |
6b9f9ead MY |
21 | p = memalign(ARCH_DMA_MINALIGN, size); |
22 | if (flags & __GFP_ZERO) | |
23 | memset(p, 0, size); | |
24 | ||
25 | return p; | |
0c06db59 HS |
26 | } |
27 | ||
0c06db59 HS |
28 | struct 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 | ||
38 | void *kmem_cache_alloc(struct kmem_cache *obj, int flag) | |
39 | { | |
40 | return memalign(ARCH_DMA_MINALIGN, obj->sz); | |
41 | } |