4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
8 * OpenRISC implementation:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
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 <uapi/linux/audit.h>
23 #include <linux/err.h>
24 #include <linux/sched.h>
27 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
29 return regs->orig_gpr11;
33 syscall_rollback(struct task_struct *task, struct pt_regs *regs)
35 regs->gpr[11] = regs->orig_gpr11;
39 syscall_get_error(struct task_struct *task, struct pt_regs *regs)
41 return IS_ERR_VALUE(regs->gpr[11]) ? regs->gpr[11] : 0;
45 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
51 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
54 regs->gpr[11] = (long) error ?: val;
58 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
59 unsigned int i, unsigned int n, unsigned long *args)
63 memcpy(args, ®s->gpr[3 + i], n * sizeof(args[0]));
67 syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
68 unsigned int i, unsigned int n, const unsigned long *args)
72 memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));
75 static inline int syscall_get_arch(void)
77 return AUDIT_ARCH_OPENRISC;