tools/include/nolibc/arch-sh.h
Source file repositories/reference/linux-study-clean/tools/include/nolibc/arch-sh.h
File Facts
- System
- Linux kernel
- Corpus path
tools/include/nolibc/arch-sh.h- Extension
.h- Size
- 8611 bytes
- Lines
- 165
- 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
compiler.hcrt.h
Detected Declarations
function __attribute__
Annotated Snippet
#ifndef _NOLIBC_ARCH_SH_H
#define _NOLIBC_ARCH_SH_H
#include "compiler.h"
#include "crt.h"
/*
* Syscalls for SuperH:
* - registers are 32bit wide
* - syscall number is passed in r3
* - arguments are in r4, r5, r6, r7, r0, r1, r2
* - the system call is performed by calling trapa #31
* - syscall return value is in r0
*/
#define __nolibc_syscall0(num) \
({ \
register long _num __asm__ ("r3") = (num); \
register long _ret __asm__ ("r0"); \
\
__asm__ volatile ( \
"trapa #31" \
: "=r"(_ret) \
: "r"(_num) \
: "memory", "cc" \
); \
_ret; \
})
#define __nolibc_syscall1(num, arg1) \
({ \
register long _num __asm__ ("r3") = (num); \
register long _ret __asm__ ("r0"); \
register long _arg1 __asm__ ("r4") = (long)(arg1); \
\
__asm__ volatile ( \
"trapa #31" \
: "=r"(_ret) \
: "r"(_num), "r"(_arg1) \
: "memory", "cc" \
); \
_ret; \
})
#define __nolibc_syscall2(num, arg1, arg2) \
({ \
register long _num __asm__ ("r3") = (num); \
register long _ret __asm__ ("r0"); \
register long _arg1 __asm__ ("r4") = (long)(arg1); \
register long _arg2 __asm__ ("r5") = (long)(arg2); \
\
__asm__ volatile ( \
"trapa #31" \
: "=r"(_ret) \
: "r"(_num), "r"(_arg1), "r"(_arg2) \
: "memory", "cc" \
); \
_ret; \
})
#define __nolibc_syscall3(num, arg1, arg2, arg3) \
({ \
register long _num __asm__ ("r3") = (num); \
register long _ret __asm__ ("r0"); \
register long _arg1 __asm__ ("r4") = (long)(arg1); \
register long _arg2 __asm__ ("r5") = (long)(arg2); \
register long _arg3 __asm__ ("r6") = (long)(arg3); \
\
__asm__ volatile ( \
"trapa #31" \
: "=r"(_ret) \
: "r"(_num), "r"(_arg1), "r"(_arg2), "r"(_arg3) \
: "memory", "cc" \
); \
_ret; \
})
#define __nolibc_syscall4(num, arg1, arg2, arg3, arg4) \
({ \
register long _num __asm__ ("r3") = (num); \
register long _ret __asm__ ("r0"); \
register long _arg1 __asm__ ("r4") = (long)(arg1); \
register long _arg2 __asm__ ("r5") = (long)(arg2); \
register long _arg3 __asm__ ("r6") = (long)(arg3); \
register long _arg4 __asm__ ("r7") = (long)(arg4); \
\
__asm__ volatile ( \
"trapa #31" \
: "=r"(_ret) \
: "r"(_num), "r"(_arg1), "r"(_arg2), "r"(_arg3), "r"(_arg4) \
Annotation
- Immediate include surface: `compiler.h`, `crt.h`.
- Detected declarations: `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.