2 * This file contains various system calls that have different calling
3 * conventions on different platforms.
5 * Copyright (C) 1999-2000, 2002-2003, 2005 Hewlett-Packard Co
6 * David Mosberger-Tang <davidm@hpl.hp.com>
8 #include <linux/errno.h>
11 #include <linux/mman.h>
12 #include <linux/sched.h>
13 #include <linux/sched/mm.h>
14 #include <linux/sched/task_stack.h>
15 #include <linux/shm.h>
16 #include <linux/file.h> /* doh, must come after sched.h... */
17 #include <linux/smp.h>
18 #include <linux/syscalls.h>
19 #include <linux/highuid.h>
20 #include <linux/hugetlb.h>
22 #include <asm/shmparam.h>
23 #include <linux/uaccess.h>
26 arch_get_unmapped_area (struct file
*filp
, unsigned long addr
, unsigned long len
,
27 unsigned long pgoff
, unsigned long flags
)
29 long map_shared
= (flags
& MAP_SHARED
);
30 unsigned long align_mask
= 0;
31 struct mm_struct
*mm
= current
->mm
;
32 struct vm_unmapped_area_info info
;
34 if (len
> RGN_MAP_LIMIT
)
37 /* handle fixed mapping: prevent overlap with huge pages */
38 if (flags
& MAP_FIXED
) {
39 if (is_hugepage_only_range(mm
, addr
, len
))
44 #ifdef CONFIG_HUGETLB_PAGE
45 if (REGION_NUMBER(addr
) == RGN_HPAGE
)
49 addr
= TASK_UNMAPPED_BASE
;
51 if (map_shared
&& (TASK_SIZE
> 0xfffffffful
))
53 * For 64-bit tasks, align shared segments to 1MB to avoid potential
54 * performance penalty due to virtual aliasing (see ASDM). For 32-bit
55 * tasks, we prefer to avoid exhausting the address space too quickly by
56 * limiting alignment to a single page.
58 align_mask
= PAGE_MASK
& (SHMLBA
- 1);
62 info
.low_limit
= addr
;
63 info
.high_limit
= TASK_SIZE
;
64 info
.align_mask
= align_mask
;
65 info
.align_offset
= 0;
66 return vm_unmapped_area(&info
);
70 ia64_getpriority (int which
, int who
)
74 prio
= sys_getpriority(which
, who
);
76 force_successful_syscall_return();
82 /* XXX obsolete, but leave it here until the old libc is gone... */
83 asmlinkage
unsigned long
84 sys_getpagesize (void)
89 asmlinkage
unsigned long
90 ia64_brk (unsigned long brk
)
92 unsigned long retval
= sys_brk(brk
);
93 force_successful_syscall_return();
98 * On IA-64, we return the two file descriptors in ret0 and ret1 (r8
99 * and r9) as this is faster than doing a copy_to_user().
104 struct pt_regs
*regs
= task_pt_regs(current
);
108 retval
= do_pipe_flags(fd
, 0);
117 int ia64_mmap_check(unsigned long addr
, unsigned long len
,
123 * Don't permit mappings into unmapped space, the virtual page table
124 * of a region, or across a region boundary. Note: RGN_MAP_LIMIT is
125 * equal to 2^n-PAGE_SIZE (for some integer n <= 61) and len > 0.
127 roff
= REGION_OFFSET(addr
);
128 if ((len
> RGN_MAP_LIMIT
) || (roff
> (RGN_MAP_LIMIT
- len
)))
134 * mmap2() is like mmap() except that the offset is expressed in units
135 * of PAGE_SIZE (instead of bytes). This allows to mmap2() (pieces
136 * of) files that are larger than the address space of the CPU.
138 asmlinkage
unsigned long
139 sys_mmap2 (unsigned long addr
, unsigned long len
, int prot
, int flags
, int fd
, long pgoff
)
141 addr
= sys_mmap_pgoff(addr
, len
, prot
, flags
, fd
, pgoff
);
142 if (!IS_ERR((void *) addr
))
143 force_successful_syscall_return();
147 asmlinkage
unsigned long
148 sys_mmap (unsigned long addr
, unsigned long len
, int prot
, int flags
, int fd
, long off
)
150 if (offset_in_page(off
) != 0)
153 addr
= sys_mmap_pgoff(addr
, len
, prot
, flags
, fd
, off
>> PAGE_SHIFT
);
154 if (!IS_ERR((void *) addr
))
155 force_successful_syscall_return();
159 asmlinkage
unsigned long
160 ia64_mremap (unsigned long addr
, unsigned long old_len
, unsigned long new_len
, unsigned long flags
,
161 unsigned long new_addr
)
163 addr
= sys_mremap(addr
, old_len
, new_len
, flags
, new_addr
);
164 if (!IS_ERR((void *) addr
))
165 force_successful_syscall_return();
172 sys_pciconfig_read (unsigned long bus
, unsigned long dfn
, unsigned long off
, unsigned long len
,
179 sys_pciconfig_write (unsigned long bus
, unsigned long dfn
, unsigned long off
, unsigned long len
,
185 #endif /* CONFIG_PCI */