xref: /openbmc/u-boot/lib/linux_compat.c (revision 6b9f9ead)
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 	void *p;
20 
21 	p = memalign(ARCH_DMA_MINALIGN, size);
22 	if (flags & __GFP_ZERO)
23 		memset(p, 0, size);
24 
25 	return p;
26 }
27 
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 }
42