]> git.ipfire.org Git - people/ms/u-boot.git/blame - lib/linux_compat.c
lib: div64: sync with Linux
[people/ms/u-boot.git] / lib / linux_compat.c
CommitLineData
0c06db59
HS
1
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{
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
28struct 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}