arch/alpha/include/asm/syscall.h
Source file repositories/reference/linux-study-clean/arch/alpha/include/asm/syscall.h
File Facts
- System
- Linux kernel
- Corpus path
arch/alpha/include/asm/syscall.h- Extension
.h- Size
- 2892 bytes
- Lines
- 107
- Domain
- Architecture Layer
- Bucket
- arch/alpha
- 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
uapi/linux/audit.hlinux/audit.hlinux/sched.hlinux/types.hasm/ptrace.h
Detected Declarations
function syscall_get_archfunction syscall_get_return_valuefunction syscall_get_nrfunction syscall_set_nrfunction syscall_get_argumentsfunction syscall_set_argumentsfunction r19function syscall_rollback
Annotated Snippet
#ifndef _ASM_ALPHA_SYSCALL_H
#define _ASM_ALPHA_SYSCALL_H
#include <uapi/linux/audit.h>
#include <linux/audit.h>
#include <linux/sched.h>
#include <linux/types.h>
#include <asm/ptrace.h>
static inline int syscall_get_arch(struct task_struct *task)
{
return AUDIT_ARCH_ALPHA;
}
static inline long syscall_get_return_value(struct task_struct *task,
struct pt_regs *regs)
{
return regs->r19 ? -(long)regs->r0 : (long)regs->r0;
}
/*
* Alpha syscall ABI / kernel conventions:
* - PAL provides syscall number in r0 on entry.
* - The kernel tracks the active syscall number in regs->r1 (mutable) and
* preserves the original syscall number in regs->r2 for rollback/restart.
* - Return value is in regs->r0, with regs->r19 ("a3") as the error flag
* (0=success, 1=error; on error regs->r0 holds positive errno).
*/
static inline long syscall_get_nr(struct task_struct *task,
struct pt_regs *regs)
{
return (long)regs->r1;
}
static inline void syscall_set_nr(struct task_struct *task,
struct pt_regs *regs,
long nr)
{
regs->r1 = (unsigned long)nr;
}
/*
* Syscall arguments:
* regs->r16..regs->r21 carry up to 6 syscall arguments on entry.
* Note: regs->r19 is also used as "a3" (error flag) on syscall return.
*/
static inline void syscall_get_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned long *args)
{
args[0] = regs->r16;
args[1] = regs->r17;
args[2] = regs->r18;
args[3] = regs->r19;
args[4] = regs->r20;
args[5] = regs->r21;
}
static inline void syscall_set_arguments(struct task_struct *task,
struct pt_regs *regs,
const unsigned long *args)
{
regs->r16 = args[0];
regs->r17 = args[1];
regs->r18 = args[2];
regs->r19 = args[3];
regs->r20 = args[4];
regs->r21 = args[5];
}
/*
* Set return value for a syscall.
* Alpha uses r0 for return value and r19 ("a3") as the error indicator:
* a3 = 0 => success
* a3 = 1 => error, and userspace interprets r0 as errno (positive).
*
* The kernel reports errors to userspace by setting a3=1 and placing a
* positive errno value in r0. Some syscall paths do this in entry.S,
* while others (e.g. seccomp/ptrace helpers) use syscall_set_return_value().
*/
static inline void syscall_set_return_value(struct task_struct *task,
struct pt_regs *regs,
int error, long val)
{
if (error) {
/* error is negative errno in this tree */
regs->r0 = (unsigned long)(-error); /* positive errno */
Annotation
- Immediate include surface: `uapi/linux/audit.h`, `linux/audit.h`, `linux/sched.h`, `linux/types.h`, `asm/ptrace.h`.
- Detected declarations: `function syscall_get_arch`, `function syscall_get_return_value`, `function syscall_get_nr`, `function syscall_set_nr`, `function syscall_get_arguments`, `function syscall_set_arguments`, `function r19`, `function syscall_rollback`.
- Atlas domain: Architecture Layer / arch/alpha.
- 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.