18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2011 Texas Instruments Incorporated 48c2ecf20Sopenharmony_ci * Author: Mark Salter <msalter@redhat.com> 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci 78c2ecf20Sopenharmony_ci#ifndef __ASM_C6X_SYSCALL_H 88c2ecf20Sopenharmony_ci#define __ASM_C6X_SYSCALL_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <uapi/linux/audit.h> 118c2ecf20Sopenharmony_ci#include <linux/err.h> 128c2ecf20Sopenharmony_ci#include <linux/sched.h> 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_cistatic inline int syscall_get_nr(struct task_struct *task, 158c2ecf20Sopenharmony_ci struct pt_regs *regs) 168c2ecf20Sopenharmony_ci{ 178c2ecf20Sopenharmony_ci return regs->b0; 188c2ecf20Sopenharmony_ci} 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistatic inline void syscall_rollback(struct task_struct *task, 218c2ecf20Sopenharmony_ci struct pt_regs *regs) 228c2ecf20Sopenharmony_ci{ 238c2ecf20Sopenharmony_ci /* do nothing */ 248c2ecf20Sopenharmony_ci} 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistatic inline long syscall_get_error(struct task_struct *task, 278c2ecf20Sopenharmony_ci struct pt_regs *regs) 288c2ecf20Sopenharmony_ci{ 298c2ecf20Sopenharmony_ci return IS_ERR_VALUE(regs->a4) ? regs->a4 : 0; 308c2ecf20Sopenharmony_ci} 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_cistatic inline long syscall_get_return_value(struct task_struct *task, 338c2ecf20Sopenharmony_ci struct pt_regs *regs) 348c2ecf20Sopenharmony_ci{ 358c2ecf20Sopenharmony_ci return regs->a4; 368c2ecf20Sopenharmony_ci} 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_cistatic inline void syscall_set_return_value(struct task_struct *task, 398c2ecf20Sopenharmony_ci struct pt_regs *regs, 408c2ecf20Sopenharmony_ci int error, long val) 418c2ecf20Sopenharmony_ci{ 428c2ecf20Sopenharmony_ci regs->a4 = error ?: val; 438c2ecf20Sopenharmony_ci} 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_cistatic inline void syscall_get_arguments(struct task_struct *task, 468c2ecf20Sopenharmony_ci struct pt_regs *regs, 478c2ecf20Sopenharmony_ci unsigned long *args) 488c2ecf20Sopenharmony_ci{ 498c2ecf20Sopenharmony_ci *args++ = regs->a4; 508c2ecf20Sopenharmony_ci *args++ = regs->b4; 518c2ecf20Sopenharmony_ci *args++ = regs->a6; 528c2ecf20Sopenharmony_ci *args++ = regs->b6; 538c2ecf20Sopenharmony_ci *args++ = regs->a8; 548c2ecf20Sopenharmony_ci *args = regs->b8; 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_cistatic inline void syscall_set_arguments(struct task_struct *task, 588c2ecf20Sopenharmony_ci struct pt_regs *regs, 598c2ecf20Sopenharmony_ci const unsigned long *args) 608c2ecf20Sopenharmony_ci{ 618c2ecf20Sopenharmony_ci regs->a4 = *args++; 628c2ecf20Sopenharmony_ci regs->b4 = *args++; 638c2ecf20Sopenharmony_ci regs->a6 = *args++; 648c2ecf20Sopenharmony_ci regs->b6 = *args++; 658c2ecf20Sopenharmony_ci regs->a8 = *args++; 668c2ecf20Sopenharmony_ci regs->a9 = *args; 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_cistatic inline int syscall_get_arch(struct task_struct *task) 708c2ecf20Sopenharmony_ci{ 718c2ecf20Sopenharmony_ci return IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) 728c2ecf20Sopenharmony_ci ? AUDIT_ARCH_C6XBE : AUDIT_ARCH_C6X; 738c2ecf20Sopenharmony_ci} 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci#endif /* __ASM_C6X_SYSCALLS_H */ 76