Documentation/arch/powerpc/syscall64-abi.rst
Source file repositories/reference/linux-study-clean/Documentation/arch/powerpc/syscall64-abi.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/arch/powerpc/syscall64-abi.rst- Extension
.rst- Size
- 6600 bytes
- Lines
- 154
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: syscall or user/kernel boundary
- Status
- core implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or participates in a user/kernel boundary; inspect argument validation, copy_from_user/copy_to_user, credentials, and dispatch target.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
===============================================
Power Architecture 64-bit Linux system call ABI
===============================================
syscall
=======
Invocation
----------
The syscall is made with the sc instruction, and returns with execution
continuing at the instruction following the sc instruction.
If PPC_FEATURE2_SCV appears in the AT_HWCAP2 ELF auxiliary vector, the
scv 0 instruction is an alternative that may provide better performance,
with some differences to calling sequence.
syscall calling sequence\ [1]_ matches the Power Architecture 64-bit ELF ABI
specification C function calling sequence, including register preservation
rules, with the following differences.
.. [1] Some syscalls (typically low-level management functions) may have
different calling sequences (e.g., rt_sigreturn).
Parameters
----------
The system call number is specified in r0.
There is a maximum of 6 integer parameters to a syscall, passed in r3-r8.
Return value
------------
- For the sc instruction, both a value and an error condition are returned.
cr0.SO is the error condition, and r3 is the return value. When cr0.SO is
clear, the syscall succeeded and r3 is the return value. When cr0.SO is set,
the syscall failed and r3 is the error value (that normally corresponds to
errno).
- For the scv 0 instruction, the return value indicates failure if it is
-4095..-1 (i.e., it is >= -MAX_ERRNO (-4095) as an unsigned comparison),
in which case the error value is the negated return value.
Stack
-----
System calls do not modify the caller's stack frame. For example, the caller's
stack frame LR and CR save fields are not used.
Register preservation rules
---------------------------
Register preservation rules match the ELF ABI calling sequence with some
differences.
For the sc instruction, the differences from the ELF ABI are as follows:
+--------------+--------------------+-----------------------------------------+
| Register | Preservation Rules | Purpose |
+==============+====================+=========================================+
| r0 | Volatile | (System call number.) |
+--------------+--------------------+-----------------------------------------+
| r3 | Volatile | (Parameter 1, and return value.) |
+--------------+--------------------+-----------------------------------------+
| r4-r8 | Volatile | (Parameters 2-6.) |
+--------------+--------------------+-----------------------------------------+
| cr0 | Volatile | (cr0.SO is the return error condition.) |
+--------------+--------------------+-----------------------------------------+
| cr1, cr5-7 | Nonvolatile | |
+--------------+--------------------+-----------------------------------------+
| lr | Nonvolatile | |
+--------------+--------------------+-----------------------------------------+
For the scv 0 instruction, the differences from the ELF ABI are as follows:
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- 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.