arch/arm64/kernel/sys32.c
Source file repositories/reference/linux-study-clean/arch/arm64/kernel/sys32.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm64/kernel/sys32.c- Extension
.c- Size
- 3700 bytes
- Lines
- 133
- Domain
- Architecture Layer
- Bucket
- arch/arm64
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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 uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/compat.hlinux/compiler.hlinux/syscalls.hasm/syscall.hasm/unistd_compat_32.hasm/syscall_table_32.h
Detected Declarations
function arg_u32pfunction arg_u32pfunction arg_u32pfunction arg_u32pfunction arg_u32pfunction arg_u32p
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* arch/arm64/kernel/sys32.c
*
* Copyright (C) 2015 ARM Ltd.
*/
#include <linux/compat.h>
#include <linux/compiler.h>
#include <linux/syscalls.h>
#include <asm/syscall.h>
#include <asm/unistd_compat_32.h>
asmlinkage long compat_sys_sigreturn(void);
asmlinkage long compat_sys_rt_sigreturn(void);
COMPAT_SYSCALL_DEFINE3(aarch32_statfs64, const char __user *, pathname,
compat_size_t, sz, struct compat_statfs64 __user *, buf)
{
/*
* 32-bit ARM applies an OABI compatibility fixup to statfs64 and
* fstatfs64 regardless of whether OABI is in use, and therefore
* arbitrary binaries may rely upon it, so we must do the same.
* For more details, see commit:
*
* 713c481519f19df9 ("[ARM] 3108/2: old ABI compat: statfs64 and
* fstatfs64")
*/
if (sz == 88)
sz = 84;
return kcompat_sys_statfs64(pathname, sz, buf);
}
COMPAT_SYSCALL_DEFINE3(aarch32_fstatfs64, unsigned int, fd, compat_size_t, sz,
struct compat_statfs64 __user *, buf)
{
/* see aarch32_statfs64 */
if (sz == 88)
sz = 84;
return kcompat_sys_fstatfs64(fd, sz, buf);
}
/*
* Note: off_4k is always in units of 4K. If we can't do the
* requested offset because it is not page-aligned, we return -EINVAL.
*/
COMPAT_SYSCALL_DEFINE6(aarch32_mmap2, unsigned long, addr, unsigned long, len,
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, off_4k)
{
if (off_4k & (~PAGE_MASK >> 12))
return -EINVAL;
off_4k >>= (PAGE_SHIFT - 12);
return ksys_mmap_pgoff(addr, len, prot, flags, fd, off_4k);
}
#ifdef CONFIG_CPU_BIG_ENDIAN
#define arg_u32p(name) u32, name##_hi, u32, name##_lo
#else
#define arg_u32p(name) u32, name##_lo, u32, name##_hi
#endif
#define arg_u64(name) (((u64)name##_hi << 32) | name##_lo)
COMPAT_SYSCALL_DEFINE6(aarch32_pread64, unsigned int, fd, char __user *, buf,
size_t, count, u32, __pad, arg_u32p(pos))
{
return ksys_pread64(fd, buf, count, arg_u64(pos));
}
COMPAT_SYSCALL_DEFINE6(aarch32_pwrite64, unsigned int, fd,
const char __user *, buf, size_t, count, u32, __pad,
arg_u32p(pos))
{
return ksys_pwrite64(fd, buf, count, arg_u64(pos));
}
COMPAT_SYSCALL_DEFINE4(aarch32_truncate64, const char __user *, pathname,
u32, __pad, arg_u32p(length))
{
return ksys_truncate(pathname, arg_u64(length));
}
COMPAT_SYSCALL_DEFINE4(aarch32_ftruncate64, unsigned int, fd, u32, __pad,
arg_u32p(length))
Annotation
- Immediate include surface: `linux/compat.h`, `linux/compiler.h`, `linux/syscalls.h`, `asm/syscall.h`, `asm/unistd_compat_32.h`, `asm/syscall_table_32.h`.
- Detected declarations: `function arg_u32p`, `function arg_u32p`, `function arg_u32p`, `function arg_u32p`, `function arg_u32p`, `function arg_u32p`.
- Atlas domain: Architecture Layer / arch/arm64.
- 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.