📄 sys_ppc32.c
字号:
off_t ppc32_lseek(unsigned int fd, u32 offset, unsigned int origin){ /* sign extend n */ return sys_lseek(fd, (int)offset, origin);}/* Note: it is necessary to treat bufsiz as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_readlink(const char __user * path, char __user * buf, u32 bufsiz){ return sys_readlink(path, buf, (int)bufsiz);}/* Note: it is necessary to treat option as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_sched_get_priority_max(u32 policy){ return sys_sched_get_priority_max((int)policy);}/* Note: it is necessary to treat policy as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_sched_get_priority_min(u32 policy){ return sys_sched_get_priority_min((int)policy);}/* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_sched_getparam(u32 pid, struct sched_param __user *param){ return sys_sched_getparam((int)pid, param);}/* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_sched_getscheduler(u32 pid){ return sys_sched_getscheduler((int)pid);}/* Note: it is necessary to treat pid as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_sched_setparam(u32 pid, struct sched_param __user *param){ return sys_sched_setparam((int)pid, param);}/* Note: it is necessary to treat pid and policy as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_sched_setscheduler(u32 pid, u32 policy, struct sched_param __user *param){ return sys_sched_setscheduler((int)pid, (int)policy, param);}/* Note: it is necessary to treat len as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_setdomainname(char __user *name, u32 len){ return sys_setdomainname(name, (int)len);}/* Note: it is necessary to treat gidsetsize as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_setgroups(u32 gidsetsize, gid_t __user *grouplist){ return sys_setgroups((int)gidsetsize, grouplist);}asmlinkage long compat_sys_sethostname(char __user *name, u32 len){ /* sign extend len */ return sys_sethostname(name, (int)len);}/* Note: it is necessary to treat pid and pgid as unsigned ints, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_setpgid(u32 pid, u32 pgid){ return sys_setpgid((int)pid, (int)pgid);}long compat_sys_getpriority(u32 which, u32 who){ /* sign extend which and who */ return sys_getpriority((int)which, (int)who);}long compat_sys_setpriority(u32 which, u32 who, u32 niceval){ /* sign extend which, who and niceval */ return sys_setpriority((int)which, (int)who, (int)niceval);}long compat_sys_ioprio_get(u32 which, u32 who){ /* sign extend which and who */ return sys_ioprio_get((int)which, (int)who);}long compat_sys_ioprio_set(u32 which, u32 who, u32 ioprio){ /* sign extend which, who and ioprio */ return sys_ioprio_set((int)which, (int)who, (int)ioprio);}/* Note: it is necessary to treat newmask as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_ssetmask(u32 newmask){ return sys_ssetmask((int) newmask);}asmlinkage long compat_sys_syslog(u32 type, char __user * buf, u32 len){ /* sign extend len */ return sys_syslog(type, buf, (int)len);}/* Note: it is necessary to treat mask as an unsigned int, * with the corresponding cast to a signed int to insure that the * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) * and the register representation of a signed int (msr in 64-bit mode) is performed. */asmlinkage long compat_sys_umask(u32 mask){ return sys_umask((int)mask);}#ifdef CONFIG_SYSCTLstruct __sysctl_args32 { u32 name; int nlen; u32 oldval; u32 oldlenp; u32 newval; u32 newlen; u32 __unused[4];};asmlinkage long compat_sys_sysctl(struct __sysctl_args32 __user *args){ struct __sysctl_args32 tmp; int error; size_t oldlen; size_t __user *oldlenp = NULL; unsigned long addr = (((unsigned long)&args->__unused[0]) + 7) & ~7; if (copy_from_user(&tmp, args, sizeof(tmp))) return -EFAULT; if (tmp.oldval && tmp.oldlenp) { /* Duh, this is ugly and might not work if sysctl_args is in read-only memory, but do_sysctl does indirectly a lot of uaccess in both directions and we'd have to basically copy the whole sysctl.c here, and glibc's __sysctl uses rw memory for the structure anyway. */ oldlenp = (size_t __user *)addr; if (get_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp)) || put_user(oldlen, oldlenp)) return -EFAULT; } lock_kernel(); error = do_sysctl(compat_ptr(tmp.name), tmp.nlen, compat_ptr(tmp.oldval), oldlenp, compat_ptr(tmp.newval), tmp.newlen); unlock_kernel(); if (oldlenp) { if (!error) { if (get_user(oldlen, oldlenp) || put_user(oldlen, (compat_size_t __user *)compat_ptr(tmp.oldlenp))) error = -EFAULT; } copy_to_user(args->__unused, tmp.__unused, sizeof(tmp.__unused)); } return error;}#endifunsigned long compat_sys_mmap2(unsigned long addr, size_t len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff){ /* This should remain 12 even if PAGE_SIZE changes */ return sys_mmap(addr, len, prot, flags, fd, pgoff << 12);}long compat_sys_tgkill(u32 tgid, u32 pid, int sig){ /* sign extend tgid, pid */ return sys_tgkill((int)tgid, (int)pid, sig);}/* * long long munging: * The 32 bit ABI passes long longs in an odd even register pair. */compat_ssize_t compat_sys_pread64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 reg6, u32 poshi, u32 poslo){ return sys_pread64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);}compat_ssize_t compat_sys_pwrite64(unsigned int fd, char __user *ubuf, compat_size_t count, u32 reg6, u32 poshi, u32 poslo){ return sys_pwrite64(fd, ubuf, count, ((loff_t)poshi << 32) | poslo);}compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offhi, u32 offlo, u32 count){ return sys_readahead(fd, ((loff_t)offhi << 32) | offlo, count);}asmlinkage int compat_sys_truncate64(const char __user * path, u32 reg4, unsigned long high, unsigned long low){ return sys_truncate(path, (high << 32) | low);}asmlinkage int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long high, unsigned long low){ return sys_ftruncate(fd, (high << 32) | low);}long ppc32_lookup_dcookie(u32 cookie_high, u32 cookie_low, char __user *buf, size_t len){ return sys_lookup_dcookie((u64)cookie_high << 32 | cookie_low, buf, len);}long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, size_t len, int advice){ return sys_fadvise64(fd, (u64)offset_high << 32 | offset_low, len, advice);}long ppc32_timer_create(clockid_t clock, struct compat_sigevent __user *ev32, timer_t __user *timer_id){ sigevent_t event; timer_t t; long err; mm_segment_t savefs; if (ev32 == NULL) return sys_timer_create(clock, NULL, timer_id); if (get_compat_sigevent(&event, ev32)) return -EFAULT; if (!access_ok(VERIFY_WRITE, timer_id, sizeof(timer_t))) return -EFAULT; savefs = get_fs(); set_fs(KERNEL_DS); /* The __user pointer casts are valid due to the set_fs() */ err = sys_timer_create(clock, (sigevent_t __user *) &event, (timer_t __user *) &t); set_fs(savefs); if (err == 0) err = __put_user(t, timer_id); return err;}asmlinkage long compat_sys_add_key(const char __user *_type, const char __user *_description, const void __user *_payload, u32 plen, u32 ringid){ return sys_add_key(_type, _description, _payload, plen, ringid);}asmlinkage long compat_sys_request_key(const char __user *_type, const char __user *_description, const char __user *_callout_info, u32 destringid){ return sys_request_key(_type, _description, _callout_info, destringid);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -