Commit a8fe2efe authored by Jan Kiszka's avatar Jan Kiszka Committed by Philippe Gerum

ipipe: Introduce and use ipipe_root_nr_syscalls

At least one arch, infamous x86, has a difference of NR_syscalls
depending on compat vs. native ABI. Account for that by introducing a
function that can deliver the currently valid syscall number if an arch
implements such a service. In all other cases, this change is
functionally no difference.
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent f7fc01e9
......@@ -194,6 +194,10 @@ int __ipipe_notify_user_intreturn(void);
#define __ipipe_serial_debug(__fmt, __args...) raw_printk(__fmt, ##__args)
#ifndef ipipe_root_nr_syscalls
#define ipipe_root_nr_syscalls(ti) NR_syscalls
#endif
#else /* !CONFIG_IPIPE */
struct task_struct;
......
......@@ -1018,6 +1018,7 @@ int ipipe_handle_syscall(struct thread_info *ti,
unsigned long nr, struct pt_regs *regs)
{
unsigned long local_flags = READ_ONCE(ti->ipipe_flags);
unsigned int nr_syscalls = ipipe_root_nr_syscalls(ti);
int ret;
/*
......@@ -1051,7 +1052,7 @@ int ipipe_handle_syscall(struct thread_info *ti,
* system call handler.
*/
if (nr >= NR_syscalls && (local_flags & _TIP_HEAD)) {
if (nr >= nr_syscalls && (local_flags & _TIP_HEAD)) {
ipipe_fastcall_hook(regs);
local_flags = READ_ONCE(ti->ipipe_flags);
if (local_flags & _TIP_HEAD) {
......@@ -1064,7 +1065,7 @@ int ipipe_handle_syscall(struct thread_info *ti,
}
}
if ((local_flags & _TIP_NOTIFY) || nr >= NR_syscalls) {
if ((local_flags & _TIP_NOTIFY) || nr >= nr_syscalls) {
ret =__ipipe_notify_syscall(regs);
local_flags = READ_ONCE(ti->ipipe_flags);
if (local_flags & _TIP_HEAD)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment