Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
30286ef6
Commit
30286ef6
authored
Oct 17, 2005
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
powerpc: Merge syscalls.c and sys_ppc32.c.
Signed-off-by:
Paul Mackerras
<
paulus@samba.org
>
parent
30cd4a4e
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
147 additions
and
376 deletions
+147
-376
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/Makefile
+3
-3
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/sys_ppc32.c
+0
-48
arch/powerpc/kernel/syscalls.c
arch/powerpc/kernel/syscalls.c
+134
-46
arch/powerpc/kernel/systbl.S
arch/powerpc/kernel/systbl.S
+3
-3
arch/ppc/kernel/Makefile
arch/ppc/kernel/Makefile
+1
-2
arch/ppc/kernel/syscalls.c
arch/ppc/kernel/syscalls.c
+0
-268
arch/ppc64/kernel/Makefile
arch/ppc64/kernel/Makefile
+2
-2
arch/ppc64/kernel/misc.S
arch/ppc64/kernel/misc.S
+4
-4
No files found.
arch/powerpc/kernel/Makefile
View file @
30286ef6
...
...
@@ -11,7 +11,7 @@ CFLAGS_btext.o += -fPIC
endif
obj-y
:=
semaphore.o cputable.o ptrace.o
obj-$(CONFIG_PPC64)
+=
binfmt_elf32.o
obj-$(CONFIG_PPC64)
+=
binfmt_elf32.o
sys_ppc32.o
obj-$(CONFIG_ALTIVEC)
+=
vecemu.o vector.o
obj-$(CONFIG_POWER4)
+=
idle_power4.o
obj-$(CONFIG_PPC_OF)
+=
of_device.o
...
...
@@ -30,7 +30,7 @@ extra-$(CONFIG_PPC_FPU) += fpu.o
extra-y
+=
vmlinux.lds
obj-y
+=
process.o init_task.o
\
prom.o systbl.o traps.o
prom.o systbl.o traps.o
syscalls.o
obj-$(CONFIG_PPC32)
+=
entry_32.o setup_32.o misc_32.o
obj-$(CONFIG_PPC64)
+=
setup_64.o misc_64.o
obj-$(CONFIG_PPC_OF)
+=
prom_init.o
...
...
@@ -44,7 +44,7 @@ endif
else
# stuff used from here for ARCH=ppc or ARCH=ppc64
obj-$(CONFIG_PPC64)
+=
traps.o process.o init_task.o
obj-$(CONFIG_PPC64)
+=
traps.o process.o init_task.o
syscalls.o
fpux-$(CONFIG_PPC32)
+=
fpu.o
extra-$(CONFIG_PPC_FPU)
+=
$
(
fpux-y
)
...
...
arch/p
pc64
/kernel/sys_ppc32.c
→
arch/p
owerpc
/kernel/sys_ppc32.c
View file @
30286ef6
...
...
@@ -985,54 +985,6 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 __user *args)
}
#endif
asmlinkage
int
sys32_uname
(
struct
old_utsname
__user
*
name
)
{
int
err
=
0
;
down_read
(
&
uts_sem
);
if
(
copy_to_user
(
name
,
&
system_utsname
,
sizeof
(
*
name
)))
err
=
-
EFAULT
;
up_read
(
&
uts_sem
);
if
(
!
err
&&
personality
(
current
->
personality
)
==
PER_LINUX32
)
{
/* change "ppc64" to "ppc" */
if
(
__put_user
(
0
,
name
->
machine
+
3
)
||
__put_user
(
0
,
name
->
machine
+
4
))
err
=
-
EFAULT
;
}
return
err
;
}
asmlinkage
int
sys32_olduname
(
struct
oldold_utsname
__user
*
name
)
{
int
error
;
if
(
!
access_ok
(
VERIFY_WRITE
,
name
,
sizeof
(
struct
oldold_utsname
)))
return
-
EFAULT
;
down_read
(
&
uts_sem
);
error
=
__copy_to_user
(
&
name
->
sysname
,
&
system_utsname
.
sysname
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
sysname
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
nodename
,
&
system_utsname
.
nodename
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
nodename
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
release
,
&
system_utsname
.
release
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
release
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
version
,
&
system_utsname
.
version
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
version
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
machine
,
&
system_utsname
.
machine
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
machine
+
__OLD_UTS_LEN
);
if
(
personality
(
current
->
personality
)
==
PER_LINUX32
)
{
/* change "ppc64" to "ppc" */
error
|=
__put_user
(
0
,
name
->
machine
+
3
);
error
|=
__put_user
(
0
,
name
->
machine
+
4
);
}
up_read
(
&
uts_sem
);
error
=
error
?
-
EFAULT
:
0
;
return
error
;
}
unsigned
long
sys32_mmap2
(
unsigned
long
addr
,
size_t
len
,
unsigned
long
prot
,
unsigned
long
flags
,
unsigned
long
fd
,
unsigned
long
pgoff
)
...
...
arch/p
pc64
/kernel/syscalls.c
→
arch/p
owerpc
/kernel/syscalls.c
View file @
30286ef6
/*
*
linux/arch/ppc64/kernel/sys_ppc.c
*
Implementation of various system calls for Linux/PowerPC
*
* PowerPC version
* Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
*
* Derived from "arch/i386/kernel/sys_i386.c"
...
...
@@ -52,8 +51,7 @@ extern unsigned long wall_jiffies;
*
* This is really horribly ugly.
*/
asmlinkage
int
sys_ipc
(
uint
call
,
int
first
,
unsigned
long
second
,
long
third
,
int
sys_ipc
(
uint
call
,
int
first
,
unsigned
long
second
,
long
third
,
void
__user
*
ptr
,
long
fifth
)
{
int
version
,
ret
;
...
...
@@ -113,37 +111,25 @@ sys_ipc (uint call, int first, unsigned long second, long third,
}
break
;
case
MSGGET
:
ret
=
sys_msgget
((
key_t
)
first
,
(
int
)
second
);
ret
=
sys_msgget
((
key_t
)
first
,
(
int
)
second
);
break
;
case
MSGCTL
:
ret
=
sys_msgctl
(
first
,
(
int
)
second
,
(
struct
msqid_ds
__user
*
)
ptr
);
break
;
case
SHMAT
:
switch
(
version
)
{
default:
{
case
SHMAT
:
{
ulong
raddr
;
ret
=
do_shmat
(
first
,
(
char
__user
*
)
ptr
,
(
int
)
second
,
&
raddr
);
ret
=
do_shmat
(
first
,
(
char
__user
*
)
ptr
,
(
int
)
second
,
&
raddr
);
if
(
ret
)
break
;
ret
=
put_user
(
raddr
,
(
ulong
__user
*
)
third
);
ret
=
put_user
(
raddr
,
(
ulong
__user
*
)
third
);
break
;
}
case
1
:
/* iBCS2 emulator entry point */
ret
=
-
EINVAL
;
if
(
!
segment_eq
(
get_fs
(),
get_ds
()))
break
;
ret
=
do_shmat
(
first
,
(
char
__user
*
)
ptr
,
(
int
)
second
,
(
ulong
*
)
third
);
break
;
}
break
;
case
SHMDT
:
ret
=
sys_shmdt
((
char
__user
*
)
ptr
);
ret
=
sys_shmdt
((
char
__user
*
)
ptr
);
break
;
case
SHMGET
:
ret
=
sys_shmget
(
first
,
(
size_t
)
second
,
third
);
ret
=
sys_shmget
(
first
,
(
size_t
)
second
,
third
);
break
;
case
SHMCTL
:
ret
=
sys_shmctl
(
first
,
(
int
)
second
,
...
...
@@ -158,7 +144,7 @@ sys_ipc (uint call, int first, unsigned long second, long third,
* sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way unix traditionally does this, though.
*/
asmlinkage
int
sys_pipe
(
int
__user
*
fildes
)
int
sys_pipe
(
int
__user
*
fildes
)
{
int
fd
[
2
];
int
error
;
...
...
@@ -168,33 +154,79 @@ asmlinkage int sys_pipe(int __user *fildes)
if
(
copy_to_user
(
fildes
,
fd
,
2
*
sizeof
(
int
)))
error
=
-
EFAULT
;
}
return
error
;
}
unsigned
long
sys_mmap
(
unsigned
long
addr
,
size_t
len
,
static
inline
unsigned
long
do_mmap2
(
unsigned
long
addr
,
size_t
len
,
unsigned
long
prot
,
unsigned
long
flags
,
unsigned
long
fd
,
off_t
offse
t
)
unsigned
long
fd
,
unsigned
long
off
,
int
shif
t
)
{
struct
file
*
file
=
NULL
;
unsigned
long
ret
=
-
EBADF
;
int
ret
=
-
EINVAL
;
if
(
shift
)
{
if
(
off
&
((
1
<<
shift
)
-
1
))
goto
out
;
off
>>=
shift
;
}
ret
=
-
EBADF
;
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
if
(
!
(
file
=
fget
(
fd
)))
goto
out
;
}
flags
&=
~
(
MAP_EXECUTABLE
|
MAP_DENYWRITE
);
down_write
(
&
current
->
mm
->
mmap_sem
);
ret
=
do_mmap
(
file
,
addr
,
len
,
prot
,
flags
,
offset
);
ret
=
do_mmap
_pgoff
(
file
,
addr
,
len
,
prot
,
flags
,
off
);
up_write
(
&
current
->
mm
->
mmap_sem
);
if
(
file
)
fput
(
file
);
out:
return
ret
;
}
unsigned
long
sys_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
);
}
unsigned
long
sys_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_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
;
...
...
@@ -207,8 +239,25 @@ long ppc64_personality(unsigned long personality)
ret
=
PER_LINUX
;
return
ret
;
}
#endif
#ifdef CONFIG_PPC64
#define OVERRIDE_MACHINE (personality(current->personality) == PER_LINUX32)
#else
#define OVERRIDE_MACHINE 0
#endif
static
inline
int
override_machine
(
char
*
mach
)
{
if
(
OVERRIDE_MACHINE
)
{
/* change ppc64 to ppc */
if
(
__put_user
(
0
,
mach
+
3
)
||
__put_user
(
0
,
mach
+
4
))
return
-
EFAULT
;
}
return
0
;
}
long
ppc
64
_newuname
(
struct
new_utsname
__user
*
name
)
long
ppc_newuname
(
struct
new_utsname
__user
*
name
)
{
int
err
=
0
;
...
...
@@ -216,16 +265,54 @@ long ppc64_newuname(struct new_utsname __user * name)
if
(
copy_to_user
(
name
,
&
system_utsname
,
sizeof
(
*
name
)))
err
=
-
EFAULT
;
up_read
(
&
uts_sem
);
if
(
!
err
&&
personality
(
current
->
personality
)
==
PER_LINUX32
)
{
/* change ppc64 to ppc */
if
(
__put_user
(
0
,
name
->
machine
+
3
)
||
__put_user
(
0
,
name
->
machine
+
4
))
if
(
!
err
)
err
=
override_machine
(
name
->
machine
);
return
err
;
}
int
sys_uname
(
struct
old_utsname
__user
*
name
)
{
int
err
=
0
;
down_read
(
&
uts_sem
);
if
(
copy_to_user
(
name
,
&
system_utsname
,
sizeof
(
*
name
)))
err
=
-
EFAULT
;
}
up_read
(
&
uts_sem
);
if
(
!
err
)
err
=
override_machine
(
name
->
machine
);
return
err
;
}
asmlinkage
time_t
sys64_time
(
time_t
__user
*
tloc
)
int
sys_olduname
(
struct
oldold_utsname
__user
*
name
)
{
int
error
;
if
(
!
access_ok
(
VERIFY_WRITE
,
name
,
sizeof
(
struct
oldold_utsname
)))
return
-
EFAULT
;
down_read
(
&
uts_sem
);
error
=
__copy_to_user
(
&
name
->
sysname
,
&
system_utsname
.
sysname
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
sysname
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
nodename
,
&
system_utsname
.
nodename
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
nodename
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
release
,
&
system_utsname
.
release
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
release
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
version
,
&
system_utsname
.
version
,
__OLD_UTS_LEN
);
error
|=
__put_user
(
0
,
name
->
version
+
__OLD_UTS_LEN
);
error
|=
__copy_to_user
(
&
name
->
machine
,
&
system_utsname
.
machine
,
__OLD_UTS_LEN
);
error
|=
override_machine
(
name
->
machine
);
up_read
(
&
uts_sem
);
return
error
?
-
EFAULT
:
0
;
}
#ifdef CONFIG_PPC64
time_t
sys64_time
(
time_t
__user
*
tloc
)
{
time_t
secs
;
time_t
usecs
;
...
...
@@ -247,6 +334,7 @@ asmlinkage time_t sys64_time(time_t __user * tloc)
return
secs
;
}
#endif
void
do_show_syscall
(
unsigned
long
r3
,
unsigned
long
r4
,
unsigned
long
r5
,
unsigned
long
r6
,
unsigned
long
r7
,
unsigned
long
r8
,
...
...
arch/powerpc/kernel/systbl.S
View file @
30286ef6
...
...
@@ -102,7 +102,7 @@ COMPAT_SYS(fcntl)
SYSCALL
(
ni_syscall
)
SYSCALL32
(
setpgid
)
SYSCALL
(
ni_syscall
)
SYS
32ONLY
(
olduname
)
SYS
X
(
sys_ni_syscall
,
sys_olduname
,
sys_
olduname
)
SYSCALL32
(
umask
)
SYSCALL
(
chroot
)
SYSCALL
(
ustat
)
...
...
@@ -152,7 +152,7 @@ COMPAT_SYS(getitimer)
COMPAT_SYS
(
newstat
)
COMPAT_SYS
(
newlstat
)
COMPAT_SYS
(
newfstat
)
SYSX
(
sys_ni_syscall
,
sys
32
_uname
,
sys_uname
)
SYSX
(
sys_ni_syscall
,
sys_uname
,
sys_uname
)
SYSCALL
(
ni_syscall
)
SYSCALL
(
vhangup
)
SYSCALL
(
ni_syscall
)
...
...
@@ -165,7 +165,7 @@ SYSCALL(fsync)
SYSX
(
sys_ni_syscall
,
ppc32_sigreturn
,
sys_sigreturn
)
PPC_SYS
(
clone
)
SYSCALL32
(
setdomainname
)
SYSX
(
ppc64_newuname
,
ppc64_newuname
,
sys_
newuname
)
PPC_SYS
(
newuname
)
SYSCALL
(
ni_syscall
)
SYSCALL32
(
adjtimex
)
SYSCALL
(
mprotect
)
...
...
arch/ppc/kernel/Makefile
View file @
30286ef6
...
...
@@ -38,8 +38,7 @@ endif
else
obj-y
:=
irq.o idle.o time.o
\
signal.o align.o
\
syscalls.o perfmon.o
signal.o align.o perfmon.o
obj-$(CONFIG_6xx)
+=
l2cr.o cpu_setup_6xx.o
obj-$(CONFIG_SOFTWARE_SUSPEND)
+=
swsusp.o
obj-$(CONFIG_MODULES)
+=
module.o
...
...
arch/ppc/kernel/syscalls.c
deleted
100644 → 0
View file @
30cd4a4e
/*
* arch/ppc/kernel/sys_ppc.c
*
* PowerPC version
* 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/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/stat.h>
#include <linux/syscalls.h>
#include <linux/mman.h>
#include <linux/sys.h>
#include <linux/ipc.h>
#include <linux/utsname.h>
#include <linux/file.h>
#include <linux/unistd.h>
#include <asm/uaccess.h>
#include <asm/ipc.h>
#include <asm/semaphore.h>
/*
* sys_ipc() is the de-multiplexer for the SysV IPC calls..
*
* This is really horribly ugly.
*/
int
sys_ipc
(
uint
call
,
int
first
,
int
second
,
int
third
,
void
__user
*
ptr
,
long
fifth
)
{
int
version
,
ret
;
version
=
call
>>
16
;
/* hack for backward compatibility */
call
&=
0xffff
;
ret
=
-
ENOSYS
;
switch
(
call
)
{
case
SEMOP
:
ret
=
sys_semtimedop
(
first
,
(
struct
sembuf
__user
*
)
ptr
,
second
,
NULL
);
break
;
case
SEMTIMEDOP
:
ret
=
sys_semtimedop
(
first
,
(
struct
sembuf
__user
*
)
ptr
,
second
,
(
const
struct
timespec
__user
*
)
fifth
);
break
;
case
SEMGET
:
ret
=
sys_semget
(
first
,
second
,
third
);
break
;
case
SEMCTL
:
{
union
semun
fourth
;
if
(
!
ptr
)
break
;
if
((
ret
=
access_ok
(
VERIFY_READ
,
ptr
,
sizeof
(
long
))
?
0
:
-
EFAULT
)
||
(
ret
=
get_user
(
fourth
.
__pad
,
(
void
__user
*
__user
*
)
ptr
)))
break
;
ret
=
sys_semctl
(
first
,
second
,
third
,
fourth
);
break
;
}
case
MSGSND
:
ret
=
sys_msgsnd
(
first
,
(
struct
msgbuf
__user
*
)
ptr
,
second
,
third
);
break
;
case
MSGRCV
:
switch
(
version
)
{
case
0
:
{
struct
ipc_kludge
tmp
;
if
(
!
ptr
)
break
;
if
((
ret
=
access_ok
(
VERIFY_READ
,
ptr
,
sizeof
(
tmp
))
?
0
:
-
EFAULT
)
||
(
ret
=
copy_from_user
(
&
tmp
,
(
struct
ipc_kludge
__user
*
)
ptr
,
sizeof
(
tmp
))
?
-
EFAULT
:
0
))
break
;
ret
=
sys_msgrcv
(
first
,
tmp
.
msgp
,
second
,
tmp
.
msgtyp
,
third
);
break
;
}
default:
ret
=
sys_msgrcv
(
first
,
(
struct
msgbuf
__user
*
)
ptr
,
second
,
fifth
,
third
);
break
;
}
break
;
case
MSGGET
:
ret
=
sys_msgget
((
key_t
)
first
,
second
);
break
;
case
MSGCTL
:
ret
=
sys_msgctl
(
first
,
second
,
(
struct
msqid_ds
__user
*
)
ptr
);
break
;
case
SHMAT
:
{
ulong
raddr
;
if
((
ret
=
access_ok
(
VERIFY_WRITE
,
(
ulong
__user
*
)
third
,
sizeof
(
ulong
))
?
0
:
-
EFAULT
))
break
;
ret
=
do_shmat
(
first
,
(
char
__user
*
)
ptr
,
second
,
&
raddr
);
if
(
ret
)
break
;
ret
=
put_user
(
raddr
,
(
ulong
__user
*
)
third
);
break
;
}
case
SHMDT
:
ret
=
sys_shmdt
((
char
__user
*
)
ptr
);
break
;
case
SHMGET
:
ret
=
sys_shmget
(
first
,
second
,
third
);
break
;
case
SHMCTL
:
ret
=
sys_shmctl
(
first
,
second
,
(
struct
shmid_ds
__user
*
)
ptr
);
break
;
}
return
ret
;
}
/*
* sys_pipe() is the normal C calling standard for creating
* a pipe. It's not the way unix traditionally does this, though.
*/
int
sys_pipe
(
int
__user
*
fildes
)
{
int
fd
[
2
];
int
error
;
error
=
do_pipe
(
fd
);
if
(
!
error
)
{
if
(
copy_to_user
(
fildes
,
fd
,
2
*
sizeof
(
int
)))
error
=
-
EFAULT
;
}
return
error
;
}
static
inline
unsigned
long
do_mmap2
(
unsigned
long
addr
,
size_t
len
,
unsigned
long
prot
,
unsigned
long
flags
,
unsigned
long
fd
,
unsigned
long
pgoff
)
{
struct
file
*
file
=
NULL
;
int
ret
=
-
EBADF
;
flags
&=
~
(
MAP_EXECUTABLE
|
MAP_DENYWRITE
);
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
if
(
!
(
file
=
fget
(
fd
)))
goto
out
;
}
down_write
(
&
current
->
mm
->
mmap_sem
);
ret
=
do_mmap_pgoff
(
file
,
addr
,
len
,
prot
,
flags
,
pgoff
);
up_write
(
&
current
->
mm
->
mmap_sem
);
if
(
file
)
fput
(
file
);
out:
return
ret
;
}
unsigned
long
sys_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
);
}
unsigned
long
sys_mmap
(
unsigned
long
addr
,
size_t
len
,
unsigned
long
prot
,
unsigned
long
flags
,
unsigned
long
fd
,
off_t
offset
)
{
int
err
=
-
EINVAL
;
if
(
offset
&
~
PAGE_MASK
)
goto
out
;
err
=
do_mmap2
(
addr
,
len
,
prot
,
flags
,
fd
,
offset
>>
PAGE_SHIFT
);
out:
return
err
;
}
/*
* 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
);
}
int
sys_uname
(
struct
old_utsname
__user
*
name
)
{
int
err
=
-
EFAULT
;
down_read
(
&
uts_sem
);
if
(
name
&&
!
copy_to_user
(
name
,
&
system_utsname
,
sizeof
(
*
name
)))
err
=
0
;
up_read
(
&
uts_sem
);
return
err
;
}
int
sys_olduname
(
struct
oldold_utsname
__user
*
name
)
{
int
error
;
if
(
!
name
)
return
-
EFAULT
;
if
(
!
access_ok
(
VERIFY_WRITE
,
name
,
sizeof
(
struct
oldold_utsname
)))
return
-
EFAULT
;
down_read
(
&
uts_sem
);
error
=
__copy_to_user
(
&
name
->
sysname
,
&
system_utsname
.
sysname
,
__OLD_UTS_LEN
);
error
-=
__put_user
(
0
,
name
->
sysname
+
__OLD_UTS_LEN
);
error
-=
__copy_to_user
(
&
name
->
nodename
,
&
system_utsname
.
nodename
,
__OLD_UTS_LEN
);
error
-=
__put_user
(
0
,
name
->
nodename
+
__OLD_UTS_LEN
);
error
-=
__copy_to_user
(
&
name
->
release
,
&
system_utsname
.
release
,
__OLD_UTS_LEN
);
error
-=
__put_user
(
0
,
name
->
release
+
__OLD_UTS_LEN
);
error
-=
__copy_to_user
(
&
name
->
version
,
&
system_utsname
.
version
,
__OLD_UTS_LEN
);
error
-=
__put_user
(
0
,
name
->
version
+
__OLD_UTS_LEN
);
error
-=
__copy_to_user
(
&
name
->
machine
,
&
system_utsname
.
machine
,
__OLD_UTS_LEN
);
error
=
__put_user
(
0
,
name
->
machine
+
__OLD_UTS_LEN
);
up_read
(
&
uts_sem
);
error
=
error
?
-
EFAULT
:
0
;
return
error
;
}
/*
* We put the arguments in a different order so we only use 6
* registers for arguments, rather than 7 as sys_fadvise64_64 needs
* (because `offset' goes in r5/r6).
*/
long
ppc_fadvise64_64
(
int
fd
,
int
advice
,
loff_t
offset
,
loff_t
len
)
{
return
sys_fadvise64_64
(
fd
,
offset
,
len
,
advice
);
}
arch/ppc64/kernel/Makefile
View file @
30286ef6
...
...
@@ -12,9 +12,9 @@ obj-y := setup.o entry.o misc.o prom.o
endif
obj-y
+=
irq.o idle.o dma.o
\
time.o signal.o
syscalls.o
\
time.o signal.o
\
align.o bitops.o pacaData.o
\
udbg.o
sys_ppc32.o
ioctl32.o
\
udbg.o ioctl32.o
\
ptrace32.o signal32.o rtc.o
\
cpu_setup_power4.o
\
iommu.o sysfs.o vdso.o pmc.o firmware.o
...
...
arch/ppc64/kernel/misc.S
View file @
30286ef6
...
...
@@ -980,7 +980,7 @@ _GLOBAL(sys_call_table32)
.
llong
.
sys_ni_syscall
/*
old
mpx
syscall
*/
.
llong
.
sys32_setpgid
.
llong
.
sys_ni_syscall
/*
old
ulimit
syscall
*/
.
llong
.
sys
32
_olduname
.
llong
.
sys_olduname
.
llong
.
sys32_umask
/*
60
*/
.
llong
.
sys_chroot
.
llong
.
sys_ustat
...
...
@@ -1030,7 +1030,7 @@ _GLOBAL(sys_call_table32)
.
llong
.
compat_sys_newstat
.
llong
.
compat_sys_newlstat
.
llong
.
compat_sys_newfstat
.
llong
.
sys
32
_uname
.
llong
.
sys_uname
.
llong
.
sys_ni_syscall
/*
110
old
iopl
syscall
*/
.
llong
.
sys_vhangup
.
llong
.
sys_ni_syscall
/*
old
idle
syscall
*/
...
...
@@ -1043,7 +1043,7 @@ _GLOBAL(sys_call_table32)
.
llong
.
ppc32_sigreturn
.
llong
.
ppc_clone
/*
120
*/
.
llong
.
sys32_setdomainname
.
llong
.
ppc
64
_newuname
.
llong
.
ppc_newuname
.
llong
.
sys_ni_syscall
/*
old
modify_ldt
syscall
*/
.
llong
.
sys32_adjtimex
.
llong
.
sys_mprotect
/*
125
*/
...
...
@@ -1324,7 +1324,7 @@ _GLOBAL(sys_call_table)
.
llong
.
sys_ni_syscall
.
llong
.
ppc_clone
/*
120
*/
.
llong
.
sys_setdomainname
.
llong
.
ppc
64
_newuname
.
llong
.
ppc_newuname
.
llong
.
sys_ni_syscall
/*
old
modify_ldt
syscall
*/
.
llong
.
sys_adjtimex
.
llong
.
sys_mprotect
/*
125
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment