arch/loongarch/include/asm/syscall.h
Source file repositories/reference/linux-study-clean/arch/loongarch/include/asm/syscall.h
File Facts
- System
- Linux kernel
- Corpus path
arch/loongarch/include/asm/syscall.h- Extension
.h- Size
- 2097 bytes
- Lines
- 94
- Domain
- Architecture Layer
- Bucket
- arch/loongarch
- Inferred role
- Architecture Layer: syscall or user/kernel boundary
- Status
- core implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compiler.huapi/linux/audit.hlinux/elf-em.hlinux/kernel.hlinux/sched.hlinux/uaccess.hasm/ptrace.hasm/unistd.h
Detected Declarations
function syscall_get_nrfunction syscall_set_nrfunction syscall_rollbackfunction syscall_get_errorfunction syscall_get_return_valuefunction syscall_set_return_valuefunction syscall_get_argumentsfunction syscall_set_argumentsfunction syscall_get_archfunction arch_syscall_is_vdso_sigreturn
Annotated Snippet
#ifndef __ASM_LOONGARCH_SYSCALL_H
#define __ASM_LOONGARCH_SYSCALL_H
#include <linux/compiler.h>
#include <uapi/linux/audit.h>
#include <linux/elf-em.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/uaccess.h>
#include <asm/ptrace.h>
#include <asm/unistd.h>
extern void *sys_call_table[];
static inline long syscall_get_nr(struct task_struct *task,
struct pt_regs *regs)
{
return regs->regs[11];
}
static inline void syscall_set_nr(struct task_struct *task,
struct pt_regs *regs,
int nr)
{
regs->regs[11] = nr;
}
static inline void syscall_rollback(struct task_struct *task,
struct pt_regs *regs)
{
regs->regs[4] = regs->orig_a0;
}
static inline long syscall_get_error(struct task_struct *task,
struct pt_regs *regs)
{
unsigned long error = regs->regs[4];
return IS_ERR_VALUE(error) ? error : 0;
}
static inline long syscall_get_return_value(struct task_struct *task,
struct pt_regs *regs)
{
return regs->regs[4];
}
static inline void syscall_set_return_value(struct task_struct *task,
struct pt_regs *regs,
int error, long val)
{
regs->regs[4] = (long) error ? error : val;
}
static inline void syscall_get_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned long *args)
{
args[0] = regs->orig_a0;
memcpy(&args[1], ®s->regs[5], 5 * sizeof(long));
}
static inline void syscall_set_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned long *args)
{
regs->orig_a0 = args[0];
memcpy(®s->regs[5], &args[1], 5 * sizeof(long));
}
static inline int syscall_get_arch(struct task_struct *task)
{
#ifdef CONFIG_32BIT
return AUDIT_ARCH_LOONGARCH32;
#else
return AUDIT_ARCH_LOONGARCH64;
#endif
}
static inline bool arch_syscall_is_vdso_sigreturn(struct pt_regs *regs)
{
return false;
}
#endif /* __ASM_LOONGARCH_SYSCALL_H */
Annotation
- Immediate include surface: `linux/compiler.h`, `uapi/linux/audit.h`, `linux/elf-em.h`, `linux/kernel.h`, `linux/sched.h`, `linux/uaccess.h`, `asm/ptrace.h`, `asm/unistd.h`.
- Detected declarations: `function syscall_get_nr`, `function syscall_set_nr`, `function syscall_rollback`, `function syscall_get_error`, `function syscall_get_return_value`, `function syscall_set_return_value`, `function syscall_get_arguments`, `function syscall_set_arguments`, `function syscall_get_arch`, `function arch_syscall_is_vdso_sigreturn`.
- Atlas domain: Architecture Layer / arch/loongarch.
- Implementation status: core implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.