arch/powerpc/kernel/syscalls.c
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/syscalls.c
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/syscalls.c- Extension
.c- Size
- 3358 bytes
- Lines
- 128
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- 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
linux/errno.hlinux/sched.hlinux/syscalls.hlinux/mm.hlinux/fs.hlinux/smp.hlinux/sem.hlinux/msg.hlinux/shm.hlinux/stat.hlinux/mman.hlinux/sys.hlinux/ipc.hlinux/utsname.hlinux/file.hlinux/personality.hlinux/uaccess.hasm/syscalls.hasm/time.hasm/unistd.h
Detected Declarations
syscall mmap2syscall mmapsyscall ppc64_personalitysyscall ppc_fadvise64_64syscall switch_endianfunction Copyrightfunction do_ppc64_personality
Annotated Snippet
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, pgoff)
{
return do_mmap2(addr, len, prot, flags, fd, pgoff, PAGE_SHIFT-12);
}
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE6(mmap2,
unsigned long, addr, size_t, len,
unsigned long, prot, unsigned long, flags,
unsigned long, fd, unsigned long, off_4k)
{
return do_mmap2(addr, len, prot, flags, fd, off_4k, PAGE_SHIFT-12);
}
#endif
SYSCALL_DEFINE6(mmap, unsigned long, addr, size_t, len,
unsigned long, prot, unsigned long, flags,
unsigned long, fd, off_t, offset)
{
return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT);
}
#ifdef CONFIG_PPC64
static long do_ppc64_personality(unsigned long personality)
{
long ret;
if (personality(current->personality) == PER_LINUX32
&& personality(personality) == PER_LINUX)
personality = (personality & ~PER_MASK) | PER_LINUX32;
ret = ksys_personality(personality);
if (personality(ret) == PER_LINUX32)
ret = (ret & ~PER_MASK) | PER_LINUX;
return ret;
}
SYSCALL_DEFINE1(ppc64_personality, unsigned long, personality)
{
return do_ppc64_personality(personality);
}
#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE1(ppc64_personality, unsigned long, personality)
{
return do_ppc64_personality(personality);
}
#endif /* CONFIG_COMPAT */
#endif /* CONFIG_PPC64 */
SYSCALL_DEFINE6(ppc_fadvise64_64,
int, fd, int, advice, u32, offset_high, u32, offset_low,
u32, len_high, u32, len_low)
{
return ksys_fadvise64_64(fd, merge_64(offset_high, offset_low),
merge_64(len_high, len_low), advice);
}
SYSCALL_DEFINE0(switch_endian)
{
struct thread_info *ti;
regs_set_return_msr(current->thread.regs,
current->thread.regs->msr ^ MSR_LE);
/*
* Set TIF_RESTOREALL so that r3 isn't clobbered on return to
* userspace. That also has the effect of restoring the non-volatile
* GPRs, so we saved them on the way in here.
*/
ti = current_thread_info();
ti->flags |= _TIF_RESTOREALL;
return 0;
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched.h`, `linux/syscalls.h`, `linux/mm.h`, `linux/fs.h`, `linux/smp.h`, `linux/sem.h`, `linux/msg.h`.
- Detected declarations: `syscall mmap2`, `syscall mmap`, `syscall ppc64_personality`, `syscall ppc_fadvise64_64`, `syscall switch_endian`, `function Copyright`, `function do_ppc64_personality`.
- Atlas domain: Architecture Layer / arch/powerpc.
- 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.