tools/include/nolibc/arch-sparc.h
Source file repositories/reference/linux-study-clean/tools/include/nolibc/arch-sparc.h
File Facts
- System
- Linux kernel
- Corpus path
tools/include/nolibc/arch-sparc.h- Extension
.h- Size
- 9091 bytes
- Lines
- 210
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source 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.
Dependency Surface
linux/unistd.hcompiler.hcrt.h
Detected Declarations
function __attribute__function __attribute__function __attribute__
Annotated Snippet
#ifndef _NOLIBC_ARCH_SPARC_H
#define _NOLIBC_ARCH_SPARC_H
#include <linux/unistd.h>
#include "compiler.h"
#include "crt.h"
/*
* Syscalls for SPARC:
* - registers are native word size
* - syscall number is passed in g1
* - arguments are in o0-o5
* - the system call is performed by calling a trap instruction
* - syscall return value is in o0
* - syscall error flag is in the carry bit of the processor status register
*/
#ifdef __arch64__
#define _NOLIBC_SYSCALL "t 0x6d\n" \
"bcs,a %%xcc, 1f\n" \
"sub %%g0, %%o0, %%o0\n" \
"1:\n"
#else
#define _NOLIBC_SYSCALL "t 0x10\n" \
"bcs,a 1f\n" \
"sub %%g0, %%o0, %%o0\n" \
"1:\n"
#endif /* __arch64__ */
#define __nolibc_syscall0(num) \
({ \
register long _num __asm__ ("g1") = (num); \
register long _arg1 __asm__ ("o0"); \
\
__asm__ volatile ( \
_NOLIBC_SYSCALL \
: "+r"(_arg1) \
: "r"(_num) \
: "memory", "cc" \
); \
_arg1; \
})
#define __nolibc_syscall1(num, arg1) \
({ \
register long _num __asm__ ("g1") = (num); \
register long _arg1 __asm__ ("o0") = (long)(arg1); \
\
__asm__ volatile ( \
_NOLIBC_SYSCALL \
: "+r"(_arg1) \
: "r"(_num) \
: "memory", "cc" \
); \
_arg1; \
})
#define __nolibc_syscall2(num, arg1, arg2) \
({ \
register long _num __asm__ ("g1") = (num); \
register long _arg1 __asm__ ("o0") = (long)(arg1); \
register long _arg2 __asm__ ("o1") = (long)(arg2); \
\
__asm__ volatile ( \
_NOLIBC_SYSCALL \
: "+r"(_arg1) \
: "r"(_arg2), "r"(_num) \
: "memory", "cc" \
); \
_arg1; \
})
#define __nolibc_syscall3(num, arg1, arg2, arg3) \
({ \
register long _num __asm__ ("g1") = (num); \
register long _arg1 __asm__ ("o0") = (long)(arg1); \
register long _arg2 __asm__ ("o1") = (long)(arg2); \
register long _arg3 __asm__ ("o2") = (long)(arg3); \
\
__asm__ volatile ( \
_NOLIBC_SYSCALL \
: "+r"(_arg1) \
: "r"(_arg2), "r"(_arg3), "r"(_num) \
: "memory", "cc" \
); \
Annotation
- Immediate include surface: `linux/unistd.h`, `compiler.h`, `crt.h`.
- Detected declarations: `function __attribute__`, `function __attribute__`, `function __attribute__`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source 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.