nfsd: don't fail unchecked creates of non-special files
[zen-stable.git] / arch / openrisc / include / asm / syscall.h
blob9f0337055d26f4b407f29c2ab2f34ed3930fb6e9
1 /*
2 * OpenRISC Linux
4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
6 * declaration.
8 * OpenRISC implementation:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
11 * et al.
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
19 #ifndef __ASM_OPENRISC_SYSCALL_H__
20 #define __ASM_OPENRISC_SYSCALL_H__
22 #include <linux/err.h>
23 #include <linux/sched.h>
25 static inline int
26 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
28 return regs->syscallno ? regs->syscallno : -1;
31 static inline void
32 syscall_rollback(struct task_struct *task, struct pt_regs *regs)
34 regs->gpr[11] = regs->orig_gpr11;
37 static inline long
38 syscall_get_error(struct task_struct *task, struct pt_regs *regs)
40 return IS_ERR_VALUE(regs->gpr[11]) ? regs->gpr[11] : 0;
43 static inline long
44 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
46 return regs->gpr[11];
49 static inline void
50 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
51 int error, long val)
53 if (error)
54 regs->gpr[11] = -error;
55 else
56 regs->gpr[11] = val;
59 static inline void
60 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
61 unsigned int i, unsigned int n, unsigned long *args)
63 BUG_ON(i + n > 6);
65 memcpy(args, &regs->gpr[3 + i], n * sizeof(args[0]));
68 static inline void
69 syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
70 unsigned int i, unsigned int n, const unsigned long *args)
72 BUG_ON(i + n > 6);
74 memcpy(&regs->gpr[3 + i], args, n * sizeof(args[0]));
77 #endif