Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
1
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
2479bfc
Documentation
LICENSES
arch
alpha
arc
arm
arm64
c6x
h8300
hexagon
ia64
m68k
microblaze
mips
nds32
nios2
openrisc
parisc
powerpc
boot
configs
crypto
include
kernel
trace
vdso32
vdso64
.gitignore
Makefile
align.c
asm-offsets.c
audit.c
btext.c
cacheinfo.c
cacheinfo.h
compat_audit.c
cpu_setup_44x.S
cpu_setup_6xx.S
cpu_setup_fsl_booke.S
cpu_setup_pa6t.S
cpu_setup_power.S
cpu_setup_ppc970.S
cputable.c
crash.c
crash_dump.c
dbell.c
dma-iommu.c
dma-swiotlb.c
dma.c
dt_cpu_ftrs.c
eeh.c
eeh_cache.c
eeh_dev.c
eeh_driver.c
eeh_event.c
eeh_pe.c
eeh_sysfs.c
entry_32.S
entry_64.S
epapr_hcalls.S
epapr_paravirt.c
exceptions-64e.S
exceptions-64s.S
fadump.c
firmware.c
fpu.S
fsl_booke_entry_mapping.S
head_32.S
head_40x.S
head_44x.S
head_64.S
head_8xx.S
head_booke.h
head_fsl_booke.S
hw_breakpoint.c
idle.c
idle_6xx.S
idle_book3e.S
idle_book3s.S
idle_e500.S
idle_power4.S
ima_kexec.c
io-workarounds.c
io.c
iomap.c
iommu.c
irq.c
isa-bridge.c
jump_label.c
kexec_elf_64.c
kgdb.c
kprobes-ftrace.c
kprobes.c
kvm.c
kvm_emul.S
l2cr_6xx.S
legacy_serial.c
machine_kexec.c
machine_kexec_32.c
machine_kexec_64.c
machine_kexec_file_64.c
mce.c
mce_power.c
misc.S
misc_32.S
misc_64.S
module.c
module.lds
module_32.c
module_64.c
msi.c
nvram_64.c
of_platform.c
optprobes.c
optprobes_head.S
paca.c
pci-common.c
pci-hotplug.c
pci_32.c
pci_64.c
pci_dn.c
pci_of_scan.c
pmc.c
ppc32.h
ppc_save_regs.S
proc_powerpc.c
process.c
prom.c
prom_init.c
prom_init_check.sh
prom_parse.c
ptrace.c
ptrace32.c
reloc_32.S
reloc_64.S
rtas-proc.c
rtas-rtc.c
rtas.c
rtas_flash.c
rtas_pci.c
rtasd.c
security.c
setup-common.c
setup.h
setup_32.c
setup_64.c
signal.c
signal.h
signal_32.c
signal_64.c
smp-tbsync.c
smp.c
stacktrace.c
suspend.c
swsusp.c
swsusp_32.S
swsusp_64.c
swsusp_asm64.S
swsusp_booke.S
sys_ppc32.c
syscalls.c
sysfs.c
systbl.S
systbl_chk.c
systbl_chk.sh
tau_6xx.c
time.c
tm.S
traps.c
udbg.c
udbg_16550.c
uprobes.c
vdso.c
vecemu.c
vector.S
vmlinux.lds.S
watchdog.c
kvm
lib
math-emu
mm
net
oprofile
perf
platforms
purgatory
sysdev
tools
xmon
Kconfig
Kconfig.debug
Makefile
Makefile.postlink
riscv
s390
sh
sparc
um
unicore32
x86
xtensa
.gitignore
Kconfig
block
certs
crypto
drivers
firmware
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
arch
/
powerpc
/
kernel
/
syscalls.c
Copy path
Blame
Blame
Latest commit
History
History
145 lines (129 loc) · 3.98 KB
Breadcrumbs
linux
/
arch
/
powerpc
/
kernel
/
syscalls.c
Top
File metadata and controls
Code
Blame
145 lines (129 loc) · 3.98 KB
Raw
/* * Implementation of various system calls for Linux/PowerPC * * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) * * Derived from "arch/i386/kernel/sys_i386.c" * Adapted from the i386 version by Gary Thomas * Modified by Cort Dougan (cort@cs.nmt.edu) * and Paul Mackerras (paulus@cs.anu.edu.au). * * This file contains various random system calls that * have a non-standard calling sequence on the Linux/PPC * platform. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #include <linux/errno.h> #include <linux/sched.h> #include <linux/syscalls.h> #include <linux/mm.h> #include <linux/fs.h> #include <linux/smp.h> #include <linux/sem.h> #include <linux/msg.h> #include <linux/shm.h> #include <linux/stat.h> #include <linux/mman.h> #include <linux/sys.h> #include <linux/ipc.h> #include <linux/utsname.h> #include <linux/file.h> #include <linux/personality.h> #include <linux/uaccess.h> #include <asm/syscalls.h> #include <asm/time.h> #include <asm/unistd.h> #include <asm/asm-prototypes.h> static inline long do_mmap2(unsigned long addr, size_t len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long off, int shift) { long ret = -EINVAL; if (!arch_validate_prot(prot, addr)) goto out; if (shift) { if (off & ((1 << shift) - 1)) goto out; off >>= shift; } ret = ksys_mmap_pgoff(addr, len, prot, flags, fd, off); out: return ret; } #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpragmas" #pragma GCC diagnostic ignored "-Wattribute-alias" 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); } 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); } #pragma GCC diagnostic pop #ifdef CONFIG_PPC32 /* * Due to some executables calling the wrong select we sometimes * get wrong args. This determines how the args are being passed * (a single ptr to them all args passed) then calls * sys_select() with the appropriate args. -- Cort */ int ppc_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp) { if ( (unsigned long)n >= 4096 ) { unsigned long __user *buffer = (unsigned long __user *)n; if (!access_ok(VERIFY_READ, buffer, 5*sizeof(unsigned long)) || __get_user(n, buffer) || __get_user(inp, ((fd_set __user * __user *)(buffer+1))) || __get_user(outp, ((fd_set __user * __user *)(buffer+2))) || __get_user(exp, ((fd_set __user * __user *)(buffer+3))) || __get_user(tvp, ((struct timeval __user * __user *)(buffer+4)))) return -EFAULT; } return sys_select(n, inp, outp, exp, tvp); } #endif #ifdef CONFIG_PPC64 long ppc64_personality(unsigned long personality) { long ret; if (personality(current->personality) == PER_LINUX32 && personality(personality) == PER_LINUX) personality = (personality & ~PER_MASK) | PER_LINUX32; ret = sys_personality(personality); if (personality(ret) == PER_LINUX32) ret = (ret & ~PER_MASK) | PER_LINUX; return ret; } #endif long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, u32 len_high, u32 len_low) { return ksys_fadvise64_64(fd, (u64)offset_high << 32 | offset_low, (u64)len_high << 32 | len_low, advice); } long sys_switch_endian(void) { struct thread_info *ti; 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; }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
You can’t perform that action at this time.