syscall.c (76ed626479ebe0227728eff16bb44544ebd98920) syscall.c (208da1d5fc3c67d8ae5d34e844fd67cc47a136f0)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * S390 version
4 * Copyright IBM Corp. 1999, 2000
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 * Thomas Spatzier (tspat@de.ibm.com)
7 *
8 * Derived from "arch/i386/kernel/sys_i386.c"

--- 24 unchanged lines hidden (view full) ---

33#include <linux/thread_info.h>
34#include <linux/entry-common.h>
35
36#include <asm/ptrace.h>
37#include <asm/vtime.h>
38
39#include "entry.h"
40
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * S390 version
4 * Copyright IBM Corp. 1999, 2000
5 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
6 * Thomas Spatzier (tspat@de.ibm.com)
7 *
8 * Derived from "arch/i386/kernel/sys_i386.c"

--- 24 unchanged lines hidden (view full) ---

33#include <linux/thread_info.h>
34#include <linux/entry-common.h>
35
36#include <asm/ptrace.h>
37#include <asm/vtime.h>
38
39#include "entry.h"
40
41/*
42 * Perform the mmap() system call. Linux for S/390 isn't able to handle more
43 * than 5 system call parameters, so this system call uses a memory block
44 * for parameter passing.
45 */
46
47struct s390_mmap_arg_struct {
48 unsigned long addr;
49 unsigned long len;
50 unsigned long prot;
51 unsigned long flags;
52 unsigned long fd;
53 unsigned long offset;
54};
55
56SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
57{
58 struct s390_mmap_arg_struct a;
59 int error = -EFAULT;
60
61 if (copy_from_user(&a, arg, sizeof(a)))
62 goto out;
63 error = ksys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
64out:
65 return error;
66}
67
41#ifdef CONFIG_SYSVIPC
42/*
43 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
44 */
45SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
46 unsigned long, third, void __user *, ptr)
47{
48 if (call >> 16)

--- 70 unchanged lines hidden (view full) ---

119out:
120 syscall_exit_to_user_mode_work(regs);
121}
122
123void noinstr __do_syscall(struct pt_regs *regs, int per_trap)
124{
125 add_random_kstack_offset();
126 enter_from_user_mode(regs);
68#ifdef CONFIG_SYSVIPC
69/*
70 * sys_ipc() is the de-multiplexer for the SysV IPC calls.
71 */
72SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
73 unsigned long, third, void __user *, ptr)
74{
75 if (call >> 16)

--- 70 unchanged lines hidden (view full) ---

146out:
147 syscall_exit_to_user_mode_work(regs);
148}
149
150void noinstr __do_syscall(struct pt_regs *regs, int per_trap)
151{
152 add_random_kstack_offset();
153 enter_from_user_mode(regs);
127 regs->psw = S390_lowcore.svc_old_psw;
128 regs->int_code = S390_lowcore.svc_int_code;
154 regs->psw = get_lowcore()->svc_old_psw;
155 regs->int_code = get_lowcore()->svc_int_code;
129 update_timer_sys();
130 if (static_branch_likely(&cpu_has_bear))
131 current->thread.last_break = regs->last_break;
132
133 local_irq_enable();
134 regs->orig_gpr2 = regs->gprs[2];
135
136 if (per_trap)
137 set_thread_flag(TIF_PER_TRAP);
138
139 regs->flags = 0;
140 set_pt_regs_flag(regs, PIF_SYSCALL);
141 do_syscall(regs);
142 exit_to_user_mode();
143}
156 update_timer_sys();
157 if (static_branch_likely(&cpu_has_bear))
158 current->thread.last_break = regs->last_break;
159
160 local_irq_enable();
161 regs->orig_gpr2 = regs->gprs[2];
162
163 if (per_trap)
164 set_thread_flag(TIF_PER_TRAP);
165
166 regs->flags = 0;
167 set_pt_regs_flag(regs, PIF_SYSCALL);
168 do_syscall(regs);
169 exit_to_user_mode();
170}