arch/xtensa/kernel/syscall.c
Source file repositories/reference/linux-study-clean/arch/xtensa/kernel/syscall.c
File Facts
- System
- Linux kernel
- Corpus path
arch/xtensa/kernel/syscall.c- Extension
.c- Size
- 2436 bytes
- Lines
- 101
- Domain
- Architecture Layer
- Bucket
- arch/xtensa
- 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/uaccess.hasm/syscall.hlinux/linkage.hlinux/stringify.hlinux/errno.hlinux/syscalls.hlinux/file.hlinux/fs.hlinux/mman.hlinux/sched/mm.hlinux/shm.hasm/syscall_table.h
Detected Declarations
function xtensa_shmatfunction xtensa_fadvise64_64function arch_get_unmapped_area
Annotated Snippet
#include <linux/uaccess.h>
#include <asm/syscall.h>
#include <linux/linkage.h>
#include <linux/stringify.h>
#include <linux/errno.h>
#include <linux/syscalls.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/mman.h>
#include <linux/sched/mm.h>
#include <linux/shm.h>
syscall_t sys_call_table[] /* FIXME __cacheline_aligned */= {
#define __SYSCALL(nr, entry) (syscall_t)entry,
#include <asm/syscall_table.h>
};
#define COLOUR_ALIGN(addr, pgoff) \
((((addr) + SHMLBA - 1) & ~(SHMLBA - 1)) + \
(((pgoff) << PAGE_SHIFT) & (SHMLBA - 1)))
asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
{
unsigned long ret;
long err;
err = do_shmat(shmid, shmaddr, shmflg, &ret, SHMLBA);
if (err)
return err;
return (long)ret;
}
asmlinkage long xtensa_fadvise64_64(int fd, int advice,
unsigned long long offset, unsigned long long len)
{
return ksys_fadvise64_64(fd, offset, len, advice);
}
#ifdef CONFIG_MMU
unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
unsigned long len, unsigned long pgoff, unsigned long flags,
vm_flags_t vm_flags)
{
struct vm_area_struct *vmm;
struct vma_iterator vmi;
if (flags & MAP_FIXED) {
/* We do not accept a shared mapping if it would violate
* cache aliasing constraints.
*/
if ((flags & MAP_SHARED) &&
((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
return -EINVAL;
return addr;
}
if (len > TASK_SIZE)
return -ENOMEM;
if (!addr)
addr = TASK_UNMAPPED_BASE;
if (flags & MAP_SHARED)
addr = COLOUR_ALIGN(addr, pgoff);
else
addr = PAGE_ALIGN(addr);
vma_iter_init(&vmi, current->mm, addr);
for_each_vma(vmi, vmm) {
/* At this point: (addr < vmm->vm_end). */
if (addr + len <= vm_start_gap(vmm))
break;
addr = vmm->vm_end;
if (flags & MAP_SHARED)
addr = COLOUR_ALIGN(addr, pgoff);
}
if (TASK_SIZE - len < addr)
return -ENOMEM;
return addr;
}
#endif
Annotation
- Immediate include surface: `linux/uaccess.h`, `asm/syscall.h`, `linux/linkage.h`, `linux/stringify.h`, `linux/errno.h`, `linux/syscalls.h`, `linux/file.h`, `linux/fs.h`.
- Detected declarations: `function xtensa_shmat`, `function xtensa_fadvise64_64`, `function arch_get_unmapped_area`.
- Atlas domain: Architecture Layer / arch/xtensa.
- 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.