cregit-Linux how code gets into the kernel

Release 4.14 arch/metag/kernel/sys_metag.c

// SPDX-License-Identifier: GPL-2.0
/*
 * This file contains various random system calls that
 * have a non-standard calling sequence on the Linux/Meta
 * platform.
 */

#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/syscalls.h>
#include <linux/mman.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/unistd.h>
#include <asm/cacheflush.h>
#include <asm/core_reg.h>
#include <asm/global_lock.h>
#include <asm/switch.h>
#include <asm/syscall.h>
#include <asm/syscalls.h>
#include <asm/user_gateway.h>


#define merge_64(hi, lo) ((((unsigned long long)(hi)) << 32) + \
                          ((lo) & 0xffffffffUL))


int metag_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) { /* We can't have people trying to write to the bottom of the * memory map, there are mysterious unspecified things there that * we don't want people trampling on. */ if ((flags & MAP_FIXED) && (addr < TASK_UNMAPPED_BASE)) return -EINVAL; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan39100.00%1100.00%
Total39100.00%1100.00%


asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { /* The shift for mmap2 is constant, regardless of PAGE_SIZE setting. */ if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) return -EINVAL; pgoff >>= PAGE_SHIFT - 12; return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan75100.00%1100.00%
Total75100.00%1100.00%


asmlinkage int sys_metag_setglobalbit(char __user *addr, int mask) { char tmp; int ret = 0; unsigned int flags; if (!((__force unsigned int)addr >= LINCORE_BASE)) return -EFAULT; __global_lock2(flags); metag_data_cache_flush((__force void *)addr, sizeof(mask)); ret = __get_user(tmp, addr); if (ret) goto out; tmp |= mask; ret = __put_user(tmp, addr); metag_data_cache_flush((__force void *)addr, sizeof(mask)); out: __global_unlock2(flags); return ret; }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan118100.00%1100.00%
Total118100.00%1100.00%

#define TXDEFR_FPU_MASK ((0x1f << 16) | 0x1f)
asmlinkage void sys_metag_set_fpu_flags(unsigned int flags) { unsigned int temp; flags &= TXDEFR_FPU_MASK; temp = __core_reg_get(TXDEFR); temp &= ~TXDEFR_FPU_MASK; temp |= flags; __core_reg_set(TXDEFR, temp); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan41100.00%1100.00%
Total41100.00%1100.00%


asmlinkage int sys_metag_set_tls(void __user *ptr) { current->thread.tls_ptr = ptr; set_gateway_tls(ptr); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan27100.00%1100.00%
Total27100.00%1100.00%


asmlinkage void *sys_metag_get_tls(void) { return (__force void *)current->thread.tls_ptr; }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan21100.00%1100.00%
Total21100.00%1100.00%


asmlinkage long sys_truncate64_metag(const char __user *path, unsigned long lo, unsigned long hi) { return sys_truncate64(path, merge_64(hi, lo)); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan33100.00%1100.00%
Total33100.00%1100.00%


asmlinkage long sys_ftruncate64_metag(unsigned int fd, unsigned long lo, unsigned long hi) { return sys_ftruncate64(fd, merge_64(hi, lo)); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan31100.00%1100.00%
Total31100.00%1100.00%


asmlinkage long sys_fadvise64_64_metag(int fd, unsigned long offs_lo, unsigned long offs_hi, unsigned long len_lo, unsigned long len_hi, int advice) { return sys_fadvise64_64(fd, merge_64(offs_hi, offs_lo), merge_64(len_hi, len_lo), advice); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan50100.00%1100.00%
Total50100.00%1100.00%


asmlinkage long sys_readahead_metag(int fd, unsigned long lo, unsigned long hi, size_t count) { return sys_readahead(fd, merge_64(hi, lo), count); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan35100.00%1100.00%
Total35100.00%1100.00%


asmlinkage ssize_t sys_pread64_metag(unsigned long fd, char __user *buf, size_t count, unsigned long lo, unsigned long hi) { return sys_pread64(fd, buf, count, merge_64(hi, lo)); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan43100.00%1100.00%
Total43100.00%1100.00%


asmlinkage ssize_t sys_pwrite64_metag(unsigned long fd, char __user *buf, size_t count, unsigned long lo, unsigned long hi) { return sys_pwrite64(fd, buf, count, merge_64(hi, lo)); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan43100.00%1100.00%
Total43100.00%1100.00%


asmlinkage long sys_sync_file_range_metag(int fd, unsigned long offs_lo, unsigned long offs_hi, unsigned long len_lo, unsigned long len_hi, unsigned int flags) { return sys_sync_file_range(fd, merge_64(offs_hi, offs_lo), merge_64(len_hi, len_lo), flags); }

Contributors

PersonTokensPropCommitsCommitProp
James Hogan51100.00%1100.00%
Total51100.00%1100.00%

/* Provide the actual syscall number to call mapping. */ #undef __SYSCALL #define __SYSCALL(nr, call) [nr] = (call), /* * We need wrappers for anything with unaligned 64bit arguments */ #define sys_truncate64 sys_truncate64_metag #define sys_ftruncate64 sys_ftruncate64_metag #define sys_fadvise64_64 sys_fadvise64_64_metag #define sys_readahead sys_readahead_metag #define sys_pread64 sys_pread64_metag #define sys_pwrite64 sys_pwrite64_metag #define sys_sync_file_range sys_sync_file_range_metag /* * Note that we can't include <linux/unistd.h> here since the header * guard will defeat us; <asm/unistd.h> checks for __SYSCALL as well. */ const void *sys_call_table[__NR_syscalls] = { [0 ... __NR_syscalls-1] = sys_ni_syscall, #include <asm/unistd.h> };

Overall Contributors

PersonTokensPropCommitsCommitProp
James Hogan73699.86%150.00%
Greg Kroah-Hartman10.14%150.00%
Total737100.00%2100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.