arch/um/include/asm/syscall-generic.h
Source file repositories/reference/linux-study-clean/arch/um/include/asm/syscall-generic.h
File Facts
- System
- Linux kernel
- Corpus path
arch/um/include/asm/syscall-generic.h- Extension
.h- Size
- 2101 bytes
- Lines
- 87
- Domain
- Architecture Layer
- Bucket
- arch/um
- 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
asm/ptrace.hlinux/err.hlinux/sched.hsysdep/ptrace.h
Detected Declarations
function Copyrightfunction syscall_set_nrfunction syscall_rollbackfunction syscall_get_return_valuefunction syscall_set_return_valuefunction syscall_get_argumentsfunction syscall_set_arguments
Annotated Snippet
#ifndef __UM_SYSCALL_GENERIC_H
#define __UM_SYSCALL_GENERIC_H
#include <asm/ptrace.h>
#include <linux/err.h>
#include <linux/sched.h>
#include <sysdep/ptrace.h>
static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
{
return PT_REGS_SYSCALL_NR(regs);
}
static inline void syscall_set_nr(struct task_struct *task, struct pt_regs *regs, int nr)
{
PT_REGS_SYSCALL_NR(regs) = nr;
}
static inline void syscall_rollback(struct task_struct *task,
struct pt_regs *regs)
{
/* do nothing */
}
static inline long syscall_get_error(struct task_struct *task,
struct pt_regs *regs)
{
const long error = regs_return_value(regs);
return IS_ERR_VALUE(error) ? error : 0;
}
static inline long syscall_get_return_value(struct task_struct *task,
struct pt_regs *regs)
{
return regs_return_value(regs);
}
static inline void syscall_set_return_value(struct task_struct *task,
struct pt_regs *regs,
int error, long val)
{
PT_REGS_SET_SYSCALL_RETURN(regs, (long) error ?: val);
}
static inline void syscall_get_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned long *args)
{
const struct uml_pt_regs *r = ®s->regs;
*args++ = UPT_SYSCALL_ARG1(r);
*args++ = UPT_SYSCALL_ARG2(r);
*args++ = UPT_SYSCALL_ARG3(r);
*args++ = UPT_SYSCALL_ARG4(r);
*args++ = UPT_SYSCALL_ARG5(r);
*args = UPT_SYSCALL_ARG6(r);
}
static inline void syscall_set_arguments(struct task_struct *task,
struct pt_regs *regs,
const unsigned long *args)
{
struct uml_pt_regs *r = ®s->regs;
UPT_SYSCALL_ARG1(r) = *args++;
UPT_SYSCALL_ARG2(r) = *args++;
UPT_SYSCALL_ARG3(r) = *args++;
UPT_SYSCALL_ARG4(r) = *args++;
UPT_SYSCALL_ARG5(r) = *args++;
UPT_SYSCALL_ARG6(r) = *args;
}
/* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
#endif /* __UM_SYSCALL_GENERIC_H */
Annotation
- Immediate include surface: `asm/ptrace.h`, `linux/err.h`, `linux/sched.h`, `sysdep/ptrace.h`.
- Detected declarations: `function Copyright`, `function syscall_set_nr`, `function syscall_rollback`, `function syscall_get_return_value`, `function syscall_set_return_value`, `function syscall_get_arguments`, `function syscall_set_arguments`.
- Atlas domain: Architecture Layer / arch/um.
- 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.