18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Syscall support for the Hexagon architecture
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _ASM_HEXAGON_SYSCALL_H
98c2ecf20Sopenharmony_ci#define _ASM_HEXAGON_SYSCALL_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include <uapi/linux/audit.h>
128c2ecf20Sopenharmony_ci#include <linux/err.h>
138c2ecf20Sopenharmony_ci#include <asm/ptrace.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_citypedef long (*syscall_fn)(unsigned long, unsigned long,
168c2ecf20Sopenharmony_ci	unsigned long, unsigned long,
178c2ecf20Sopenharmony_ci	unsigned long, unsigned long);
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <asm-generic/syscalls.h>
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciextern void *sys_call_table[];
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic inline long syscall_get_nr(struct task_struct *task,
248c2ecf20Sopenharmony_ci				  struct pt_regs *regs)
258c2ecf20Sopenharmony_ci{
268c2ecf20Sopenharmony_ci	return regs->r06;
278c2ecf20Sopenharmony_ci}
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic inline void syscall_get_arguments(struct task_struct *task,
308c2ecf20Sopenharmony_ci					 struct pt_regs *regs,
318c2ecf20Sopenharmony_ci					 unsigned long *args)
328c2ecf20Sopenharmony_ci{
338c2ecf20Sopenharmony_ci	memcpy(args, &(&regs->r00)[0], 6 * sizeof(args[0]));
348c2ecf20Sopenharmony_ci}
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_cistatic inline long syscall_get_error(struct task_struct *task,
378c2ecf20Sopenharmony_ci				     struct pt_regs *regs)
388c2ecf20Sopenharmony_ci{
398c2ecf20Sopenharmony_ci	return IS_ERR_VALUE(regs->r00) ? regs->r00 : 0;
408c2ecf20Sopenharmony_ci}
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cistatic inline long syscall_get_return_value(struct task_struct *task,
438c2ecf20Sopenharmony_ci					    struct pt_regs *regs)
448c2ecf20Sopenharmony_ci{
458c2ecf20Sopenharmony_ci	return regs->r00;
468c2ecf20Sopenharmony_ci}
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_cistatic inline int syscall_get_arch(struct task_struct *task)
498c2ecf20Sopenharmony_ci{
508c2ecf20Sopenharmony_ci	return AUDIT_ARCH_HEXAGON;
518c2ecf20Sopenharmony_ci}
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci#endif
54