]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - arch/riscv/kernel/sys_riscv.c
2 * Copyright (C) 2012 Regents of the University of California
3 * Copyright (C) 2014 Darius Rad <darius@bluespec.com>
4 * Copyright (C) 2017 SiFive
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <linux/syscalls.h>
17 #include <asm/cmpxchg.h>
18 #include <asm/unistd.h>
20 static long riscv_sys_mmap(unsigned long addr
, unsigned long len
,
21 unsigned long prot
, unsigned long flags
,
22 unsigned long fd
, off_t offset
,
23 unsigned long page_shift_offset
)
25 if (unlikely(offset
& (~PAGE_MASK
>> page_shift_offset
)))
27 return sys_mmap_pgoff(addr
, len
, prot
, flags
, fd
,
28 offset
>> (PAGE_SHIFT
- page_shift_offset
));
32 SYSCALL_DEFINE6(mmap
, unsigned long, addr
, unsigned long, len
,
33 unsigned long, prot
, unsigned long, flags
,
34 unsigned long, fd
, off_t
, offset
)
36 return riscv_sys_mmap(addr
, len
, prot
, flags
, fd
, offset
, 0);
39 SYSCALL_DEFINE6(mmap2
, unsigned long, addr
, unsigned long, len
,
40 unsigned long, prot
, unsigned long, flags
,
41 unsigned long, fd
, off_t
, offset
)
44 * Note that the shift for mmap2 is constant (12),
45 * regardless of PAGE_SIZE
47 return riscv_sys_mmap(addr
, len
, prot
, flags
, fd
, offset
, 12);
49 #endif /* !CONFIG_64BIT */