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
Kirill Smelkov
linux
Commits
fe00f943
Commit
fe00f943
authored
Mar 01, 2005
by
Ralf Baechle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sparseify MIPS.
Signed-off-by:
Ralf Baechle
<
ralf@linux-mips.org
>
parent
14f18b7f
Changes
21
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
607 additions
and
585 deletions
+607
-585
arch/mips/Makefile
arch/mips/Makefile
+15
-0
arch/mips/kernel/i8259.c
arch/mips/kernel/i8259.c
+1
-1
arch/mips/kernel/irixelf.c
arch/mips/kernel/irixelf.c
+7
-7
arch/mips/kernel/irixinv.c
arch/mips/kernel/irixinv.c
+4
-3
arch/mips/kernel/irixsig.c
arch/mips/kernel/irixsig.c
+215
-193
arch/mips/kernel/process.c
arch/mips/kernel/process.c
+0
-8
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace.c
+2
-2
arch/mips/kernel/signal.c
arch/mips/kernel/signal.c
+8
-6
arch/mips/kernel/sysirix.c
arch/mips/kernel/sysirix.c
+235
-244
arch/mips/kernel/traps.c
arch/mips/kernel/traps.c
+12
-9
arch/mips/kernel/unaligned.c
arch/mips/kernel/unaligned.c
+5
-5
arch/mips/lib/csum_partial_copy.c
arch/mips/lib/csum_partial_copy.c
+1
-1
arch/mips/mm/c-r4k.c
arch/mips/mm/c-r4k.c
+4
-3
arch/mips/mm/cache.c
arch/mips/mm/cache.c
+5
-4
arch/mips/mm/fault.c
arch/mips/mm/fault.c
+2
-2
include/asm-mips/cacheflush.h
include/asm-mips/cacheflush.h
+2
-1
include/asm-mips/checksum.h
include/asm-mips/checksum.h
+3
-2
include/asm-mips/io.h
include/asm-mips/io.h
+14
-4
include/asm-mips/irq.h
include/asm-mips/irq.h
+1
-3
include/asm-mips/sibyte/sb1250.h
include/asm-mips/sibyte/sb1250.h
+1
-1
include/asm-mips/uaccess.h
include/asm-mips/uaccess.h
+70
-86
No files found.
arch/mips/Makefile
View file @
fe00f943
...
@@ -52,6 +52,21 @@ ifdef CONFIG_CROSSCOMPILE
...
@@ -52,6 +52,21 @@ ifdef CONFIG_CROSSCOMPILE
CROSS_COMPILE
:=
$
(
tool-prefix
)
CROSS_COMPILE
:=
$
(
tool-prefix
)
endif
endif
CHECKFLAGS-y
+=
-D__linux__
-D__mips__
\
-D_ABIO32
=
1
\
-D_ABIN32
=
2
\
-D_ABI64
=
3
CHECKFLAGS-$(CONFIG_32BIT)
+=
-D_MIPS_SIM
=
_ABIO32
\
-D_MIPS_SZLONG
=
32
\
-D__PTRDIFF_TYPE__
=
int
CHECKFLAGS-$(CONFIG_64BIT)
+=
-m64
-D_MIPS_SIM
=
_ABI64
\
-D_MIPS_SZLONG
=
64
\
-D__PTRDIFF_TYPE__
=
"long int"
CHECKFLAGS-$(CONFIG_CPU_BIG_ENDIAN)
+=
-D__MIPSEB__
CHECKFLAGS-$(CONFIG_CPU_LITTLE_ENDIAN)
+=
-D__MIPSEL__
CHECKFLAGS
=
$
(
CHECKFLAGS-y
)
ifdef
CONFIG_BUILD_ELF64
ifdef
CONFIG_BUILD_ELF64
gas-abi
=
64
gas-abi
=
64
ld-emul
=
$
(
64bit-emul
)
ld-emul
=
$
(
64bit-emul
)
...
...
arch/mips/kernel/i8259.c
View file @
fe00f943
...
@@ -321,7 +321,7 @@ void __init init_i8259_irqs (void)
...
@@ -321,7 +321,7 @@ void __init init_i8259_irqs (void)
for
(
i
=
0
;
i
<
16
;
i
++
)
{
for
(
i
=
0
;
i
<
16
;
i
++
)
{
irq_desc
[
i
].
status
=
IRQ_DISABLED
;
irq_desc
[
i
].
status
=
IRQ_DISABLED
;
irq_desc
[
i
].
action
=
0
;
irq_desc
[
i
].
action
=
NULL
;
irq_desc
[
i
].
depth
=
1
;
irq_desc
[
i
].
depth
=
1
;
irq_desc
[
i
].
handler
=
&
i8259A_irq_type
;
irq_desc
[
i
].
handler
=
&
i8259A_irq_type
;
}
}
...
...
arch/mips/kernel/irixelf.c
View file @
fe00f943
...
@@ -147,7 +147,7 @@ static void padzero(unsigned long elf_bss)
...
@@ -147,7 +147,7 @@ static void padzero(unsigned long elf_bss)
nbyte
=
elf_bss
&
(
PAGE_SIZE
-
1
);
nbyte
=
elf_bss
&
(
PAGE_SIZE
-
1
);
if
(
nbyte
)
{
if
(
nbyte
)
{
nbyte
=
PAGE_SIZE
-
nbyte
;
nbyte
=
PAGE_SIZE
-
nbyte
;
clear_user
((
void
*
)
elf_bss
,
nbyte
);
clear_user
((
void
__user
*
)
elf_bss
,
nbyte
);
}
}
}
}
...
@@ -878,10 +878,10 @@ static int load_irix_library(struct file *file)
...
@@ -878,10 +878,10 @@ static int load_irix_library(struct file *file)
* phdrs there are in the USER_PHDRP array. We return the vaddr the
* phdrs there are in the USER_PHDRP array. We return the vaddr the
* first phdr was successfully mapped to.
* first phdr was successfully mapped to.
*/
*/
unsigned
long
irix_mapelf
(
int
fd
,
struct
elf_phdr
*
user_phdrp
,
int
cnt
)
unsigned
long
irix_mapelf
(
int
fd
,
struct
elf_phdr
__user
*
user_phdrp
,
int
cnt
)
{
{
unsigned
long
type
,
vaddr
,
filesz
,
offset
,
flags
;
unsigned
long
type
,
vaddr
,
filesz
,
offset
,
flags
;
struct
elf_phdr
*
hp
;
struct
elf_phdr
__user
*
hp
;
struct
file
*
filp
;
struct
file
*
filp
;
int
i
,
retval
;
int
i
,
retval
;
...
@@ -968,9 +968,9 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
...
@@ -968,9 +968,9 @@ unsigned long irix_mapelf(int fd, struct elf_phdr *user_phdrp, int cnt)
/* These are the only things you should do on a core-file: use only these
/* These are the only things you should do on a core-file: use only these
* functions to write out all the necessary info.
* functions to write out all the necessary info.
*/
*/
static
int
dump_write
(
struct
file
*
file
,
const
void
*
addr
,
int
nr
)
static
int
dump_write
(
struct
file
*
file
,
const
void
__user
*
addr
,
int
nr
)
{
{
return
file
->
f_op
->
write
(
file
,
(
const
char
*
)
addr
,
nr
,
&
file
->
f_pos
)
==
nr
;
return
file
->
f_op
->
write
(
file
,
(
const
char
__user
*
)
addr
,
nr
,
&
file
->
f_pos
)
==
nr
;
}
}
static
int
dump_seek
(
struct
file
*
file
,
off_t
off
)
static
int
dump_seek
(
struct
file
*
file
,
off_t
off
)
...
@@ -1204,7 +1204,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
...
@@ -1204,7 +1204,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
len
=
current
->
mm
->
arg_end
-
current
->
mm
->
arg_start
;
len
=
current
->
mm
->
arg_end
-
current
->
mm
->
arg_start
;
len
=
len
>=
ELF_PRARGSZ
?
ELF_PRARGSZ
:
len
;
len
=
len
>=
ELF_PRARGSZ
?
ELF_PRARGSZ
:
len
;
(
void
*
)
copy_from_user
(
&
psinfo
.
pr_psargs
,
(
void
*
)
copy_from_user
(
&
psinfo
.
pr_psargs
,
(
const
char
*
)
current
->
mm
->
arg_start
,
len
);
(
const
char
__user
*
)
current
->
mm
->
arg_start
,
len
);
for
(
i
=
0
;
i
<
len
;
i
++
)
for
(
i
=
0
;
i
<
len
;
i
++
)
if
(
psinfo
.
pr_psargs
[
i
]
==
0
)
if
(
psinfo
.
pr_psargs
[
i
]
==
0
)
psinfo
.
pr_psargs
[
i
]
=
' '
;
psinfo
.
pr_psargs
[
i
]
=
' '
;
...
@@ -1301,7 +1301,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
...
@@ -1301,7 +1301,7 @@ static int irix_core_dump(long signr, struct pt_regs * regs, struct file *file)
#ifdef DEBUG
#ifdef DEBUG
printk
(
"elf_core_dump: writing %08lx %lx
\n
"
,
addr
,
len
);
printk
(
"elf_core_dump: writing %08lx %lx
\n
"
,
addr
,
len
);
#endif
#endif
DUMP_WRITE
((
void
*
)
addr
,
len
);
DUMP_WRITE
((
void
__user
*
)
addr
,
len
);
}
}
if
((
off_t
)
file
->
f_pos
!=
offset
)
{
if
((
off_t
)
file
->
f_pos
!=
offset
)
{
...
...
arch/mips/kernel/irixinv.c
View file @
fe00f943
...
@@ -30,10 +30,10 @@ void add_to_inventory (int class, int type, int controller, int unit, int state)
...
@@ -30,10 +30,10 @@ void add_to_inventory (int class, int type, int controller, int unit, int state)
inventory_items
++
;
inventory_items
++
;
}
}
int
dump_inventory_to_user
(
void
*
userbuf
,
int
size
)
int
dump_inventory_to_user
(
void
__user
*
userbuf
,
int
size
)
{
{
inventory_t
*
inv
=
&
inventory
[
0
];
inventory_t
*
inv
=
&
inventory
[
0
];
inventory_t
*
user
=
userbuf
;
inventory_t
__user
*
user
=
userbuf
;
int
v
;
int
v
;
if
(
!
access_ok
(
VERIFY_WRITE
,
userbuf
,
size
))
if
(
!
access_ok
(
VERIFY_WRITE
,
userbuf
,
size
))
...
@@ -41,7 +41,8 @@ int dump_inventory_to_user (void *userbuf, int size)
...
@@ -41,7 +41,8 @@ int dump_inventory_to_user (void *userbuf, int size)
for
(
v
=
0
;
v
<
inventory_items
;
v
++
){
for
(
v
=
0
;
v
<
inventory_items
;
v
++
){
inv
=
&
inventory
[
v
];
inv
=
&
inventory
[
v
];
copy_to_user
(
user
,
inv
,
sizeof
(
inventory_t
));
if
(
copy_to_user
(
user
,
inv
,
sizeof
(
inventory_t
)))
return
-
EFAULT
;
user
++
;
user
++
;
}
}
return
inventory_items
*
sizeof
(
inventory_t
);
return
inventory_items
*
sizeof
(
inventory_t
);
...
...
arch/mips/kernel/irixsig.c
View file @
fe00f943
...
@@ -76,36 +76,39 @@ static inline void dump_irix5_sigctx(struct sigctx_irix5 *c)
...
@@ -76,36 +76,39 @@ static inline void dump_irix5_sigctx(struct sigctx_irix5 *c)
}
}
#endif
#endif
static
void
setup_irix_frame
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
static
int
setup_irix_frame
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
int
signr
,
sigset_t
*
oldmask
)
int
signr
,
sigset_t
*
oldmask
)
{
{
struct
sigctx_irix5
__user
*
ctx
;
unsigned
long
sp
;
unsigned
long
sp
;
struct
sigctx_irix5
*
ctx
;
int
error
,
i
;
int
i
;
sp
=
regs
->
regs
[
29
];
sp
=
regs
->
regs
[
29
];
sp
-=
sizeof
(
struct
sigctx_irix5
);
sp
-=
sizeof
(
struct
sigctx_irix5
);
sp
&=
~
(
0xf
);
sp
&=
~
(
0xf
);
ctx
=
(
struct
sigctx_irix5
*
)
sp
;
ctx
=
(
struct
sigctx_irix5
__user
*
)
sp
;
if
(
!
access_ok
(
VERIFY_WRITE
,
ctx
,
sizeof
(
*
ctx
)))
if
(
!
access_ok
(
VERIFY_WRITE
,
ctx
,
sizeof
(
*
ctx
)))
goto
segv_and_exit
;
goto
segv_and_exit
;
__put_user
(
0
,
&
ctx
->
weird_fpu_thing
);
error
=
__put_user
(
0
,
&
ctx
->
weird_fpu_thing
);
__put_user
(
~
(
0x00000001
),
&
ctx
->
rmask
);
error
|=
__put_user
(
~
(
0x00000001
),
&
ctx
->
rmask
);
__put_user
(
0
,
&
ctx
->
regs
[
0
]);
error
|=
__put_user
(
0
,
&
ctx
->
regs
[
0
]);
for
(
i
=
1
;
i
<
32
;
i
++
)
for
(
i
=
1
;
i
<
32
;
i
++
)
__put_user
((
u64
)
regs
->
regs
[
i
],
&
ctx
->
regs
[
i
]);
error
|=
__put_user
((
u64
)
regs
->
regs
[
i
],
&
ctx
->
regs
[
i
]);
error
|=
__put_user
((
u64
)
regs
->
hi
,
&
ctx
->
hi
);
error
|=
__put_user
((
u64
)
regs
->
lo
,
&
ctx
->
lo
);
error
|=
__put_user
((
u64
)
regs
->
cp0_epc
,
&
ctx
->
pc
);
error
|=
__put_user
(
!!
used_math
(),
&
ctx
->
usedfp
);
error
|=
__put_user
((
u64
)
regs
->
cp0_cause
,
&
ctx
->
cp0_cause
);
error
|=
__put_user
((
u64
)
regs
->
cp0_badvaddr
,
&
ctx
->
cp0_badvaddr
);
__put_user
((
u64
)
regs
->
hi
,
&
ctx
->
hi
);
error
|=
__put_user
(
0
,
&
ctx
->
sstk_flags
);
/* XXX sigstack unimp... todo... */
__put_user
((
u64
)
regs
->
lo
,
&
ctx
->
lo
);
__put_user
((
u64
)
regs
->
cp0_epc
,
&
ctx
->
pc
);
__put_user
(
!!
used_math
(),
&
ctx
->
usedfp
);
__put_user
((
u64
)
regs
->
cp0_cause
,
&
ctx
->
cp0_cause
);
__put_user
((
u64
)
regs
->
cp0_badvaddr
,
&
ctx
->
cp0_badvaddr
);
__put_user
(
0
,
&
ctx
->
sstk_flags
);
/* XXX sigstack unimp... todo... */
error
|=
__copy_to_user
(
&
ctx
->
sigset
,
oldmask
,
sizeof
(
irix_sigset_t
))
?
-
EFAULT
:
0
;
__copy_to_user
(
&
ctx
->
sigset
,
oldmask
,
sizeof
(
irix_sigset_t
));
if
(
error
)
goto
segv_and_exit
;
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
dump_irix5_sigctx
(
ctx
);
dump_irix5_sigctx
(
ctx
);
...
@@ -117,13 +120,14 @@ static void setup_irix_frame(struct k_sigaction *ka, struct pt_regs *regs,
...
@@ -117,13 +120,14 @@ static void setup_irix_frame(struct k_sigaction *ka, struct pt_regs *regs,
regs
->
regs
[
7
]
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
regs
->
regs
[
7
]
=
(
unsigned
long
)
ka
->
sa
.
sa_handler
;
regs
->
regs
[
25
]
=
regs
->
cp0_epc
=
(
unsigned
long
)
ka
->
sa_restorer
;
regs
->
regs
[
25
]
=
regs
->
cp0_epc
=
(
unsigned
long
)
ka
->
sa_restorer
;
return
;
return
1
;
segv_and_exit:
segv_and_exit:
force_sigsegv
(
signr
,
current
);
force_sigsegv
(
signr
,
current
);
return
0
;
}
}
static
void
inline
static
int
inline
setup_irix_rt_frame
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
setup_irix_rt_frame
(
struct
k_sigaction
*
ka
,
struct
pt_regs
*
regs
,
int
signr
,
sigset_t
*
oldmask
,
siginfo_t
*
info
)
int
signr
,
sigset_t
*
oldmask
,
siginfo_t
*
info
)
{
{
...
@@ -131,9 +135,11 @@ setup_irix_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
...
@@ -131,9 +135,11 @@ setup_irix_rt_frame(struct k_sigaction * ka, struct pt_regs *regs,
do_exit
(
SIGSEGV
);
do_exit
(
SIGSEGV
);
}
}
static
inline
void
handle_signal
(
unsigned
long
sig
,
siginfo_t
*
info
,
static
inline
int
handle_signal
(
unsigned
long
sig
,
siginfo_t
*
info
,
struct
k_sigaction
*
ka
,
sigset_t
*
oldset
,
struct
pt_regs
*
regs
)
struct
k_sigaction
*
ka
,
sigset_t
*
oldset
,
struct
pt_regs
*
regs
)
{
{
int
ret
;
switch
(
regs
->
regs
[
0
])
{
switch
(
regs
->
regs
[
0
])
{
case
ERESTARTNOHAND
:
case
ERESTARTNOHAND
:
regs
->
regs
[
2
]
=
EINTR
;
regs
->
regs
[
2
]
=
EINTR
;
...
@@ -151,9 +157,9 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
...
@@ -151,9 +157,9 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
regs
->
regs
[
0
]
=
0
;
/* Don't deal with this again. */
regs
->
regs
[
0
]
=
0
;
/* Don't deal with this again. */
if
(
ka
->
sa
.
sa_flags
&
SA_SIGINFO
)
if
(
ka
->
sa
.
sa_flags
&
SA_SIGINFO
)
setup_irix_rt_frame
(
ka
,
regs
,
sig
,
oldset
,
info
);
ret
=
setup_irix_rt_frame
(
ka
,
regs
,
sig
,
oldset
,
info
);
else
else
setup_irix_frame
(
ka
,
regs
,
sig
,
oldset
);
ret
=
setup_irix_frame
(
ka
,
regs
,
sig
,
oldset
);
spin_lock_irq
(
&
current
->
sighand
->
siglock
);
spin_lock_irq
(
&
current
->
sighand
->
siglock
);
sigorsets
(
&
current
->
blocked
,
&
current
->
blocked
,
&
ka
->
sa
.
sa_mask
);
sigorsets
(
&
current
->
blocked
,
&
current
->
blocked
,
&
ka
->
sa
.
sa_mask
);
...
@@ -161,6 +167,8 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
...
@@ -161,6 +167,8 @@ static inline void handle_signal(unsigned long sig, siginfo_t *info,
sigaddset
(
&
current
->
blocked
,
sig
);
sigaddset
(
&
current
->
blocked
,
sig
);
recalc_sigpending
();
recalc_sigpending
();
spin_unlock_irq
(
&
current
->
sighand
->
siglock
);
spin_unlock_irq
(
&
current
->
sighand
->
siglock
);
return
ret
;
}
}
asmlinkage
int
do_irix_signal
(
sigset_t
*
oldset
,
struct
pt_regs
*
regs
)
asmlinkage
int
do_irix_signal
(
sigset_t
*
oldset
,
struct
pt_regs
*
regs
)
...
@@ -184,10 +192,8 @@ asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
...
@@ -184,10 +192,8 @@ asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
oldset
=
&
current
->
blocked
;
oldset
=
&
current
->
blocked
;
signr
=
get_signal_to_deliver
(
&
info
,
&
ka
,
regs
,
NULL
);
signr
=
get_signal_to_deliver
(
&
info
,
&
ka
,
regs
,
NULL
);
if
(
signr
>
0
)
{
if
(
signr
>
0
)
handle_signal
(
signr
,
&
info
,
&
ka
,
oldset
,
regs
);
return
handle_signal
(
signr
,
&
info
,
&
ka
,
oldset
,
regs
);
return
1
;
}
no_signal:
no_signal:
/*
/*
...
@@ -208,10 +214,11 @@ asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
...
@@ -208,10 +214,11 @@ asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
asmlinkage
void
asmlinkage
void
irix_sigreturn
(
struct
pt_regs
*
regs
)
irix_sigreturn
(
struct
pt_regs
*
regs
)
{
{
struct
sigctx_irix5
*
context
,
*
magic
;
struct
sigctx_irix5
__user
*
context
,
*
magic
;
unsigned
long
umask
,
mask
;
unsigned
long
umask
,
mask
;
u64
*
fregs
;
u64
*
fregs
;
int
sig
,
i
,
base
=
0
;
u32
usedfp
;
int
error
,
sig
,
i
,
base
=
0
;
sigset_t
blocked
;
sigset_t
blocked
;
/* Always make any pending restarted system calls return -EINTR */
/* Always make any pending restarted system calls return -EINTR */
...
@@ -220,8 +227,8 @@ irix_sigreturn(struct pt_regs *regs)
...
@@ -220,8 +227,8 @@ irix_sigreturn(struct pt_regs *regs)
if
(
regs
->
regs
[
2
]
==
1000
)
if
(
regs
->
regs
[
2
]
==
1000
)
base
=
1
;
base
=
1
;
context
=
(
struct
sigctx_irix5
*
)
regs
->
regs
[
base
+
4
];
context
=
(
struct
sigctx_irix5
__user
*
)
regs
->
regs
[
base
+
4
];
magic
=
(
struct
sigctx_irix5
*
)
regs
->
regs
[
base
+
5
];
magic
=
(
struct
sigctx_irix5
__user
*
)
regs
->
regs
[
base
+
5
];
sig
=
(
int
)
regs
->
regs
[
base
+
6
];
sig
=
(
int
)
regs
->
regs
[
base
+
6
];
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] IRIX sigreturn(scp[%p],ucp[%p],sig[%d])
\n
"
,
printk
(
"[%s:%d] IRIX sigreturn(scp[%p],ucp[%p],sig[%d])
\n
"
,
...
@@ -236,25 +243,31 @@ irix_sigreturn(struct pt_regs *regs)
...
@@ -236,25 +243,31 @@ irix_sigreturn(struct pt_regs *regs)
dump_irix5_sigctx
(
context
);
dump_irix5_sigctx
(
context
);
#endif
#endif
__get_user
(
regs
->
cp0_epc
,
&
context
->
pc
);
error
=
__get_user
(
regs
->
cp0_epc
,
&
context
->
pc
);
umask
=
context
->
rmask
;
mask
=
2
;
error
|=
__get_user
(
umask
,
&
context
->
rmask
);
mask
=
2
;
for
(
i
=
1
;
i
<
32
;
i
++
,
mask
<<=
1
)
{
for
(
i
=
1
;
i
<
32
;
i
++
,
mask
<<=
1
)
{
if
(
umask
&
mask
)
if
(
umask
&
mask
)
__get_user
(
regs
->
regs
[
i
],
&
context
->
regs
[
i
]);
error
|=
__get_user
(
regs
->
regs
[
i
],
&
context
->
regs
[
i
]);
}
}
__get_user
(
regs
->
hi
,
&
context
->
hi
);
error
|=
__get_user
(
regs
->
hi
,
&
context
->
hi
);
__get_user
(
regs
->
lo
,
&
context
->
lo
);
error
|=
__get_user
(
regs
->
lo
,
&
context
->
lo
);
if
((
umask
&
1
)
&&
context
->
usedfp
)
{
error
|=
__get_user
(
usedfp
,
&
context
->
usedfp
);
if
((
umask
&
1
)
&&
usedfp
)
{
fregs
=
(
u64
*
)
&
current
->
thread
.
fpu
;
fregs
=
(
u64
*
)
&
current
->
thread
.
fpu
;
for
(
i
=
0
;
i
<
32
;
i
++
)
for
(
i
=
0
;
i
<
32
;
i
++
)
fregs
[
i
]
=
(
u64
)
context
->
fpregs
[
i
]
;
error
|=
__get_user
(
fregs
[
i
],
&
context
->
fpregs
[
i
])
;
__get_user
(
current
->
thread
.
fpu
.
hard
.
fcr31
,
&
context
->
fpcsr
);
error
|=
__get_user
(
current
->
thread
.
fpu
.
hard
.
fcr31
,
&
context
->
fpcsr
);
}
}
/* XXX do sigstack crapola here... XXX */
/* XXX do sigstack crapola here... XXX */
if
(
__copy_from_user
(
&
blocked
,
&
context
->
sigset
,
sizeof
(
blocked
)))
error
|=
__copy_from_user
(
&
blocked
,
&
context
->
sigset
,
sizeof
(
blocked
))
?
-
EFAULT
:
0
;
if
(
error
)
goto
badframe
;
goto
badframe
;
sigdelsetmask
(
&
blocked
,
~
_BLOCKABLE
);
sigdelsetmask
(
&
blocked
,
~
_BLOCKABLE
);
...
@@ -296,8 +309,8 @@ static inline void dump_sigact_irix5(struct sigact_irix5 *p)
...
@@ -296,8 +309,8 @@ static inline void dump_sigact_irix5(struct sigact_irix5 *p)
#endif
#endif
asmlinkage
int
asmlinkage
int
irix_sigaction
(
int
sig
,
const
struct
sigaction
*
act
,
irix_sigaction
(
int
sig
,
const
struct
sigaction
__user
*
act
,
struct
sigaction
*
oact
,
void
*
trampoline
)
struct
sigaction
__user
*
oact
,
void
__user
*
trampoline
)
{
{
struct
k_sigaction
new_ka
,
old_ka
;
struct
k_sigaction
new_ka
,
old_ka
;
int
ret
;
int
ret
;
...
@@ -311,12 +324,16 @@ irix_sigaction(int sig, const struct sigaction *act,
...
@@ -311,12 +324,16 @@ irix_sigaction(int sig, const struct sigaction *act,
#endif
#endif
if
(
act
)
{
if
(
act
)
{
sigset_t
mask
;
sigset_t
mask
;
i
f
(
!
access_ok
(
VERIFY_READ
,
act
,
sizeof
(
*
act
))
||
i
nt
err
;
__get_user
(
new_ka
.
sa
.
sa_handler
,
&
act
->
sa_handler
)
||
__get_user
(
new_ka
.
sa
.
sa_flags
,
&
act
->
sa_flags
))
if
(
!
access_ok
(
VERIFY_READ
,
act
,
sizeof
(
*
act
)
))
return
-
EFAULT
;
return
-
EFAULT
;
err
=
__get_user
(
new_ka
.
sa
.
sa_handler
,
&
act
->
sa_handler
);
err
|=
__get_user
(
new_ka
.
sa
.
sa_flags
,
&
act
->
sa_flags
);
__copy_from_user
(
&
mask
,
&
act
->
sa_mask
,
sizeof
(
sigset_t
));
err
|=
__copy_from_user
(
&
mask
,
&
act
->
sa_mask
,
sizeof
(
sigset_t
))
?
-
EFAULT
:
0
;
if
(
err
)
return
err
;
/*
/*
* Hmmm... methinks IRIX libc always passes a valid trampoline
* Hmmm... methinks IRIX libc always passes a valid trampoline
...
@@ -330,30 +347,37 @@ irix_sigaction(int sig, const struct sigaction *act,
...
@@ -330,30 +347,37 @@ irix_sigaction(int sig, const struct sigaction *act,
ret
=
do_sigaction
(
sig
,
act
?
&
new_ka
:
NULL
,
oact
?
&
old_ka
:
NULL
);
ret
=
do_sigaction
(
sig
,
act
?
&
new_ka
:
NULL
,
oact
?
&
old_ka
:
NULL
);
if
(
!
ret
&&
oact
)
{
if
(
!
ret
&&
oact
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
oact
,
sizeof
(
*
oact
))
||
int
err
;
__put_user
(
old_ka
.
sa
.
sa_handler
,
&
oact
->
sa_handler
)
||
__put_user
(
old_ka
.
sa
.
sa_flags
,
&
oact
->
sa_flags
))
if
(
!
access_ok
(
VERIFY_WRITE
,
oact
,
sizeof
(
*
oact
)))
return
-
EFAULT
;
err
=
__put_user
(
old_ka
.
sa
.
sa_handler
,
&
oact
->
sa_handler
);
err
|=
__put_user
(
old_ka
.
sa
.
sa_flags
,
&
oact
->
sa_flags
);
err
|=
__copy_to_user
(
&
oact
->
sa_mask
,
&
old_ka
.
sa
.
sa_mask
,
sizeof
(
sigset_t
))
?
-
EFAULT
:
0
;
if
(
err
)
return
-
EFAULT
;
return
-
EFAULT
;
__copy_to_user
(
&
old_ka
.
sa
.
sa_mask
,
&
oact
->
sa_mask
,
sizeof
(
sigset_t
));
}
}
return
ret
;
return
ret
;
}
}
asmlinkage
int
irix_sigpending
(
irix_sigset_t
*
set
)
asmlinkage
int
irix_sigpending
(
irix_sigset_t
__user
*
set
)
{
{
return
do_sigpending
(
set
,
sizeof
(
*
set
));
return
do_sigpending
(
set
,
sizeof
(
*
set
));
}
}
asmlinkage
int
irix_sigprocmask
(
int
how
,
irix_sigset_t
*
new
,
irix_sigset_t
*
old
)
asmlinkage
int
irix_sigprocmask
(
int
how
,
irix_sigset_t
__user
*
new
,
irix_sigset_t
__user
*
old
)
{
{
sigset_t
oldbits
,
newbits
;
sigset_t
oldbits
,
newbits
;
if
(
new
)
{
if
(
new
)
{
if
(
!
access_ok
(
VERIFY_READ
,
new
,
sizeof
(
*
new
)))
if
(
!
access_ok
(
VERIFY_READ
,
new
,
sizeof
(
*
new
)))
return
-
EFAULT
;
return
-
EFAULT
;
__copy_from_user
(
&
newbits
,
new
,
sizeof
(
unsigned
long
)
*
4
);
if
(
__copy_from_user
(
&
newbits
,
new
,
sizeof
(
unsigned
long
)
*
4
))
return
-
EFAULT
;
sigdelsetmask
(
&
newbits
,
~
_BLOCKABLE
);
sigdelsetmask
(
&
newbits
,
~
_BLOCKABLE
);
spin_lock_irq
(
&
current
->
sighand
->
siglock
);
spin_lock_irq
(
&
current
->
sighand
->
siglock
);
...
@@ -381,20 +405,19 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t *new, irix_sigset_t *old)
...
@@ -381,20 +405,19 @@ asmlinkage int irix_sigprocmask(int how, irix_sigset_t *new, irix_sigset_t *old)
recalc_sigpending
();
recalc_sigpending
();
spin_unlock_irq
(
&
current
->
sighand
->
siglock
);
spin_unlock_irq
(
&
current
->
sighand
->
siglock
);
}
}
if
(
old
)
{
if
(
old
)
if
(
!
access_ok
(
VERIFY_WRITE
,
old
,
sizeof
(
*
old
)))
return
copy_to_user
(
old
,
&
current
->
blocked
,
return
-
EFAULT
;
sizeof
(
unsigned
long
)
*
4
)
?
-
EFAULT
:
0
;
__copy_to_user
(
old
,
&
current
->
blocked
,
sizeof
(
unsigned
long
)
*
4
);
}
return
0
;
return
0
;
}
}
asmlinkage
int
irix_sigsuspend
(
struct
pt_regs
*
regs
)
asmlinkage
int
irix_sigsuspend
(
struct
pt_regs
*
regs
)
{
{
sigset_t
*
uset
,
saveset
,
newset
;
sigset_t
saveset
,
newset
;
sigset_t
__user
*
uset
;
uset
=
(
sigset_t
*
)
regs
->
regs
[
4
];
uset
=
(
sigset_t
__user
*
)
regs
->
regs
[
4
];
if
(
copy_from_user
(
&
newset
,
uset
,
sizeof
(
sigset_t
)))
if
(
copy_from_user
(
&
newset
,
uset
,
sizeof
(
sigset_t
)))
return
-
EFAULT
;
return
-
EFAULT
;
sigdelsetmask
(
&
newset
,
~
_BLOCKABLE
);
sigdelsetmask
(
&
newset
,
~
_BLOCKABLE
);
...
@@ -440,12 +463,13 @@ struct irix5_siginfo {
...
@@ -440,12 +463,13 @@ struct irix5_siginfo {
}
stuff
;
}
stuff
;
};
};
asmlinkage
int
irix_sigpoll_sys
(
unsigned
long
*
set
,
struct
irix5_siginfo
*
info
,
asmlinkage
int
irix_sigpoll_sys
(
unsigned
long
__user
*
set
,
struct
timespec
*
tp
)
struct
irix5_siginfo
__user
*
info
,
struct
timespec
__user
*
tp
)
{
{
long
expire
=
MAX_SCHEDULE_TIMEOUT
;
long
expire
=
MAX_SCHEDULE_TIMEOUT
;
sigset_t
kset
;
sigset_t
kset
;
int
i
,
sig
,
error
,
timeo
=
0
;
int
i
,
sig
,
error
,
timeo
=
0
;
struct
timespec
ktp
;
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] irix_sigpoll_sys(%p,%p,%p)
\n
"
,
printk
(
"[%s:%d] irix_sigpoll_sys(%p,%p,%p)
\n
"
,
...
@@ -456,14 +480,8 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
...
@@ -456,14 +480,8 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
if
(
!
set
)
if
(
!
set
)
return
-
EINVAL
;
return
-
EINVAL
;
if
(
!
access_ok
(
VERIFY_READ
,
set
,
sizeof
(
kset
)))
{
if
(
copy_from_user
(
&
kset
,
set
,
sizeof
(
set
)))
error
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
}
__copy_from_user
(
&
kset
,
set
,
sizeof
(
set
));
if
(
error
)
goto
out
;
if
(
info
&&
clear_user
(
info
,
sizeof
(
*
info
)))
{
if
(
info
&&
clear_user
(
info
,
sizeof
(
*
info
)))
{
error
=
-
EFAULT
;
error
=
-
EFAULT
;
...
@@ -471,19 +489,21 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
...
@@ -471,19 +489,21 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
}
}
if
(
tp
)
{
if
(
tp
)
{
if
(
!
access_ok
(
VERIFY_READ
,
tp
,
sizeof
(
*
tp
)))
if
(
copy_from_user
(
&
ktp
,
tp
,
sizeof
(
*
tp
)))
return
-
EFAULT
;
return
-
EFAULT
;
if
(
!
tp
->
tv_sec
&&
!
tp
->
tv_nsec
)
{
error
=
-
EINVAL
;
if
(
!
ktp
.
tv_sec
&&
!
ktp
.
tv_nsec
)
goto
out
;
return
-
EINVAL
;
}
expire
=
timespec_to_jiffies
(
tp
)
+
(
tp
->
tv_sec
||
tp
->
tv_nsec
);
expire
=
timespec_to_jiffies
(
&
ktp
)
+
(
ktp
.
tv_sec
||
ktp
.
tv_nsec
);
}
}
while
(
1
)
{
while
(
1
)
{
long
tmp
=
0
;
long
tmp
=
0
;
expire
=
schedule_timeout_interruptible
(
expire
);
current
->
state
=
TASK_INTERRUPTIBLE
;
expire
=
schedule_timeout
(
expire
);
for
(
i
=
0
;
i
<=
4
;
i
++
)
for
(
i
=
0
;
i
<=
4
;
i
++
)
tmp
|=
(
current
->
pending
.
signal
.
sig
[
i
]
&
kset
.
sig
[
i
]);
tmp
|=
(
current
->
pending
.
signal
.
sig
[
i
]
&
kset
.
sig
[
i
]);
...
@@ -500,15 +520,14 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
...
@@ -500,15 +520,14 @@ asmlinkage int irix_sigpoll_sys(unsigned long *set, struct irix5_siginfo *info,
if
(
timeo
)
if
(
timeo
)
return
-
EAGAIN
;
return
-
EAGAIN
;
for
(
sig
=
1
;
i
<=
65
/* IRIX_NSIG */
;
sig
++
)
{
for
(
sig
=
1
;
i
<=
65
/* IRIX_NSIG */
;
sig
++
)
{
if
(
sigismember
(
&
kset
,
sig
))
if
(
sigismember
(
&
kset
,
sig
))
continue
;
continue
;
if
(
sigismember
(
&
current
->
pending
.
signal
,
sig
))
{
if
(
sigismember
(
&
current
->
pending
.
signal
,
sig
))
{
/* XXX need more than this... */
/* XXX need more than this... */
if
(
info
)
if
(
info
)
info
->
sig
=
sig
;
return
copy_to_user
(
&
info
->
sig
,
&
sig
,
sizeof
(
sig
));
error
=
0
;
return
0
;
goto
out
;
}
}
}
}
...
@@ -534,8 +553,9 @@ extern int getrusage(struct task_struct *, int, struct rusage __user *);
...
@@ -534,8 +553,9 @@ extern int getrusage(struct task_struct *, int, struct rusage __user *);
#define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG)
#define W_MASK (W_EXITED | W_TRAPPED | W_STOPPED | W_CONT | W_NOHANG)
asmlinkage
int
irix_waitsys
(
int
type
,
int
pid
,
struct
irix5_siginfo
*
info
,
asmlinkage
int
irix_waitsys
(
int
type
,
int
pid
,
int
options
,
struct
rusage
*
ru
)
struct
irix5_siginfo
__user
*
info
,
int
options
,
struct
rusage
__user
*
ru
)
{
{
int
flag
,
retval
;
int
flag
,
retval
;
DECLARE_WAITQUEUE
(
wait
,
current
);
DECLARE_WAITQUEUE
(
wait
,
current
);
...
@@ -543,28 +563,22 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
...
@@ -543,28 +563,22 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
struct
task_struct
*
p
;
struct
task_struct
*
p
;
struct
list_head
*
_p
;
struct
list_head
*
_p
;
if
(
!
info
)
{
if
(
!
info
)
retval
=
-
EINVAL
;
return
-
EINVAL
;
goto
out
;
}
if
(
!
access_ok
(
VERIFY_WRITE
,
info
,
sizeof
(
*
info
)))
if
(
!
access_ok
(
VERIFY_WRITE
,
info
,
sizeof
(
*
info
)))
{
return
-
EFAULT
;
retval
=
-
EFAULT
;
goto
out
;
if
(
ru
)
}
if
(
!
access_ok
(
VERIFY_WRITE
,
ru
,
sizeof
(
*
ru
)))
if
(
ru
)
{
return
-
EFAULT
;
if
(
!
access_ok
(
VERIFY_WRITE
,
ru
,
sizeof
(
*
ru
)))
{
retval
=
-
EFAULT
;
if
(
options
&
~
W_MASK
)
goto
out
;
return
-
EINVAL
;
}
}
if
(
type
!=
IRIX_P_PID
&&
type
!=
IRIX_P_PGID
&&
type
!=
IRIX_P_ALL
)
if
(
options
&
~
(
W_MASK
))
{
return
-
EINVAL
;
retval
=
-
EINVAL
;
goto
out
;
}
if
(
type
!=
IRIX_P_PID
&&
type
!=
IRIX_P_PGID
&&
type
!=
IRIX_P_ALL
)
{
retval
=
-
EINVAL
;
goto
out
;
}
add_wait_queue
(
&
current
->
signal
->
wait_chldexit
,
&
wait
);
add_wait_queue
(
&
current
->
signal
->
wait_chldexit
,
&
wait
);
repeat:
repeat:
flag
=
0
;
flag
=
0
;
...
@@ -595,18 +609,20 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
...
@@ -595,18 +609,20 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
add_parent
(
p
,
p
->
parent
);
add_parent
(
p
,
p
->
parent
);
write_unlock_irq
(
&
tasklist_lock
);
write_unlock_irq
(
&
tasklist_lock
);
retval
=
ru
?
getrusage
(
p
,
RUSAGE_BOTH
,
ru
)
:
0
;
retval
=
ru
?
getrusage
(
p
,
RUSAGE_BOTH
,
ru
)
:
0
;
if
(
!
retval
&&
ru
)
{
if
(
retval
)
retval
|=
__put_user
(
SIGCHLD
,
&
info
->
sig
);
goto
end_waitsys
;
retval
=
__put_user
(
SIGCHLD
,
&
info
->
sig
);
retval
|=
__put_user
(
0
,
&
info
->
code
);
retval
|=
__put_user
(
0
,
&
info
->
code
);
retval
|=
__put_user
(
p
->
pid
,
&
info
->
stuff
.
procinfo
.
pid
);
retval
|=
__put_user
(
p
->
pid
,
&
info
->
stuff
.
procinfo
.
pid
);
retval
|=
__put_user
((
p
->
exit_code
>>
8
)
&
0xff
,
retval
|=
__put_user
((
p
->
exit_code
>>
8
)
&
0xff
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
status
);
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
status
);
retval
|=
__put_user
(
p
->
utime
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
utime
);
retval
|=
__put_user
(
p
->
utime
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
utime
);
retval
|=
__put_user
(
p
->
stime
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
stime
);
retval
|=
__put_user
(
p
->
stime
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
stime
);
}
if
(
retval
)
if
(
!
retval
)
{
goto
end_waitsys
;
p
->
exit_code
=
0
;
p
->
exit_code
=
0
;
}
goto
end_waitsys
;
goto
end_waitsys
;
case
EXIT_ZOMBIE
:
case
EXIT_ZOMBIE
:
...
@@ -614,16 +630,18 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
...
@@ -614,16 +630,18 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
current
->
signal
->
cstime
+=
p
->
stime
+
p
->
signal
->
cstime
;
current
->
signal
->
cstime
+=
p
->
stime
+
p
->
signal
->
cstime
;
if
(
ru
!=
NULL
)
if
(
ru
!=
NULL
)
getrusage
(
p
,
RUSAGE_BOTH
,
ru
);
getrusage
(
p
,
RUSAGE_BOTH
,
ru
);
__put_user
(
SIGCHLD
,
&
info
->
sig
);
retval
=
__put_user
(
SIGCHLD
,
&
info
->
sig
);
__put_user
(
1
,
&
info
->
code
);
/* CLD_EXITED */
retval
|=
__put_user
(
1
,
&
info
->
code
);
/* CLD_EXITED */
__put_user
(
p
->
pid
,
&
info
->
stuff
.
procinfo
.
pid
);
retval
|=
__put_user
(
p
->
pid
,
&
info
->
stuff
.
procinfo
.
pid
);
__put_user
((
p
->
exit_code
>>
8
)
&
0xff
,
retval
|=
__put_user
((
p
->
exit_code
>>
8
)
&
0xff
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
status
);
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
status
);
__put_user
(
p
->
utime
,
retval
|=
__put_user
(
p
->
utime
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
utime
);
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
utime
);
__put_user
(
p
->
stime
,
retval
|=
__put_user
(
p
->
stime
,
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
stime
);
&
info
->
stuff
.
procinfo
.
procdata
.
child
.
stime
);
retval
=
0
;
if
(
retval
)
return
retval
;
if
(
p
->
real_parent
!=
p
->
parent
)
{
if
(
p
->
real_parent
!=
p
->
parent
)
{
write_lock_irq
(
&
tasklist_lock
);
write_lock_irq
(
&
tasklist_lock
);
remove_parent
(
p
);
remove_parent
(
p
);
...
@@ -656,7 +674,6 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
...
@@ -656,7 +674,6 @@ asmlinkage int irix_waitsys(int type, int pid, struct irix5_siginfo *info,
current
->
state
=
TASK_RUNNING
;
current
->
state
=
TASK_RUNNING
;
remove_wait_queue
(
&
current
->
signal
->
wait_chldexit
,
&
wait
);
remove_wait_queue
(
&
current
->
signal
->
wait_chldexit
,
&
wait
);
out:
return
retval
;
return
retval
;
}
}
...
@@ -675,39 +692,39 @@ struct irix5_context {
...
@@ -675,39 +692,39 @@ struct irix5_context {
asmlinkage
int
irix_getcontext
(
struct
pt_regs
*
regs
)
asmlinkage
int
irix_getcontext
(
struct
pt_regs
*
regs
)
{
{
int
i
,
base
=
0
;
int
error
,
i
,
base
=
0
;
struct
irix5_context
*
ctx
;
struct
irix5_context
__user
*
ctx
;
unsigned
long
flags
;
unsigned
long
flags
;
if
(
regs
->
regs
[
2
]
==
1000
)
if
(
regs
->
regs
[
2
]
==
1000
)
base
=
1
;
base
=
1
;
ctx
=
(
struct
irix5_context
*
)
regs
->
regs
[
base
+
4
];
ctx
=
(
struct
irix5_context
__user
*
)
regs
->
regs
[
base
+
4
];
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] irix_getcontext(%p)
\n
"
,
printk
(
"[%s:%d] irix_getcontext(%p)
\n
"
,
current
->
comm
,
current
->
pid
,
ctx
);
current
->
comm
,
current
->
pid
,
ctx
);
#endif
#endif
if
(
!
access_ok
(
VERIFY_WRITE
,
ctx
,
sizeof
(
*
ctx
)))
if
(
!
access_ok
(
VERIFY_WRITE
,
ctx
,
sizeof
(
*
ctx
)))
;
return
-
EFAULT
;
return
-
EFAULT
;
__put_user
(
current
->
thread
.
irix_oldctx
,
&
ctx
->
link
);
error
=
__put_user
(
current
->
thread
.
irix_oldctx
,
&
ctx
->
link
);
__copy_to_user
(
&
ctx
->
sigmask
,
&
current
->
blocked
,
sizeof
(
irix_sigset_t
))
;
error
|=
__copy_to_user
(
&
ctx
->
sigmask
,
&
current
->
blocked
,
sizeof
(
irix_sigset_t
))
?
-
EFAULT
:
0
;
/* XXX Do sigstack stuff someday... */
/* XXX Do sigstack stuff someday... */
__put_user
(
0
,
&
ctx
->
stack
.
sp
);
error
|=
__put_user
(
0
,
&
ctx
->
stack
.
sp
);
__put_user
(
0
,
&
ctx
->
stack
.
size
);
error
|=
__put_user
(
0
,
&
ctx
->
stack
.
size
);
__put_user
(
0
,
&
ctx
->
stack
.
flags
);
error
|=
__put_user
(
0
,
&
ctx
->
stack
.
flags
);
__put_user
(
0
,
&
ctx
->
weird_graphics_thing
);
error
|=
__put_user
(
0
,
&
ctx
->
weird_graphics_thing
);
__put_user
(
0
,
&
ctx
->
regs
[
0
]);
error
|=
__put_user
(
0
,
&
ctx
->
regs
[
0
]);
for
(
i
=
1
;
i
<
32
;
i
++
)
for
(
i
=
1
;
i
<
32
;
i
++
)
__put_user
(
regs
->
regs
[
i
],
&
ctx
->
regs
[
i
]);
error
|=
__put_user
(
regs
->
regs
[
i
],
&
ctx
->
regs
[
i
]);
__put_user
(
regs
->
lo
,
&
ctx
->
regs
[
32
]);
error
|=
__put_user
(
regs
->
lo
,
&
ctx
->
regs
[
32
]);
__put_user
(
regs
->
hi
,
&
ctx
->
regs
[
33
]);
error
|=
__put_user
(
regs
->
hi
,
&
ctx
->
regs
[
33
]);
__put_user
(
regs
->
cp0_cause
,
&
ctx
->
regs
[
34
]);
error
|=
__put_user
(
regs
->
cp0_cause
,
&
ctx
->
regs
[
34
]);
__put_user
(
regs
->
cp0_epc
,
&
ctx
->
regs
[
35
]);
error
|=
__put_user
(
regs
->
cp0_epc
,
&
ctx
->
regs
[
35
]);
flags
=
0x0f
;
flags
=
0x0f
;
if
(
!
used_math
())
{
if
(
!
used_math
())
{
...
@@ -716,119 +733,124 @@ asmlinkage int irix_getcontext(struct pt_regs *regs)
...
@@ -716,119 +733,124 @@ asmlinkage int irix_getcontext(struct pt_regs *regs)
/* XXX wheee... */
/* XXX wheee... */
printk
(
"Wheee, no code for saving IRIX FPU context yet.
\n
"
);
printk
(
"Wheee, no code for saving IRIX FPU context yet.
\n
"
);
}
}
__put_user
(
flags
,
&
ctx
->
flags
);
error
|=
__put_user
(
flags
,
&
ctx
->
flags
);
return
0
;
return
error
;
}
}
asmlinkage
unsigned
long
irix_setcontext
(
struct
pt_regs
*
regs
)
asmlinkage
void
irix_setcontext
(
struct
pt_regs
*
regs
)
{
{
int
error
,
base
=
0
;
struct
irix5_context
__user
*
ctx
;
struct
irix5_context
*
ctx
;
int
err
,
base
=
0
;
u32
flags
;
if
(
regs
->
regs
[
2
]
==
1000
)
if
(
regs
->
regs
[
2
]
==
1000
)
base
=
1
;
base
=
1
;
ctx
=
(
struct
irix5_context
*
)
regs
->
regs
[
base
+
4
];
ctx
=
(
struct
irix5_context
__user
*
)
regs
->
regs
[
base
+
4
];
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] irix_setcontext(%p)
\n
"
,
printk
(
"[%s:%d] irix_setcontext(%p)
\n
"
,
current
->
comm
,
current
->
pid
,
ctx
);
current
->
comm
,
current
->
pid
,
ctx
);
#endif
#endif
if
(
!
access_ok
(
VERIFY_READ
,
ctx
,
sizeof
(
*
ctx
)))
{
if
(
!
access_ok
(
VERIFY_READ
,
ctx
,
sizeof
(
*
ctx
)))
error
=
-
EFAULT
;
goto
segv_and_exit
;
goto
out
;
}
if
(
ctx
->
flags
&
0x02
)
{
err
=
__get_user
(
flags
,
&
ctx
->
flags
);
if
(
flags
&
0x02
)
{
/* XXX sigstack garbage, todo... */
/* XXX sigstack garbage, todo... */
printk
(
"Wheee, cannot do sigstack stuff in setcontext
\n
"
);
printk
(
"Wheee, cannot do sigstack stuff in setcontext
\n
"
);
}
}
if
(
ctx
->
flags
&
0x04
)
{
if
(
flags
&
0x04
)
{
int
i
;
int
i
;
/* XXX extra control block stuff... todo... */
/* XXX extra control block stuff... todo... */
for
(
i
=
1
;
i
<
32
;
i
++
)
for
(
i
=
1
;
i
<
32
;
i
++
)
regs
->
regs
[
i
]
=
ctx
->
regs
[
i
]
;
err
|=
__get_user
(
regs
->
regs
[
i
],
&
ctx
->
regs
[
i
])
;
regs
->
lo
=
ctx
->
regs
[
32
]
;
err
|=
__get_user
(
regs
->
lo
,
&
ctx
->
regs
[
32
])
;
regs
->
hi
=
ctx
->
regs
[
33
]
;
err
|=
__get_user
(
regs
->
hi
,
&
ctx
->
regs
[
33
])
;
regs
->
cp0_epc
=
ctx
->
regs
[
35
]
;
err
|=
__get_user
(
regs
->
cp0_epc
,
&
ctx
->
regs
[
35
])
;
}
}
if
(
ctx
->
flags
&
0x08
)
{
if
(
flags
&
0x08
)
/* XXX fpu context, blah... */
/* XXX fpu context, blah... */
printk
(
"Wheee, cannot restore FPU context yet...
\n
"
);
printk
(
KERN_ERR
"Wheee, cannot restore FPU context yet...
\n
"
);
}
current
->
thread
.
irix_oldctx
=
ctx
->
link
;
error
=
regs
->
regs
[
2
];
out:
err
|=
__get_user
(
current
->
thread
.
irix_oldctx
,
&
ctx
->
link
);
return
error
;
if
(
err
)
goto
segv_and_exit
;
/*
* Don't let your children do this ...
*/
if
(
current_thread_info
()
->
flags
&
TIF_SYSCALL_TRACE
)
do_syscall_trace
(
regs
,
1
);
__asm__
__volatile__
(
"move
\t
$29,%0
\n\t
"
"j
\t
syscall_exit"
:
/* no outputs */
:
"r"
(
&
regs
));
/* Unreached */
segv_and_exit:
force_sigsegv
(
SIGSEGV
,
current
);
}
}
struct
irix_sigstack
{
unsigned
long
sp
;
int
status
;
};
struct
irix_sigstack
{
unsigned
long
sp
;
int
status
;
};
asmlinkage
int
irix_sigstack
(
struct
irix_sigstack
*
new
,
struct
irix_sigstack
*
old
)
asmlinkage
int
irix_sigstack
(
struct
irix_sigstack
__user
*
new
,
struct
irix_sigstack
__user
*
old
)
{
{
int
error
=
-
EFAULT
;
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] irix_sigstack(%p,%p)
\n
"
,
printk
(
"[%s:%d] irix_sigstack(%p,%p)
\n
"
,
current
->
comm
,
current
->
pid
,
new
,
old
);
current
->
comm
,
current
->
pid
,
new
,
old
);
#endif
#endif
if
(
new
)
{
if
(
new
)
{
if
(
!
access_ok
(
VERIFY_READ
,
new
,
sizeof
(
*
new
)))
if
(
!
access_ok
(
VERIFY_READ
,
new
,
sizeof
(
*
new
)))
goto
out
;
return
-
EFAULT
;
}
}
if
(
old
)
{
if
(
old
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
old
,
sizeof
(
*
old
)))
if
(
!
access_ok
(
VERIFY_WRITE
,
old
,
sizeof
(
*
old
)))
goto
out
;
return
-
EFAULT
;
}
}
error
=
0
;
out:
return
0
;
return
error
;
}
}
struct
irix_sigaltstack
{
unsigned
long
sp
;
int
size
;
int
status
;
};
struct
irix_sigaltstack
{
unsigned
long
sp
;
int
size
;
int
status
;
};
asmlinkage
int
irix_sigaltstack
(
struct
irix_sigaltstack
*
new
,
asmlinkage
int
irix_sigaltstack
(
struct
irix_sigaltstack
__user
*
new
,
struct
irix_sigaltstack
*
old
)
struct
irix_sigaltstack
__user
*
old
)
{
{
int
error
=
-
EFAULT
;
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] irix_sigaltstack(%p,%p)
\n
"
,
printk
(
"[%s:%d] irix_sigaltstack(%p,%p)
\n
"
,
current
->
comm
,
current
->
pid
,
new
,
old
);
current
->
comm
,
current
->
pid
,
new
,
old
);
#endif
#endif
if
(
new
)
{
if
(
new
)
if
(
!
access_ok
(
VERIFY_READ
,
new
,
sizeof
(
*
new
)))
if
(
!
access_ok
(
VERIFY_READ
,
new
,
sizeof
(
*
new
)))
goto
out
;
return
-
EFAULT
;
}
if
(
old
)
{
if
(
old
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
old
,
sizeof
(
*
old
)))
if
(
!
access_ok
(
VERIFY_WRITE
,
old
,
sizeof
(
*
old
)))
goto
out
;
return
-
EFAULT
;
}
}
error
=
0
;
out:
error
=
0
;
return
error
;
return
0
;
}
}
struct
irix_procset
{
struct
irix_procset
{
int
cmd
,
ltype
,
lid
,
rtype
,
rid
;
int
cmd
,
ltype
,
lid
,
rtype
,
rid
;
};
};
asmlinkage
int
irix_sigsendset
(
struct
irix_procset
*
pset
,
int
sig
)
asmlinkage
int
irix_sigsendset
(
struct
irix_procset
__user
*
pset
,
int
sig
)
{
{
if
(
!
access_ok
(
VERIFY_READ
,
pset
,
sizeof
(
*
pset
)))
if
(
!
access_ok
(
VERIFY_READ
,
pset
,
sizeof
(
*
pset
)))
return
-
EFAULT
;
return
-
EFAULT
;
#ifdef DEBUG_SIG
#ifdef DEBUG_SIG
printk
(
"[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)
\n
"
,
printk
(
"[%s:%d] irix_sigsendset([%d,%d,%d,%d,%d],%d)
\n
"
,
current
->
comm
,
current
->
pid
,
current
->
comm
,
current
->
pid
,
...
...
arch/mips/kernel/process.c
View file @
fe00f943
...
@@ -38,14 +38,6 @@
...
@@ -38,14 +38,6 @@
#include <asm/isadep.h>
#include <asm/isadep.h>
#include <asm/inst.h>
#include <asm/inst.h>
/*
* We use this if we don't have any better idle routine..
* (This to kill: kernel/platform.c.
*/
void
default_idle
(
void
)
{
}
/*
/*
* The idle thread. There's no useful work to be done, so just try to conserve
* The idle thread. There's no useful work to be done, so just try to conserve
* power and have a low exit latency (ie sit in a loop waiting for somebody to
* power and have a low exit latency (ie sit in a loop waiting for somebody to
...
...
arch/mips/kernel/ptrace.c
View file @
fe00f943
...
@@ -103,7 +103,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
...
@@ -103,7 +103,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret
=
-
EIO
;
ret
=
-
EIO
;
if
(
copied
!=
sizeof
(
tmp
))
if
(
copied
!=
sizeof
(
tmp
))
break
;
break
;
ret
=
put_user
(
tmp
,(
unsigned
long
*
)
data
);
ret
=
put_user
(
tmp
,(
unsigned
long
__user
*
)
data
);
break
;
break
;
}
}
...
@@ -180,7 +180,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
...
@@ -180,7 +180,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret
=
-
EIO
;
ret
=
-
EIO
;
goto
out_tsk
;
goto
out_tsk
;
}
}
ret
=
put_user
(
tmp
,
(
unsigned
long
*
)
data
);
ret
=
put_user
(
tmp
,
(
unsigned
long
__user
*
)
data
);
break
;
break
;
}
}
...
...
arch/mips/kernel/signal.c
View file @
fe00f943
...
@@ -47,9 +47,10 @@ save_static_function(sys_sigsuspend);
...
@@ -47,9 +47,10 @@ save_static_function(sys_sigsuspend);
__attribute_used__
noinline
static
int
__attribute_used__
noinline
static
int
_sys_sigsuspend
(
nabi_no_regargs
struct
pt_regs
regs
)
_sys_sigsuspend
(
nabi_no_regargs
struct
pt_regs
regs
)
{
{
sigset_t
*
uset
,
saveset
,
newset
;
sigset_t
saveset
,
newset
;
sigset_t
__user
*
uset
;
uset
=
(
sigset_t
*
)
regs
.
regs
[
4
];
uset
=
(
sigset_t
__user
*
)
regs
.
regs
[
4
];
if
(
copy_from_user
(
&
newset
,
uset
,
sizeof
(
sigset_t
)))
if
(
copy_from_user
(
&
newset
,
uset
,
sizeof
(
sigset_t
)))
return
-
EFAULT
;
return
-
EFAULT
;
sigdelsetmask
(
&
newset
,
~
_BLOCKABLE
);
sigdelsetmask
(
&
newset
,
~
_BLOCKABLE
);
...
@@ -75,7 +76,8 @@ save_static_function(sys_rt_sigsuspend);
...
@@ -75,7 +76,8 @@ save_static_function(sys_rt_sigsuspend);
__attribute_used__
noinline
static
int
__attribute_used__
noinline
static
int
_sys_rt_sigsuspend
(
nabi_no_regargs
struct
pt_regs
regs
)
_sys_rt_sigsuspend
(
nabi_no_regargs
struct
pt_regs
regs
)
{
{
sigset_t
*
unewset
,
saveset
,
newset
;
sigset_t
saveset
,
newset
;
sigset_t
__user
*
unewset
;
size_t
sigsetsize
;
size_t
sigsetsize
;
/* XXX Don't preclude handling different sized sigset_t's. */
/* XXX Don't preclude handling different sized sigset_t's. */
...
@@ -83,7 +85,7 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
...
@@ -83,7 +85,7 @@ _sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
if
(
sigsetsize
!=
sizeof
(
sigset_t
))
if
(
sigsetsize
!=
sizeof
(
sigset_t
))
return
-
EINVAL
;
return
-
EINVAL
;
unewset
=
(
sigset_t
*
)
regs
.
regs
[
4
];
unewset
=
(
sigset_t
__user
*
)
regs
.
regs
[
4
];
if
(
copy_from_user
(
&
newset
,
unewset
,
sizeof
(
newset
)))
if
(
copy_from_user
(
&
newset
,
unewset
,
sizeof
(
newset
)))
return
-
EFAULT
;
return
-
EFAULT
;
sigdelsetmask
(
&
newset
,
~
_BLOCKABLE
);
sigdelsetmask
(
&
newset
,
~
_BLOCKABLE
);
...
@@ -147,8 +149,8 @@ asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
...
@@ -147,8 +149,8 @@ asmlinkage int sys_sigaction(int sig, const struct sigaction *act,
asmlinkage
int
sys_sigaltstack
(
nabi_no_regargs
struct
pt_regs
regs
)
asmlinkage
int
sys_sigaltstack
(
nabi_no_regargs
struct
pt_regs
regs
)
{
{
const
stack_t
*
uss
=
(
const
stack_t
*
)
regs
.
regs
[
4
];
const
stack_t
__user
*
uss
=
(
const
stack_t
__user
*
)
regs
.
regs
[
4
];
stack_t
*
uoss
=
(
stack_t
*
)
regs
.
regs
[
5
];
stack_t
__user
*
uoss
=
(
stack_t
__user
*
)
regs
.
regs
[
5
];
unsigned
long
usp
=
regs
.
regs
[
29
];
unsigned
long
usp
=
regs
.
regs
[
29
];
return
do_sigaltstack
(
uss
,
uoss
,
usp
);
return
do_sigaltstack
(
uss
,
uoss
,
usp
);
...
...
arch/mips/kernel/sysirix.c
View file @
fe00f943
...
@@ -233,7 +233,7 @@ asmlinkage int irix_prctl(unsigned option, ...)
...
@@ -233,7 +233,7 @@ asmlinkage int irix_prctl(unsigned option, ...)
#undef DEBUG_PROCGRPS
#undef DEBUG_PROCGRPS
extern
unsigned
long
irix_mapelf
(
int
fd
,
struct
elf_phdr
*
user_phdrp
,
int
cnt
);
extern
unsigned
long
irix_mapelf
(
int
fd
,
struct
elf_phdr
__user
*
user_phdrp
,
int
cnt
);
extern
int
getrusage
(
struct
task_struct
*
p
,
int
who
,
struct
rusage
__user
*
ru
);
extern
int
getrusage
(
struct
task_struct
*
p
,
int
who
,
struct
rusage
__user
*
ru
);
extern
char
*
prom_getenv
(
char
*
name
);
extern
char
*
prom_getenv
(
char
*
name
);
extern
long
prom_setenv
(
char
*
name
,
char
*
value
);
extern
long
prom_setenv
(
char
*
name
,
char
*
value
);
...
@@ -270,23 +270,19 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
...
@@ -270,23 +270,19 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
cmd
=
regs
->
regs
[
base
+
4
];
cmd
=
regs
->
regs
[
base
+
4
];
switch
(
cmd
)
{
switch
(
cmd
)
{
case
SGI_SYSID
:
{
case
SGI_SYSID
:
{
char
*
buf
=
(
cha
r
*
)
regs
->
regs
[
base
+
5
];
char
__user
*
buf
=
(
char
__use
r
*
)
regs
->
regs
[
base
+
5
];
/* XXX Use ethernet addr.... */
/* XXX Use ethernet addr.... */
retval
=
clear_user
(
buf
,
64
);
retval
=
clear_user
(
buf
,
64
)
?
-
EFAULT
:
0
;
break
;
break
;
}
}
#if 0
#if 0
case SGI_RDNAME: {
case SGI_RDNAME: {
int pid = (int) regs->regs[base + 5];
int pid = (int) regs->regs[base + 5];
char
*buf = (cha
r *) regs->regs[base + 6];
char
__user *buf = (char __use
r *) regs->regs[base + 6];
struct task_struct *p;
struct task_struct *p;
char tcomm[sizeof(current->comm)];
char tcomm[sizeof(current->comm)];
if (!access_ok(VERIFY_WRITE, buf, sizeof(tcomm))) {
retval = -EFAULT;
break;
}
read_lock(&tasklist_lock);
read_lock(&tasklist_lock);
p = find_task_by_pid(pid);
p = find_task_by_pid(pid);
if (!p) {
if (!p) {
...
@@ -298,34 +294,28 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
...
@@ -298,34 +294,28 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
read_unlock(&tasklist_lock);
read_unlock(&tasklist_lock);
/* XXX Need to check sizes. */
/* XXX Need to check sizes. */
copy_to_user(buf, tcomm, sizeof(tcomm));
retval = copy_to_user(buf, tcomm, sizeof(tcomm)) ? -EFAULT : 0;
retval = 0;
break;
break;
}
}
case SGI_GETNVRAM: {
case SGI_GETNVRAM: {
char
*name = (cha
r *) regs->regs[base+5];
char
__user *name = (char __use
r *) regs->regs[base+5];
char
*buf = (cha
r *) regs->regs[base+6];
char
__user *buf = (char __use
r *) regs->regs[base+6];
char *value;
char *value;
return -EINVAL; /* til I fix it */
return -EINVAL; /* til I fix it */
if (!access_ok(VERIFY_WRITE, buf, 128)) {
retval = -EFAULT;
break;
}
value = prom_getenv(name); /* PROM lock? */
value = prom_getenv(name); /* PROM lock? */
if (!value) {
if (!value) {
retval = -EINVAL;
retval = -EINVAL;
break;
break;
}
}
/* Do I strlen() for the length? */
/* Do I strlen() for the length? */
copy_to_user(buf, value, 128);
retval = copy_to_user(buf, value, 128) ? -EFAULT : 0;
retval = 0;
break;
break;
}
}
case SGI_SETNVRAM: {
case SGI_SETNVRAM: {
char
*name = (cha
r *) regs->regs[base+5];
char
__user *name = (char __use
r *) regs->regs[base+5];
char
*value = (cha
r *) regs->regs[base+6];
char
__user *value = (char __use
r *) regs->regs[base+6];
return -EINVAL; /* til I fix it */
return -EINVAL; /* til I fix it */
retval = prom_setenv(name, value);
retval = prom_setenv(name, value);
/* XXX make sure retval conforms to syssgi(2) */
/* XXX make sure retval conforms to syssgi(2) */
...
@@ -401,16 +391,16 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
...
@@ -401,16 +391,16 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
case
SGI_SETGROUPS
:
case
SGI_SETGROUPS
:
retval
=
sys_setgroups
((
int
)
regs
->
regs
[
base
+
5
],
retval
=
sys_setgroups
((
int
)
regs
->
regs
[
base
+
5
],
(
gid_t
*
)
regs
->
regs
[
base
+
6
]);
(
gid_t
__user
*
)
regs
->
regs
[
base
+
6
]);
break
;
break
;
case
SGI_GETGROUPS
:
case
SGI_GETGROUPS
:
retval
=
sys_getgroups
((
int
)
regs
->
regs
[
base
+
5
],
retval
=
sys_getgroups
((
int
)
regs
->
regs
[
base
+
5
],
(
gid_t
*
)
regs
->
regs
[
base
+
6
]);
(
gid_t
__user
*
)
regs
->
regs
[
base
+
6
]);
break
;
break
;
case
SGI_RUSAGE
:
{
case
SGI_RUSAGE
:
{
struct
rusage
*
ru
=
(
struct
rusage
*
)
regs
->
regs
[
base
+
6
];
struct
rusage
__user
*
ru
=
(
struct
rusage
__user
*
)
regs
->
regs
[
base
+
6
];
switch
((
int
)
regs
->
regs
[
base
+
5
])
{
switch
((
int
)
regs
->
regs
[
base
+
5
])
{
case
0
:
case
0
:
...
@@ -447,7 +437,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
...
@@ -447,7 +437,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
case
SGI_ELFMAP
:
case
SGI_ELFMAP
:
retval
=
irix_mapelf
((
int
)
regs
->
regs
[
base
+
5
],
retval
=
irix_mapelf
((
int
)
regs
->
regs
[
base
+
5
],
(
struct
elf_phdr
*
)
regs
->
regs
[
base
+
6
],
(
struct
elf_phdr
__user
*
)
regs
->
regs
[
base
+
6
],
(
int
)
regs
->
regs
[
base
+
7
]);
(
int
)
regs
->
regs
[
base
+
7
]);
break
;
break
;
...
@@ -462,24 +452,24 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
...
@@ -462,24 +452,24 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
case
SGI_PHYSP
:
{
case
SGI_PHYSP
:
{
unsigned
long
addr
=
regs
->
regs
[
base
+
5
];
unsigned
long
addr
=
regs
->
regs
[
base
+
5
];
int
*
pageno
=
(
int
*
)
(
regs
->
regs
[
base
+
6
]);
int
__user
*
pageno
=
(
int
__user
*
)
(
regs
->
regs
[
base
+
6
]);
struct
mm_struct
*
mm
=
current
->
mm
;
struct
mm_struct
*
mm
=
current
->
mm
;
pgd_t
*
pgdp
;
pgd_t
*
pgdp
;
pud_t
*
pudp
;
pmd_t
*
pmdp
;
pmd_t
*
pmdp
;
pte_t
*
ptep
;
pte_t
*
ptep
;
if
(
!
access_ok
(
VERIFY_WRITE
,
pageno
,
sizeof
(
int
)))
return
-
EFAULT
;
down_read
(
&
mm
->
mmap_sem
);
down_read
(
&
mm
->
mmap_sem
);
pgdp
=
pgd_offset
(
mm
,
addr
);
pgdp
=
pgd_offset
(
mm
,
addr
);
pmdp
=
pmd_offset
(
pgdp
,
addr
);
pudp
=
pud_offset
(
pgdp
,
addr
);
pmdp
=
pmd_offset
(
pudp
,
addr
);
ptep
=
pte_offset
(
pmdp
,
addr
);
ptep
=
pte_offset
(
pmdp
,
addr
);
retval
=
-
EINVAL
;
retval
=
-
EINVAL
;
if
(
ptep
)
{
if
(
ptep
)
{
pte_t
pte
=
*
ptep
;
pte_t
pte
=
*
ptep
;
if
(
pte_val
(
pte
)
&
(
_PAGE_VALID
|
_PAGE_PRESENT
))
{
if
(
pte_val
(
pte
)
&
(
_PAGE_VALID
|
_PAGE_PRESENT
))
{
/* b0rked on 64-bit */
retval
=
put_user
((
pte_val
(
pte
)
&
PAGE_MASK
)
>>
retval
=
put_user
((
pte_val
(
pte
)
&
PAGE_MASK
)
>>
PAGE_SHIFT
,
pageno
);
PAGE_SHIFT
,
pageno
);
}
}
...
@@ -490,7 +480,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
...
@@ -490,7 +480,7 @@ asmlinkage int irix_syssgi(struct pt_regs *regs)
case
SGI_INVENT
:
{
case
SGI_INVENT
:
{
int
arg1
=
(
int
)
regs
->
regs
[
base
+
5
];
int
arg1
=
(
int
)
regs
->
regs
[
base
+
5
];
void
*
buffer
=
(
void
*
)
regs
->
regs
[
base
+
6
];
void
__user
*
buffer
=
(
void
__user
*
)
regs
->
regs
[
base
+
6
];
int
count
=
(
int
)
regs
->
regs
[
base
+
7
];
int
count
=
(
int
)
regs
->
regs
[
base
+
7
];
switch
(
arg1
)
{
switch
(
arg1
)
{
...
@@ -686,8 +676,8 @@ asmlinkage int irix_pause(void)
...
@@ -686,8 +676,8 @@ asmlinkage int irix_pause(void)
}
}
/* XXX need more than this... */
/* XXX need more than this... */
asmlinkage
int
irix_mount
(
char
*
dev_name
,
char
*
dir_name
,
unsigned
long
flags
,
asmlinkage
int
irix_mount
(
char
__user
*
dev_name
,
char
__user
*
dir_name
,
char
*
type
,
void
*
data
,
int
datalen
)
unsigned
long
flags
,
char
__user
*
type
,
void
__user
*
data
,
int
datalen
)
{
{
printk
(
"[%s:%d] irix_mount(%p,%p,%08lx,%p,%p,%d)
\n
"
,
printk
(
"[%s:%d] irix_mount(%p,%p,%08lx,%p,%p,%d)
\n
"
,
current
->
comm
,
current
->
pid
,
current
->
comm
,
current
->
pid
,
...
@@ -702,8 +692,8 @@ struct irix_statfs {
...
@@ -702,8 +692,8 @@ struct irix_statfs {
char
f_fname
[
6
],
f_fpack
[
6
];
char
f_fname
[
6
],
f_fpack
[
6
];
};
};
asmlinkage
int
irix_statfs
(
const
char
*
path
,
struct
irix_statfs
*
buf
,
asmlinkage
int
irix_statfs
(
const
char
__user
*
path
,
int
len
,
int
fs_type
)
struct
irix_statfs
__user
*
buf
,
int
len
,
int
fs_type
)
{
{
struct
nameidata
nd
;
struct
nameidata
nd
;
struct
kstatfs
kbuf
;
struct
kstatfs
kbuf
;
...
@@ -718,6 +708,7 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
...
@@ -718,6 +708,7 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
error
=
-
EFAULT
;
error
=
-
EFAULT
;
goto
out
;
goto
out
;
}
}
error
=
user_path_walk
(
path
,
&
nd
);
error
=
user_path_walk
(
path
,
&
nd
);
if
(
error
)
if
(
error
)
goto
out
;
goto
out
;
...
@@ -726,18 +717,17 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
...
@@ -726,18 +717,17 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
if
(
error
)
if
(
error
)
goto
dput_and_out
;
goto
dput_and_out
;
__put_user
(
kbuf
.
f_type
,
&
buf
->
f_type
);
error
=
__put_user
(
kbuf
.
f_type
,
&
buf
->
f_type
);
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
error
|=
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
error
|=
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
error
|=
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
error
|=
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
for
(
i
=
0
;
i
<
6
;
i
++
)
{
__put_user
(
0
,
&
buf
->
f_fname
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_fname
[
i
]);
__put_user
(
0
,
&
buf
->
f_fpack
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_fpack
[
i
]);
}
}
error
=
0
;
dput_and_out:
dput_and_out:
path_release
(
&
nd
);
path_release
(
&
nd
);
...
@@ -745,7 +735,7 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
...
@@ -745,7 +735,7 @@ asmlinkage int irix_statfs(const char *path, struct irix_statfs *buf,
return
error
;
return
error
;
}
}
asmlinkage
int
irix_fstatfs
(
unsigned
int
fd
,
struct
irix_statfs
*
buf
)
asmlinkage
int
irix_fstatfs
(
unsigned
int
fd
,
struct
irix_statfs
__user
*
buf
)
{
{
struct
kstatfs
kbuf
;
struct
kstatfs
kbuf
;
struct
file
*
file
;
struct
file
*
file
;
...
@@ -755,6 +745,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf)
...
@@ -755,6 +745,7 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf)
error
=
-
EFAULT
;
error
=
-
EFAULT
;
goto
out
;
goto
out
;
}
}
if
(
!
(
file
=
fget
(
fd
)))
{
if
(
!
(
file
=
fget
(
fd
)))
{
error
=
-
EBADF
;
error
=
-
EBADF
;
goto
out
;
goto
out
;
...
@@ -764,16 +755,17 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf)
...
@@ -764,16 +755,17 @@ asmlinkage int irix_fstatfs(unsigned int fd, struct irix_statfs *buf)
if
(
error
)
if
(
error
)
goto
out_f
;
goto
out_f
;
__put_user
(
kbuf
.
f_type
,
&
buf
->
f_type
);
error
=
__put_user
(
kbuf
.
f_type
,
&
buf
->
f_type
);
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
error
|=
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
error
|=
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
error
|=
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
error
|=
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
__put_user
(
0
,
&
buf
->
f_fname
[
i
]);
for
(
i
=
0
;
i
<
6
;
i
++
)
{
__put_user
(
0
,
&
buf
->
f_fpack
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_fname
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_fpack
[
i
]);
}
}
out_f:
out_f:
...
@@ -800,14 +792,15 @@ asmlinkage int irix_setpgrp(int flags)
...
@@ -800,14 +792,15 @@ asmlinkage int irix_setpgrp(int flags)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_times
(
struct
tms
*
tbuf
)
asmlinkage
int
irix_times
(
struct
tms
__user
*
tbuf
)
{
{
int
err
=
0
;
int
err
=
0
;
if
(
tbuf
)
{
if
(
tbuf
)
{
if
(
!
access_ok
(
VERIFY_WRITE
,
tbuf
,
sizeof
*
tbuf
))
if
(
!
access_ok
(
VERIFY_WRITE
,
tbuf
,
sizeof
*
tbuf
))
return
-
EFAULT
;
return
-
EFAULT
;
err
|=
__put_user
(
current
->
utime
,
&
tbuf
->
tms_utime
);
err
=
__put_user
(
current
->
utime
,
&
tbuf
->
tms_utime
);
err
|=
__put_user
(
current
->
stime
,
&
tbuf
->
tms_stime
);
err
|=
__put_user
(
current
->
stime
,
&
tbuf
->
tms_stime
);
err
|=
__put_user
(
current
->
signal
->
cutime
,
&
tbuf
->
tms_cutime
);
err
|=
__put_user
(
current
->
signal
->
cutime
,
&
tbuf
->
tms_cutime
);
err
|=
__put_user
(
current
->
signal
->
cstime
,
&
tbuf
->
tms_cstime
);
err
|=
__put_user
(
current
->
signal
->
cstime
,
&
tbuf
->
tms_cstime
);
...
@@ -823,13 +816,13 @@ asmlinkage int irix_exec(struct pt_regs *regs)
...
@@ -823,13 +816,13 @@ asmlinkage int irix_exec(struct pt_regs *regs)
if
(
regs
->
regs
[
2
]
==
1000
)
if
(
regs
->
regs
[
2
]
==
1000
)
base
=
1
;
base
=
1
;
filename
=
getname
((
char
*
)
(
long
)
regs
->
regs
[
base
+
4
]);
filename
=
getname
((
char
__user
*
)
(
long
)
regs
->
regs
[
base
+
4
]);
error
=
PTR_ERR
(
filename
);
error
=
PTR_ERR
(
filename
);
if
(
IS_ERR
(
filename
))
if
(
IS_ERR
(
filename
))
return
error
;
return
error
;
error
=
do_execve
(
filename
,
(
char
*
*
)
(
long
)
regs
->
regs
[
base
+
5
],
error
=
do_execve
(
filename
,
(
char
__user
*
__user
*
)
(
long
)
regs
->
regs
[
base
+
5
],
(
char
**
)
0
,
regs
);
NULL
,
regs
);
putname
(
filename
);
putname
(
filename
);
return
error
;
return
error
;
...
@@ -842,12 +835,12 @@ asmlinkage int irix_exece(struct pt_regs *regs)
...
@@ -842,12 +835,12 @@ asmlinkage int irix_exece(struct pt_regs *regs)
if
(
regs
->
regs
[
2
]
==
1000
)
if
(
regs
->
regs
[
2
]
==
1000
)
base
=
1
;
base
=
1
;
filename
=
getname
((
char
*
)
(
long
)
regs
->
regs
[
base
+
4
]);
filename
=
getname
((
char
__user
*
)
(
long
)
regs
->
regs
[
base
+
4
]);
error
=
PTR_ERR
(
filename
);
error
=
PTR_ERR
(
filename
);
if
(
IS_ERR
(
filename
))
if
(
IS_ERR
(
filename
))
return
error
;
return
error
;
error
=
do_execve
(
filename
,
(
char
*
*
)
(
long
)
regs
->
regs
[
base
+
5
],
error
=
do_execve
(
filename
,
(
char
__user
*
__user
*
)
(
long
)
regs
->
regs
[
base
+
5
],
(
char
*
*
)
(
long
)
regs
->
regs
[
base
+
6
],
regs
);
(
char
__user
*
__user
*
)
(
long
)
regs
->
regs
[
base
+
6
],
regs
);
putname
(
filename
);
putname
(
filename
);
return
error
;
return
error
;
...
@@ -903,22 +896,17 @@ asmlinkage int irix_socket(int family, int type, int protocol)
...
@@ -903,22 +896,17 @@ asmlinkage int irix_socket(int family, int type, int protocol)
return
sys_socket
(
family
,
type
,
protocol
);
return
sys_socket
(
family
,
type
,
protocol
);
}
}
asmlinkage
int
irix_getdomainname
(
char
*
name
,
int
len
)
asmlinkage
int
irix_getdomainname
(
char
__user
*
name
,
int
len
)
{
{
int
error
;
int
err
;
if
(
!
access_ok
(
VERIFY_WRITE
,
name
,
len
))
return
-
EFAULT
;
down_read
(
&
uts_sem
);
down_read
(
&
uts_sem
);
if
(
len
>
__NEW_UTS_LEN
)
if
(
len
>
__NEW_UTS_LEN
)
len
=
__NEW_UTS_LEN
;
len
=
__NEW_UTS_LEN
;
error
=
0
;
err
=
copy_to_user
(
name
,
system_utsname
.
domainname
,
len
)
?
-
EFAULT
:
0
;
if
(
copy_to_user
(
name
,
system_utsname
.
domainname
,
len
))
error
=
-
EFAULT
;
up_read
(
&
uts_sem
);
up_read
(
&
uts_sem
);
return
err
or
;
return
err
;
}
}
asmlinkage
unsigned
long
irix_getpagesize
(
void
)
asmlinkage
unsigned
long
irix_getpagesize
(
void
)
...
@@ -934,12 +922,13 @@ asmlinkage int irix_msgsys(int opcode, unsigned long arg0, unsigned long arg1,
...
@@ -934,12 +922,13 @@ asmlinkage int irix_msgsys(int opcode, unsigned long arg0, unsigned long arg1,
case
0
:
case
0
:
return
sys_msgget
((
key_t
)
arg0
,
(
int
)
arg1
);
return
sys_msgget
((
key_t
)
arg0
,
(
int
)
arg1
);
case
1
:
case
1
:
return
sys_msgctl
((
int
)
arg0
,
(
int
)
arg1
,
(
struct
msqid_ds
*
)
arg2
);
return
sys_msgctl
((
int
)
arg0
,
(
int
)
arg1
,
(
struct
msqid_ds
__user
*
)
arg2
);
case
2
:
case
2
:
return
sys_msgrcv
((
int
)
arg0
,
(
struct
msgbuf
*
)
arg1
,
return
sys_msgrcv
((
int
)
arg0
,
(
struct
msgbuf
__user
*
)
arg1
,
(
size_t
)
arg2
,
(
long
)
arg3
,
(
int
)
arg4
);
(
size_t
)
arg2
,
(
long
)
arg3
,
(
int
)
arg4
);
case
3
:
case
3
:
return
sys_msgsnd
((
int
)
arg0
,
(
struct
msgbuf
*
)
arg1
,
return
sys_msgsnd
((
int
)
arg0
,
(
struct
msgbuf
__user
*
)
arg1
,
(
size_t
)
arg2
,
(
int
)
arg3
);
(
size_t
)
arg2
,
(
int
)
arg3
);
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -951,12 +940,13 @@ asmlinkage int irix_shmsys(int opcode, unsigned long arg0, unsigned long arg1,
...
@@ -951,12 +940,13 @@ asmlinkage int irix_shmsys(int opcode, unsigned long arg0, unsigned long arg1,
{
{
switch
(
opcode
)
{
switch
(
opcode
)
{
case
0
:
case
0
:
return
do_shmat
((
int
)
arg0
,
(
char
*
)
arg1
,
(
int
)
arg2
,
return
do_shmat
((
int
)
arg0
,
(
char
__user
*
)
arg1
,
(
int
)
arg2
,
(
unsigned
long
*
)
arg3
);
(
unsigned
long
*
)
arg3
);
case
1
:
case
1
:
return
sys_shmctl
((
int
)
arg0
,
(
int
)
arg1
,
(
struct
shmid_ds
*
)
arg2
);
return
sys_shmctl
((
int
)
arg0
,
(
int
)
arg1
,
(
struct
shmid_ds
__user
*
)
arg2
);
case
2
:
case
2
:
return
sys_shmdt
((
char
*
)
arg0
);
return
sys_shmdt
((
char
__user
*
)
arg0
);
case
3
:
case
3
:
return
sys_shmget
((
key_t
)
arg0
,
(
int
)
arg1
,
(
int
)
arg2
);
return
sys_shmget
((
key_t
)
arg0
,
(
int
)
arg1
,
(
int
)
arg2
);
default:
default:
...
@@ -974,7 +964,7 @@ asmlinkage int irix_semsys(int opcode, unsigned long arg0, unsigned long arg1,
...
@@ -974,7 +964,7 @@ asmlinkage int irix_semsys(int opcode, unsigned long arg0, unsigned long arg1,
case
1
:
case
1
:
return
sys_semget
((
key_t
)
arg0
,
(
int
)
arg1
,
(
int
)
arg2
);
return
sys_semget
((
key_t
)
arg0
,
(
int
)
arg1
,
(
int
)
arg2
);
case
2
:
case
2
:
return
sys_semop
((
int
)
arg0
,
(
struct
sembuf
*
)
arg1
,
return
sys_semop
((
int
)
arg0
,
(
struct
sembuf
__user
*
)
arg1
,
(
unsigned
int
)
arg2
);
(
unsigned
int
)
arg2
);
default:
default:
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -992,15 +982,16 @@ static inline loff_t llseek(struct file *file, loff_t offset, int origin)
...
@@ -992,15 +982,16 @@ static inline loff_t llseek(struct file *file, loff_t offset, int origin)
lock_kernel
();
lock_kernel
();
retval
=
fn
(
file
,
offset
,
origin
);
retval
=
fn
(
file
,
offset
,
origin
);
unlock_kernel
();
unlock_kernel
();
return
retval
;
return
retval
;
}
}
asmlinkage
int
irix_lseek64
(
int
fd
,
int
_unused
,
int
offhi
,
int
offlow
,
asmlinkage
int
irix_lseek64
(
int
fd
,
int
_unused
,
int
offhi
,
int
offlow
,
int
origin
)
int
origin
)
{
{
int
retval
;
struct
file
*
file
;
struct
file
*
file
;
loff_t
offset
;
loff_t
offset
;
int
retval
;
retval
=
-
EBADF
;
retval
=
-
EBADF
;
file
=
fget
(
fd
);
file
=
fget
(
fd
);
...
@@ -1025,12 +1016,12 @@ asmlinkage int irix_sginap(int ticks)
...
@@ -1025,12 +1016,12 @@ asmlinkage int irix_sginap(int ticks)
return
0
;
return
0
;
}
}
asmlinkage
int
irix_sgikopt
(
char
*
istring
,
cha
r
*
ostring
,
int
len
)
asmlinkage
int
irix_sgikopt
(
char
__user
*
istring
,
char
__use
r
*
ostring
,
int
len
)
{
{
return
-
EINVAL
;
return
-
EINVAL
;
}
}
asmlinkage
int
irix_gettimeofday
(
struct
timeval
*
tv
)
asmlinkage
int
irix_gettimeofday
(
struct
timeval
__user
*
tv
)
{
{
time_t
sec
;
time_t
sec
;
long
nsec
,
seq
;
long
nsec
,
seq
;
...
@@ -1071,7 +1062,7 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot,
...
@@ -1071,7 +1062,7 @@ asmlinkage unsigned long irix_mmap32(unsigned long addr, size_t len, int prot,
if
(
max_size
>
file
->
f_dentry
->
d_inode
->
i_size
)
{
if
(
max_size
>
file
->
f_dentry
->
d_inode
->
i_size
)
{
old_pos
=
sys_lseek
(
fd
,
max_size
-
1
,
0
);
old_pos
=
sys_lseek
(
fd
,
max_size
-
1
,
0
);
sys_write
(
fd
,
""
,
1
);
sys_write
(
fd
,
(
void
__user
*
)
""
,
1
);
sys_lseek
(
fd
,
old_pos
,
0
);
sys_lseek
(
fd
,
old_pos
,
0
);
}
}
}
}
...
@@ -1096,7 +1087,7 @@ asmlinkage int irix_madvise(unsigned long addr, int len, int behavior)
...
@@ -1096,7 +1087,7 @@ asmlinkage int irix_madvise(unsigned long addr, int len, int behavior)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
asmlinkage
int
irix_pagelock
(
char
*
addr
,
int
len
,
int
op
)
asmlinkage
int
irix_pagelock
(
char
__user
*
addr
,
int
len
,
int
op
)
{
{
printk
(
"[%s:%d] Wheee.. irix_pagelock(%p,%d,%d)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_pagelock(%p,%d,%d)
\n
"
,
current
->
comm
,
current
->
pid
,
addr
,
len
,
op
);
current
->
comm
,
current
->
pid
,
addr
,
len
,
op
);
...
@@ -1136,7 +1127,7 @@ asmlinkage int irix_BSDsetpgrp(int pid, int pgrp)
...
@@ -1136,7 +1127,7 @@ asmlinkage int irix_BSDsetpgrp(int pid, int pgrp)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_systeminfo
(
int
cmd
,
char
*
buf
,
int
cnt
)
asmlinkage
int
irix_systeminfo
(
int
cmd
,
char
__user
*
buf
,
int
cnt
)
{
{
printk
(
"[%s:%d] Wheee.. irix_systeminfo(%d,%p,%d)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_systeminfo(%d,%p,%d)
\n
"
,
current
->
comm
,
current
->
pid
,
cmd
,
buf
,
cnt
);
current
->
comm
,
current
->
pid
,
cmd
,
buf
,
cnt
);
...
@@ -1152,14 +1143,14 @@ struct iuname {
...
@@ -1152,14 +1143,14 @@ struct iuname {
char
_unused3
[
257
],
_unused4
[
257
],
_unused5
[
257
];
char
_unused3
[
257
],
_unused4
[
257
],
_unused5
[
257
];
};
};
asmlinkage
int
irix_uname
(
struct
iuname
*
buf
)
asmlinkage
int
irix_uname
(
struct
iuname
__user
*
buf
)
{
{
down_read
(
&
uts_sem
);
down_read
(
&
uts_sem
);
if
(
copy_
to
_user
(
system_utsname
.
sysname
,
buf
->
sysname
,
65
)
if
(
copy_
from
_user
(
system_utsname
.
sysname
,
buf
->
sysname
,
65
)
||
copy_
to
_user
(
system_utsname
.
nodename
,
buf
->
nodename
,
65
)
||
copy_
from
_user
(
system_utsname
.
nodename
,
buf
->
nodename
,
65
)
||
copy_
to
_user
(
system_utsname
.
release
,
buf
->
release
,
65
)
||
copy_
from
_user
(
system_utsname
.
release
,
buf
->
release
,
65
)
||
copy_
to
_user
(
system_utsname
.
version
,
buf
->
version
,
65
)
||
copy_
from
_user
(
system_utsname
.
version
,
buf
->
version
,
65
)
||
copy_
to
_user
(
system_utsname
.
machine
,
buf
->
machine
,
65
))
{
||
copy_
from
_user
(
system_utsname
.
machine
,
buf
->
machine
,
65
))
{
return
-
EFAULT
;
return
-
EFAULT
;
}
}
up_read
(
&
uts_sem
);
up_read
(
&
uts_sem
);
...
@@ -1169,7 +1160,7 @@ asmlinkage int irix_uname(struct iuname *buf)
...
@@ -1169,7 +1160,7 @@ asmlinkage int irix_uname(struct iuname *buf)
#undef DEBUG_XSTAT
#undef DEBUG_XSTAT
static
int
irix_xstat32_xlate
(
struct
kstat
*
stat
,
void
*
ubuf
)
static
int
irix_xstat32_xlate
(
struct
kstat
*
stat
,
void
__user
*
ubuf
)
{
{
struct
xstat32
{
struct
xstat32
{
u32
st_dev
,
st_pad1
[
3
],
st_ino
,
st_mode
,
st_nlink
,
st_uid
,
st_gid
;
u32
st_dev
,
st_pad1
[
3
],
st_ino
,
st_mode
,
st_nlink
,
st_uid
,
st_gid
;
...
@@ -1209,7 +1200,7 @@ static int irix_xstat32_xlate(struct kstat *stat, void *ubuf)
...
@@ -1209,7 +1200,7 @@ static int irix_xstat32_xlate(struct kstat *stat, void *ubuf)
return
copy_to_user
(
ubuf
,
&
ub
,
sizeof
(
ub
))
?
-
EFAULT
:
0
;
return
copy_to_user
(
ubuf
,
&
ub
,
sizeof
(
ub
))
?
-
EFAULT
:
0
;
}
}
static
int
irix_xstat64_xlate
(
struct
kstat
*
stat
,
void
*
ubuf
)
static
int
irix_xstat64_xlate
(
struct
kstat
*
stat
,
void
__user
*
ubuf
)
{
{
struct
xstat64
{
struct
xstat64
{
u32
st_dev
;
s32
st_pad1
[
3
];
u32
st_dev
;
s32
st_pad1
[
3
];
...
@@ -1259,7 +1250,7 @@ static int irix_xstat64_xlate(struct kstat *stat, void *ubuf)
...
@@ -1259,7 +1250,7 @@ static int irix_xstat64_xlate(struct kstat *stat, void *ubuf)
return
copy_to_user
(
ubuf
,
&
ks
,
sizeof
(
ks
))
?
-
EFAULT
:
0
;
return
copy_to_user
(
ubuf
,
&
ks
,
sizeof
(
ks
))
?
-
EFAULT
:
0
;
}
}
asmlinkage
int
irix_xstat
(
int
version
,
char
*
filename
,
struct
stat
*
statbuf
)
asmlinkage
int
irix_xstat
(
int
version
,
char
__user
*
filename
,
struct
stat
__user
*
statbuf
)
{
{
int
retval
;
int
retval
;
struct
kstat
stat
;
struct
kstat
stat
;
...
@@ -1285,7 +1276,7 @@ asmlinkage int irix_xstat(int version, char *filename, struct stat *statbuf)
...
@@ -1285,7 +1276,7 @@ asmlinkage int irix_xstat(int version, char *filename, struct stat *statbuf)
return
retval
;
return
retval
;
}
}
asmlinkage
int
irix_lxstat
(
int
version
,
char
*
filename
,
struct
stat
*
statbuf
)
asmlinkage
int
irix_lxstat
(
int
version
,
char
__user
*
filename
,
struct
stat
__user
*
statbuf
)
{
{
int
error
;
int
error
;
struct
kstat
stat
;
struct
kstat
stat
;
...
@@ -1312,7 +1303,7 @@ asmlinkage int irix_lxstat(int version, char *filename, struct stat *statbuf)
...
@@ -1312,7 +1303,7 @@ asmlinkage int irix_lxstat(int version, char *filename, struct stat *statbuf)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_fxstat
(
int
version
,
int
fd
,
struct
stat
*
statbuf
)
asmlinkage
int
irix_fxstat
(
int
version
,
int
fd
,
struct
stat
__user
*
statbuf
)
{
{
int
error
;
int
error
;
struct
kstat
stat
;
struct
kstat
stat
;
...
@@ -1338,7 +1329,7 @@ asmlinkage int irix_fxstat(int version, int fd, struct stat *statbuf)
...
@@ -1338,7 +1329,7 @@ asmlinkage int irix_fxstat(int version, int fd, struct stat *statbuf)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_xmknod
(
int
ver
,
char
*
filename
,
int
mode
,
unsigned
dev
)
asmlinkage
int
irix_xmknod
(
int
ver
,
char
__user
*
filename
,
int
mode
,
unsigned
dev
)
{
{
int
retval
;
int
retval
;
printk
(
"[%s:%d] Wheee.. irix_xmknod(%d,%s,%x,%x)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_xmknod(%d,%s,%x,%x)
\n
"
,
...
@@ -1358,7 +1349,7 @@ asmlinkage int irix_xmknod(int ver, char *filename, int mode, unsigned dev)
...
@@ -1358,7 +1349,7 @@ asmlinkage int irix_xmknod(int ver, char *filename, int mode, unsigned dev)
return
retval
;
return
retval
;
}
}
asmlinkage
int
irix_swapctl
(
int
cmd
,
char
*
arg
)
asmlinkage
int
irix_swapctl
(
int
cmd
,
char
__user
*
arg
)
{
{
printk
(
"[%s:%d] Wheee.. irix_swapctl(%d,%p)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_swapctl(%d,%p)
\n
"
,
current
->
comm
,
current
->
pid
,
cmd
,
arg
);
current
->
comm
,
current
->
pid
,
cmd
,
arg
);
...
@@ -1374,7 +1365,7 @@ struct irix_statvfs {
...
@@ -1374,7 +1365,7 @@ struct irix_statvfs {
char
f_fstr
[
32
];
u32
f_filler
[
16
];
char
f_fstr
[
32
];
u32
f_filler
[
16
];
};
};
asmlinkage
int
irix_statvfs
(
char
*
fname
,
struct
irix_statvfs
*
buf
)
asmlinkage
int
irix_statvfs
(
char
__user
*
fname
,
struct
irix_statvfs
__user
*
buf
)
{
{
struct
nameidata
nd
;
struct
nameidata
nd
;
struct
kstatfs
kbuf
;
struct
kstatfs
kbuf
;
...
@@ -1382,10 +1373,9 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
...
@@ -1382,10 +1373,9 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
printk
(
"[%s:%d] Wheee.. irix_statvfs(%s,%p)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_statvfs(%s,%p)
\n
"
,
current
->
comm
,
current
->
pid
,
fname
,
buf
);
current
->
comm
,
current
->
pid
,
fname
,
buf
);
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
sizeof
(
struct
irix_statvfs
)))
{
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
sizeof
(
struct
irix_statvfs
)))
error
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
}
error
=
user_path_walk
(
fname
,
&
nd
);
error
=
user_path_walk
(
fname
,
&
nd
);
if
(
error
)
if
(
error
)
goto
out
;
goto
out
;
...
@@ -1393,27 +1383,25 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
...
@@ -1393,27 +1383,25 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
if
(
error
)
if
(
error
)
goto
dput_and_out
;
goto
dput_and_out
;
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
error
|=
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
error
|=
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
error
|=
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
error
|=
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
#ifdef __MIPSEB__
#ifdef __MIPSEB__
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
#else
#else
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
#endif
#endif
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
__put_user
(
0
,
&
buf
->
f_flag
);
error
|=
__put_user
(
0
,
&
buf
->
f_flag
);
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
error
|=
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
for
(
i
=
0
;
i
<
32
;
i
++
)
for
(
i
=
0
;
i
<
32
;
i
++
)
__put_user
(
0
,
&
buf
->
f_fstr
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_fstr
[
i
]);
error
=
0
;
dput_and_out:
dput_and_out:
path_release
(
&
nd
);
path_release
(
&
nd
);
...
@@ -1421,7 +1409,7 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
...
@@ -1421,7 +1409,7 @@ asmlinkage int irix_statvfs(char *fname, struct irix_statvfs *buf)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_fstatvfs
(
int
fd
,
struct
irix_statvfs
*
buf
)
asmlinkage
int
irix_fstatvfs
(
int
fd
,
struct
irix_statvfs
__user
*
buf
)
{
{
struct
kstatfs
kbuf
;
struct
kstatfs
kbuf
;
struct
file
*
file
;
struct
file
*
file
;
...
@@ -1430,10 +1418,9 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf)
...
@@ -1430,10 +1418,9 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf)
printk
(
"[%s:%d] Wheee.. irix_fstatvfs(%d,%p)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_fstatvfs(%d,%p)
\n
"
,
current
->
comm
,
current
->
pid
,
fd
,
buf
);
current
->
comm
,
current
->
pid
,
fd
,
buf
);
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
sizeof
(
struct
irix_statvfs
)))
{
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
sizeof
(
struct
irix_statvfs
)))
error
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
}
if
(
!
(
file
=
fget
(
fd
)))
{
if
(
!
(
file
=
fget
(
fd
)))
{
error
=
-
EBADF
;
error
=
-
EBADF
;
goto
out
;
goto
out
;
...
@@ -1442,24 +1429,24 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf)
...
@@ -1442,24 +1429,24 @@ asmlinkage int irix_fstatvfs(int fd, struct irix_statvfs *buf)
if
(
error
)
if
(
error
)
goto
out_f
;
goto
out_f
;
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
error
=
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
error
|=
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
error
|=
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
error
|=
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
#ifdef __MIPSEB__
#ifdef __MIPSEB__
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
#else
#else
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
#endif
#endif
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
__put_user
(
0
,
&
buf
->
f_flag
);
error
|=
__put_user
(
0
,
&
buf
->
f_flag
);
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
error
|=
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
__clear_user
(
&
buf
->
f_fstr
,
sizeof
(
buf
->
f_fstr
))
;
error
|=
__clear_user
(
&
buf
->
f_fstr
,
sizeof
(
buf
->
f_fstr
))
?
-
EFAULT
:
0
;
out_f:
out_f:
fput
(
file
);
fput
(
file
);
...
@@ -1483,7 +1470,7 @@ asmlinkage int irix_sigqueue(int pid, int sig, int code, int val)
...
@@ -1483,7 +1470,7 @@ asmlinkage int irix_sigqueue(int pid, int sig, int code, int val)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
asmlinkage
int
irix_truncate64
(
char
*
name
,
int
pad
,
int
size1
,
int
size2
)
asmlinkage
int
irix_truncate64
(
char
__user
*
name
,
int
pad
,
int
size1
,
int
size2
)
{
{
int
retval
;
int
retval
;
...
@@ -1516,6 +1503,7 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
...
@@ -1516,6 +1503,7 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
int
len
,
prot
,
flags
,
fd
,
off1
,
off2
,
error
,
base
=
0
;
int
len
,
prot
,
flags
,
fd
,
off1
,
off2
,
error
,
base
=
0
;
unsigned
long
addr
,
pgoff
,
*
sp
;
unsigned
long
addr
,
pgoff
,
*
sp
;
struct
file
*
file
=
NULL
;
struct
file
*
file
=
NULL
;
int
err
;
if
(
regs
->
regs
[
2
]
==
1000
)
if
(
regs
->
regs
[
2
]
==
1000
)
base
=
1
;
base
=
1
;
...
@@ -1525,36 +1513,31 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
...
@@ -1525,36 +1513,31 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
prot
=
regs
->
regs
[
base
+
6
];
prot
=
regs
->
regs
[
base
+
6
];
if
(
!
base
)
{
if
(
!
base
)
{
flags
=
regs
->
regs
[
base
+
7
];
flags
=
regs
->
regs
[
base
+
7
];
if
(
!
access_ok
(
VERIFY_READ
,
sp
,
(
4
*
sizeof
(
unsigned
long
))))
{
if
(
!
access_ok
(
VERIFY_READ
,
sp
,
(
4
*
sizeof
(
unsigned
long
))))
error
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
}
fd
=
sp
[
0
];
fd
=
sp
[
0
];
__get_user
(
off1
,
&
sp
[
1
]);
err
=
__get_user
(
off1
,
&
sp
[
1
]);
__get_user
(
off2
,
&
sp
[
2
]);
err
|=
__get_user
(
off2
,
&
sp
[
2
]);
}
else
{
}
else
{
if
(
!
access_ok
(
VERIFY_READ
,
sp
,
(
5
*
sizeof
(
unsigned
long
))))
{
if
(
!
access_ok
(
VERIFY_READ
,
sp
,
(
5
*
sizeof
(
unsigned
long
))))
error
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
err
=
__get_user
(
flags
,
&
sp
[
0
]);
}
err
|=
__get_user
(
fd
,
&
sp
[
1
]);
__get_user
(
flags
,
&
sp
[
0
]);
err
|=
__get_user
(
off1
,
&
sp
[
2
]);
__get_user
(
fd
,
&
sp
[
1
]);
err
|=
__get_user
(
off2
,
&
sp
[
3
]);
__get_user
(
off1
,
&
sp
[
2
]);
__get_user
(
off2
,
&
sp
[
3
]);
}
}
if
(
off1
&
PAGE_MASK
)
{
if
(
err
)
error
=
-
EOVERFLOW
;
return
err
;
goto
out
;
}
if
(
off1
&
PAGE_MASK
)
return
-
EOVERFLOW
;
pgoff
=
(
off1
<<
(
32
-
PAGE_SHIFT
))
|
(
off2
>>
PAGE_SHIFT
);
pgoff
=
(
off1
<<
(
32
-
PAGE_SHIFT
))
|
(
off2
>>
PAGE_SHIFT
);
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
if
(
!
(
flags
&
MAP_ANONYMOUS
))
{
if
(
!
(
file
=
fget
(
fd
)))
{
if
(
!
(
file
=
fget
(
fd
)))
error
=
-
EBADF
;
return
-
EBADF
;
goto
out
;
}
/* Ok, bad taste hack follows, try to think in something else
/* Ok, bad taste hack follows, try to think in something else
when reading this */
when reading this */
...
@@ -1564,7 +1547,7 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
...
@@ -1564,7 +1547,7 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
if
(
max_size
>
file
->
f_dentry
->
d_inode
->
i_size
)
{
if
(
max_size
>
file
->
f_dentry
->
d_inode
->
i_size
)
{
old_pos
=
sys_lseek
(
fd
,
max_size
-
1
,
0
);
old_pos
=
sys_lseek
(
fd
,
max_size
-
1
,
0
);
sys_write
(
fd
,
""
,
1
);
sys_write
(
fd
,
(
void
__user
*
)
""
,
1
);
sys_lseek
(
fd
,
old_pos
,
0
);
sys_lseek
(
fd
,
old_pos
,
0
);
}
}
}
}
...
@@ -1579,7 +1562,6 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
...
@@ -1579,7 +1562,6 @@ asmlinkage int irix_mmap64(struct pt_regs *regs)
if
(
file
)
if
(
file
)
fput
(
file
);
fput
(
file
);
out:
return
error
;
return
error
;
}
}
...
@@ -1591,7 +1573,7 @@ asmlinkage int irix_dmi(struct pt_regs *regs)
...
@@ -1591,7 +1573,7 @@ asmlinkage int irix_dmi(struct pt_regs *regs)
return
-
EINVAL
;
return
-
EINVAL
;
}
}
asmlinkage
int
irix_pread
(
int
fd
,
char
*
buf
,
int
cnt
,
int
off64
,
asmlinkage
int
irix_pread
(
int
fd
,
char
__user
*
buf
,
int
cnt
,
int
off64
,
int
off1
,
int
off2
)
int
off1
,
int
off2
)
{
{
printk
(
"[%s:%d] Wheee.. irix_pread(%d,%p,%d,%d,%d,%d)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_pread(%d,%p,%d,%d,%d,%d)
\n
"
,
...
@@ -1600,7 +1582,7 @@ asmlinkage int irix_pread(int fd, char *buf, int cnt, int off64,
...
@@ -1600,7 +1582,7 @@ asmlinkage int irix_pread(int fd, char *buf, int cnt, int off64,
return
-
EINVAL
;
return
-
EINVAL
;
}
}
asmlinkage
int
irix_pwrite
(
int
fd
,
char
*
buf
,
int
cnt
,
int
off64
,
asmlinkage
int
irix_pwrite
(
int
fd
,
char
__user
*
buf
,
int
cnt
,
int
off64
,
int
off1
,
int
off2
)
int
off1
,
int
off2
)
{
{
printk
(
"[%s:%d] Wheee.. irix_pwrite(%d,%p,%d,%d,%d,%d)
\n
"
,
printk
(
"[%s:%d] Wheee.. irix_pwrite(%d,%p,%d,%d,%d,%d)
\n
"
,
...
@@ -1632,7 +1614,7 @@ struct irix_statvfs64 {
...
@@ -1632,7 +1614,7 @@ struct irix_statvfs64 {
u32
f_filler
[
16
];
u32
f_filler
[
16
];
};
};
asmlinkage
int
irix_statvfs64
(
char
*
fname
,
struct
irix_statvfs64
*
buf
)
asmlinkage
int
irix_statvfs64
(
char
__user
*
fname
,
struct
irix_statvfs64
__user
*
buf
)
{
{
struct
nameidata
nd
;
struct
nameidata
nd
;
struct
kstatfs
kbuf
;
struct
kstatfs
kbuf
;
...
@@ -1644,6 +1626,7 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
...
@@ -1644,6 +1626,7 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
error
=
-
EFAULT
;
error
=
-
EFAULT
;
goto
out
;
goto
out
;
}
}
error
=
user_path_walk
(
fname
,
&
nd
);
error
=
user_path_walk
(
fname
,
&
nd
);
if
(
error
)
if
(
error
)
goto
out
;
goto
out
;
...
@@ -1651,27 +1634,25 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
...
@@ -1651,27 +1634,25 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
if
(
error
)
if
(
error
)
goto
dput_and_out
;
goto
dput_and_out
;
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
error
=
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
error
|=
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
error
|=
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
error
|=
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
#ifdef __MIPSEB__
#ifdef __MIPSEB__
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
#else
#else
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
#endif
#endif
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
__put_user
(
0
,
&
buf
->
f_flag
);
error
|=
__put_user
(
0
,
&
buf
->
f_flag
);
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
error
|=
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
for
(
i
=
0
;
i
<
32
;
i
++
)
for
(
i
=
0
;
i
<
32
;
i
++
)
__put_user
(
0
,
&
buf
->
f_fstr
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_fstr
[
i
]);
error
=
0
;
dput_and_out:
dput_and_out:
path_release
(
&
nd
);
path_release
(
&
nd
);
...
@@ -1679,7 +1660,7 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
...
@@ -1679,7 +1660,7 @@ asmlinkage int irix_statvfs64(char *fname, struct irix_statvfs64 *buf)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_fstatvfs64
(
int
fd
,
struct
irix_statvfs
*
buf
)
asmlinkage
int
irix_fstatvfs64
(
int
fd
,
struct
irix_statvfs
__user
*
buf
)
{
{
struct
kstatfs
kbuf
;
struct
kstatfs
kbuf
;
struct
file
*
file
;
struct
file
*
file
;
...
@@ -1700,24 +1681,24 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
...
@@ -1700,24 +1681,24 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
if
(
error
)
if
(
error
)
goto
out_f
;
goto
out_f
;
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
error
=
__put_user
(
kbuf
.
f_bsize
,
&
buf
->
f_bsize
);
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
error
|=
__put_user
(
kbuf
.
f_frsize
,
&
buf
->
f_frsize
);
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
error
|=
__put_user
(
kbuf
.
f_blocks
,
&
buf
->
f_blocks
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bfree
);
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_bfree
,
&
buf
->
f_bavail
);
/* XXX hackety hack... */
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
error
|=
__put_user
(
kbuf
.
f_files
,
&
buf
->
f_files
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_ffree
);
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
error
|=
__put_user
(
kbuf
.
f_ffree
,
&
buf
->
f_favail
);
/* XXX hackety hack... */
#ifdef __MIPSEB__
#ifdef __MIPSEB__
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
1
],
&
buf
->
f_fsid
);
#else
#else
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
error
|=
__put_user
(
kbuf
.
f_fsid
.
val
[
0
],
&
buf
->
f_fsid
);
#endif
#endif
for
(
i
=
0
;
i
<
16
;
i
++
)
for
(
i
=
0
;
i
<
16
;
i
++
)
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
error
|=
__put_user
(
0
,
&
buf
->
f_basetype
[
i
]);
__put_user
(
0
,
&
buf
->
f_flag
);
error
|=
__put_user
(
0
,
&
buf
->
f_flag
);
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
error
|=
__put_user
(
kbuf
.
f_namelen
,
&
buf
->
f_namemax
);
__clear_user
(
buf
->
f_fstr
,
sizeof
(
buf
->
f_fstr
[
i
]))
;
error
|=
__clear_user
(
buf
->
f_fstr
,
sizeof
(
buf
->
f_fstr
[
i
]))
?
-
EFAULT
:
0
;
out_f:
out_f:
fput
(
file
);
fput
(
file
);
...
@@ -1725,9 +1706,9 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
...
@@ -1725,9 +1706,9 @@ asmlinkage int irix_fstatvfs64(int fd, struct irix_statvfs *buf)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_getmountid
(
char
*
fname
,
unsigned
long
*
midbuf
)
asmlinkage
int
irix_getmountid
(
char
__user
*
fname
,
unsigned
long
__user
*
midbuf
)
{
{
int
err
=
0
;
int
err
;
printk
(
"[%s:%d] irix_getmountid(%s, %p)
\n
"
,
printk
(
"[%s:%d] irix_getmountid(%s, %p)
\n
"
,
current
->
comm
,
current
->
pid
,
fname
,
midbuf
);
current
->
comm
,
current
->
pid
,
fname
,
midbuf
);
...
@@ -1740,7 +1721,7 @@ asmlinkage int irix_getmountid(char *fname, unsigned long *midbuf)
...
@@ -1740,7 +1721,7 @@ asmlinkage int irix_getmountid(char *fname, unsigned long *midbuf)
* fsid of the filesystem to try and make the right decision, but
* fsid of the filesystem to try and make the right decision, but
* we don't have this so for now. XXX
* we don't have this so for now. XXX
*/
*/
err
|
=
__put_user
(
0
,
&
midbuf
[
0
]);
err
=
__put_user
(
0
,
&
midbuf
[
0
]);
err
|=
__put_user
(
0
,
&
midbuf
[
1
]);
err
|=
__put_user
(
0
,
&
midbuf
[
1
]);
err
|=
__put_user
(
0
,
&
midbuf
[
2
]);
err
|=
__put_user
(
0
,
&
midbuf
[
2
]);
err
|=
__put_user
(
0
,
&
midbuf
[
3
]);
err
|=
__put_user
(
0
,
&
midbuf
[
3
]);
...
@@ -1767,8 +1748,8 @@ struct irix_dirent32 {
...
@@ -1767,8 +1748,8 @@ struct irix_dirent32 {
};
};
struct
irix_dirent32_callback
{
struct
irix_dirent32_callback
{
struct
irix_dirent32
*
current_dir
;
struct
irix_dirent32
__user
*
current_dir
;
struct
irix_dirent32
*
previous
;
struct
irix_dirent32
__user
*
previous
;
int
count
;
int
count
;
int
error
;
int
error
;
};
};
...
@@ -1776,13 +1757,13 @@ struct irix_dirent32_callback {
...
@@ -1776,13 +1757,13 @@ struct irix_dirent32_callback {
#define NAME_OFFSET32(de) ((int) ((de)->d_name - (char *) (de)))
#define NAME_OFFSET32(de) ((int) ((de)->d_name - (char *) (de)))
#define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
#define ROUND_UP32(x) (((x)+sizeof(u32)-1) & ~(sizeof(u32)-1))
static
int
irix_filldir32
(
void
*
__buf
,
const
char
*
name
,
int
namlen
,
static
int
irix_filldir32
(
void
*
__buf
,
const
char
*
name
,
loff_t
offset
,
ino_t
ino
,
unsigned
int
d_type
)
int
namlen
,
loff_t
offset
,
ino_t
ino
,
unsigned
int
d_type
)
{
{
struct
irix_dirent32
*
dirent
;
struct
irix_dirent32
__user
*
dirent
;
struct
irix_dirent32_callback
*
buf
=
struct
irix_dirent32_callback
*
buf
=
__buf
;
(
struct
irix_dirent32_callback
*
)
__buf
;
unsigned
short
reclen
=
ROUND_UP32
(
NAME_OFFSET32
(
dirent
)
+
namlen
+
1
);
unsigned
short
reclen
=
ROUND_UP32
(
NAME_OFFSET32
(
dirent
)
+
namlen
+
1
);
int
err
=
0
;
#ifdef DEBUG_GETDENTS
#ifdef DEBUG_GETDENTS
printk
(
"
\n
irix_filldir32[reclen<%d>namlen<%d>count<%d>]"
,
printk
(
"
\n
irix_filldir32[reclen<%d>namlen<%d>count<%d>]"
,
...
@@ -1793,25 +1774,26 @@ static int irix_filldir32(void *__buf, const char *name, int namlen,
...
@@ -1793,25 +1774,26 @@ static int irix_filldir32(void *__buf, const char *name, int namlen,
return
-
EINVAL
;
return
-
EINVAL
;
dirent
=
buf
->
previous
;
dirent
=
buf
->
previous
;
if
(
dirent
)
if
(
dirent
)
__put_user
(
offset
,
&
dirent
->
d_off
);
err
=
__put_user
(
offset
,
&
dirent
->
d_off
);
dirent
=
buf
->
current_dir
;
dirent
=
buf
->
current_dir
;
buf
->
previous
=
dirent
;
err
|=
__put_user
(
dirent
,
&
buf
->
previous
);
__put_user
(
ino
,
&
dirent
->
d_ino
);
err
|=
__put_user
(
ino
,
&
dirent
->
d_ino
);
__put_user
(
reclen
,
&
dirent
->
d_reclen
);
err
|=
__put_user
(
reclen
,
&
dirent
->
d_reclen
);
copy_to_user
(
dirent
->
d_name
,
name
,
namlen
);
err
|=
copy_to_user
((
char
__user
*
)
dirent
->
d_name
,
name
,
namlen
)
?
-
EFAULT
:
0
;
__put_user
(
0
,
&
dirent
->
d_name
[
namlen
]);
err
|=
__put_user
(
0
,
&
dirent
->
d_name
[
namlen
]);
((
char
*
)
dirent
)
+=
reclen
;
dirent
=
(
struct
irix_dirent32
__user
*
)
((
char
__user
*
)
dirent
+
reclen
);
buf
->
current_dir
=
dirent
;
buf
->
current_dir
=
dirent
;
buf
->
count
-=
reclen
;
buf
->
count
-=
reclen
;
return
0
;
return
err
;
}
}
asmlinkage
int
irix_ngetdents
(
unsigned
int
fd
,
void
*
dirent
,
asmlinkage
int
irix_ngetdents
(
unsigned
int
fd
,
void
__user
*
dirent
,
unsigned
int
count
,
int
*
eob
)
unsigned
int
count
,
int
__user
*
eob
)
{
{
struct
file
*
file
;
struct
file
*
file
;
struct
irix_dirent32
*
lastdirent
;
struct
irix_dirent32
__user
*
lastdirent
;
struct
irix_dirent32_callback
buf
;
struct
irix_dirent32_callback
buf
;
int
error
;
int
error
;
...
@@ -1824,7 +1806,7 @@ asmlinkage int irix_ngetdents(unsigned int fd, void * dirent,
...
@@ -1824,7 +1806,7 @@ asmlinkage int irix_ngetdents(unsigned int fd, void * dirent,
if
(
!
file
)
if
(
!
file
)
goto
out
;
goto
out
;
buf
.
current_dir
=
(
struct
irix_dirent32
*
)
dirent
;
buf
.
current_dir
=
(
struct
irix_dirent32
__user
*
)
dirent
;
buf
.
previous
=
NULL
;
buf
.
previous
=
NULL
;
buf
.
count
=
count
;
buf
.
count
=
count
;
buf
.
error
=
0
;
buf
.
error
=
0
;
...
@@ -1864,8 +1846,8 @@ struct irix_dirent64 {
...
@@ -1864,8 +1846,8 @@ struct irix_dirent64 {
};
};
struct
irix_dirent64_callback
{
struct
irix_dirent64_callback
{
struct
irix_dirent64
*
curr
;
struct
irix_dirent64
__user
*
curr
;
struct
irix_dirent64
*
previous
;
struct
irix_dirent64
__user
*
previous
;
int
count
;
int
count
;
int
error
;
int
error
;
};
};
...
@@ -1873,37 +1855,44 @@ struct irix_dirent64_callback {
...
@@ -1873,37 +1855,44 @@ struct irix_dirent64_callback {
#define NAME_OFFSET64(de) ((int) ((de)->d_name - (char *) (de)))
#define NAME_OFFSET64(de) ((int) ((de)->d_name - (char *) (de)))
#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
#define ROUND_UP64(x) (((x)+sizeof(u64)-1) & ~(sizeof(u64)-1))
static
int
irix_filldir64
(
void
*
__buf
,
const
char
*
name
,
int
namlen
,
static
int
irix_filldir64
(
void
*
__buf
,
const
char
*
name
,
loff_t
offset
,
ino_t
ino
,
unsigned
int
d_type
)
int
namlen
,
loff_t
offset
,
ino_t
ino
,
unsigned
int
d_type
)
{
{
struct
irix_dirent64
*
dirent
;
struct
irix_dirent64
__user
*
dirent
;
struct
irix_dirent64_callback
*
buf
=
struct
irix_dirent64_callback
*
buf
=
__buf
;
(
struct
irix_dirent64_callback
*
)
__buf
;
unsigned
short
reclen
=
ROUND_UP64
(
NAME_OFFSET64
(
dirent
)
+
namlen
+
1
);
unsigned
short
reclen
=
ROUND_UP64
(
NAME_OFFSET64
(
dirent
)
+
namlen
+
1
);
int
err
=
0
;
buf
->
error
=
-
EINVAL
;
/* only used if we fail.. */
if
(
!
access_ok
(
VERIFY_WRITE
,
buf
,
sizeof
(
*
buf
)))
return
-
EFAULT
;
if
(
__put_user
(
-
EINVAL
,
&
buf
->
error
))
/* only used if we fail.. */
return
-
EFAULT
;
if
(
reclen
>
buf
->
count
)
if
(
reclen
>
buf
->
count
)
return
-
EINVAL
;
return
-
EINVAL
;
dirent
=
buf
->
previous
;
dirent
=
buf
->
previous
;
if
(
dirent
)
if
(
dirent
)
__put_user
(
offset
,
&
dirent
->
d_off
);
err
=
__put_user
(
offset
,
&
dirent
->
d_off
);
dirent
=
buf
->
curr
;
dirent
=
buf
->
curr
;
buf
->
previous
=
dirent
;
buf
->
previous
=
dirent
;
__put_user
(
ino
,
&
dirent
->
d_ino
);
err
|=
__put_user
(
ino
,
&
dirent
->
d_ino
);
__put_user
(
reclen
,
&
dirent
->
d_reclen
);
err
|=
__put_user
(
reclen
,
&
dirent
->
d_reclen
);
__copy_to_user
(
dirent
->
d_name
,
name
,
namlen
);
err
|=
__copy_to_user
((
char
__user
*
)
dirent
->
d_name
,
name
,
namlen
)
__put_user
(
0
,
&
dirent
->
d_name
[
namlen
]);
?
-
EFAULT
:
0
;
((
char
*
)
dirent
)
+=
reclen
;
err
|=
__put_user
(
0
,
&
dirent
->
d_name
[
namlen
]);
dirent
=
(
struct
irix_dirent64
__user
*
)
((
char
__user
*
)
dirent
+
reclen
);
buf
->
curr
=
dirent
;
buf
->
curr
=
dirent
;
buf
->
count
-=
reclen
;
buf
->
count
-=
reclen
;
return
0
;
return
err
;
}
}
asmlinkage
int
irix_getdents64
(
int
fd
,
void
*
dirent
,
int
cnt
)
asmlinkage
int
irix_getdents64
(
int
fd
,
void
__user
*
dirent
,
int
cnt
)
{
{
struct
file
*
file
;
struct
file
*
file
;
struct
irix_dirent64
*
lastdirent
;
struct
irix_dirent64
__user
*
lastdirent
;
struct
irix_dirent64_callback
buf
;
struct
irix_dirent64_callback
buf
;
int
error
;
int
error
;
...
@@ -1923,7 +1912,7 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
...
@@ -1923,7 +1912,7 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
if
(
cnt
<
(
sizeof
(
struct
irix_dirent64
)
+
255
))
if
(
cnt
<
(
sizeof
(
struct
irix_dirent64
)
+
255
))
goto
out_f
;
goto
out_f
;
buf
.
curr
=
(
struct
irix_dirent64
*
)
dirent
;
buf
.
curr
=
(
struct
irix_dirent64
__user
*
)
dirent
;
buf
.
previous
=
NULL
;
buf
.
previous
=
NULL
;
buf
.
count
=
cnt
;
buf
.
count
=
cnt
;
buf
.
error
=
0
;
buf
.
error
=
0
;
...
@@ -1935,7 +1924,8 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
...
@@ -1935,7 +1924,8 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
error
=
buf
.
error
;
error
=
buf
.
error
;
goto
out_f
;
goto
out_f
;
}
}
lastdirent
->
d_off
=
(
u64
)
file
->
f_pos
;
if
(
put_user
(
file
->
f_pos
,
&
lastdirent
->
d_off
))
return
-
EFAULT
;
#ifdef DEBUG_GETDENTS
#ifdef DEBUG_GETDENTS
printk
(
"returning %d
\n
"
,
cnt
-
buf
.
count
);
printk
(
"returning %d
\n
"
,
cnt
-
buf
.
count
);
#endif
#endif
...
@@ -1947,10 +1937,10 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
...
@@ -1947,10 +1937,10 @@ asmlinkage int irix_getdents64(int fd, void *dirent, int cnt)
return
error
;
return
error
;
}
}
asmlinkage
int
irix_ngetdents64
(
int
fd
,
void
*
dirent
,
int
cnt
,
int
*
eob
)
asmlinkage
int
irix_ngetdents64
(
int
fd
,
void
__user
*
dirent
,
int
cnt
,
int
*
eob
)
{
{
struct
file
*
file
;
struct
file
*
file
;
struct
irix_dirent64
*
lastdirent
;
struct
irix_dirent64
__user
*
lastdirent
;
struct
irix_dirent64_callback
buf
;
struct
irix_dirent64_callback
buf
;
int
error
;
int
error
;
...
@@ -1972,7 +1962,7 @@ asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob)
...
@@ -1972,7 +1962,7 @@ asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob)
goto
out_f
;
goto
out_f
;
*
eob
=
0
;
*
eob
=
0
;
buf
.
curr
=
(
struct
irix_dirent64
*
)
dirent
;
buf
.
curr
=
(
struct
irix_dirent64
__user
*
)
dirent
;
buf
.
previous
=
NULL
;
buf
.
previous
=
NULL
;
buf
.
count
=
cnt
;
buf
.
count
=
cnt
;
buf
.
error
=
0
;
buf
.
error
=
0
;
...
@@ -1984,7 +1974,8 @@ asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob)
...
@@ -1984,7 +1974,8 @@ asmlinkage int irix_ngetdents64(int fd, void *dirent, int cnt, int *eob)
error
=
buf
.
error
;
error
=
buf
.
error
;
goto
out_f
;
goto
out_f
;
}
}
lastdirent
->
d_off
=
(
u64
)
file
->
f_pos
;
if
(
put_user
(
file
->
f_pos
,
&
lastdirent
->
d_off
))
return
-
EFAULT
;
#ifdef DEBUG_GETDENTS
#ifdef DEBUG_GETDENTS
printk
(
"eob=%d returning %d
\n
"
,
*
eob
,
cnt
-
buf
.
count
);
printk
(
"eob=%d returning %d
\n
"
,
*
eob
,
cnt
-
buf
.
count
);
#endif
#endif
...
@@ -2047,14 +2038,14 @@ asmlinkage int irix_uadmin(unsigned long op, unsigned long func, unsigned long a
...
@@ -2047,14 +2038,14 @@ asmlinkage int irix_uadmin(unsigned long op, unsigned long func, unsigned long a
return
retval
;
return
retval
;
}
}
asmlinkage
int
irix_utssys
(
char
*
inbuf
,
int
arg
,
int
type
,
cha
r
*
outbuf
)
asmlinkage
int
irix_utssys
(
char
__user
*
inbuf
,
int
arg
,
int
type
,
char
__use
r
*
outbuf
)
{
{
int
retval
;
int
retval
;
switch
(
type
)
{
switch
(
type
)
{
case
0
:
case
0
:
/* uname() */
/* uname() */
retval
=
irix_uname
((
struct
iuname
*
)
inbuf
);
retval
=
irix_uname
((
struct
iuname
__user
*
)
inbuf
);
goto
out
;
goto
out
;
case
2
:
case
2
:
...
...
arch/mips/kernel/traps.c
View file @
fe00f943
...
@@ -339,9 +339,9 @@ asmlinkage void do_be(struct pt_regs *regs)
...
@@ -339,9 +339,9 @@ asmlinkage void do_be(struct pt_regs *regs)
static
inline
int
get_insn_opcode
(
struct
pt_regs
*
regs
,
unsigned
int
*
opcode
)
static
inline
int
get_insn_opcode
(
struct
pt_regs
*
regs
,
unsigned
int
*
opcode
)
{
{
unsigned
int
*
epc
;
unsigned
int
__user
*
epc
;
epc
=
(
unsigned
int
*
)
regs
->
cp0_epc
+
epc
=
(
unsigned
int
__user
*
)
regs
->
cp0_epc
+
((
regs
->
cp0_cause
&
CAUSEF_BD
)
!=
0
);
((
regs
->
cp0_cause
&
CAUSEF_BD
)
!=
0
);
if
(
!
get_user
(
*
opcode
,
epc
))
if
(
!
get_user
(
*
opcode
,
epc
))
return
0
;
return
0
;
...
@@ -371,7 +371,7 @@ static struct task_struct *ll_task = NULL;
...
@@ -371,7 +371,7 @@ static struct task_struct *ll_task = NULL;
static
inline
void
simulate_ll
(
struct
pt_regs
*
regs
,
unsigned
int
opcode
)
static
inline
void
simulate_ll
(
struct
pt_regs
*
regs
,
unsigned
int
opcode
)
{
{
unsigned
long
value
,
*
vaddr
;
unsigned
long
value
,
__user
*
vaddr
;
long
offset
;
long
offset
;
int
signal
=
0
;
int
signal
=
0
;
...
@@ -385,7 +385,8 @@ static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
...
@@ -385,7 +385,8 @@ static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
offset
<<=
16
;
offset
<<=
16
;
offset
>>=
16
;
offset
>>=
16
;
vaddr
=
(
unsigned
long
*
)((
long
)(
regs
->
regs
[(
opcode
&
BASE
)
>>
21
])
+
offset
);
vaddr
=
(
unsigned
long
__user
*
)
((
unsigned
long
)(
regs
->
regs
[(
opcode
&
BASE
)
>>
21
])
+
offset
);
if
((
unsigned
long
)
vaddr
&
3
)
{
if
((
unsigned
long
)
vaddr
&
3
)
{
signal
=
SIGBUS
;
signal
=
SIGBUS
;
...
@@ -418,7 +419,8 @@ static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
...
@@ -418,7 +419,8 @@ static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
static
inline
void
simulate_sc
(
struct
pt_regs
*
regs
,
unsigned
int
opcode
)
static
inline
void
simulate_sc
(
struct
pt_regs
*
regs
,
unsigned
int
opcode
)
{
{
unsigned
long
*
vaddr
,
reg
;
unsigned
long
__user
*
vaddr
;
unsigned
long
reg
;
long
offset
;
long
offset
;
int
signal
=
0
;
int
signal
=
0
;
...
@@ -432,7 +434,8 @@ static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
...
@@ -432,7 +434,8 @@ static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
offset
<<=
16
;
offset
<<=
16
;
offset
>>=
16
;
offset
>>=
16
;
vaddr
=
(
unsigned
long
*
)((
long
)(
regs
->
regs
[(
opcode
&
BASE
)
>>
21
])
+
offset
);
vaddr
=
(
unsigned
long
__user
*
)
((
unsigned
long
)(
regs
->
regs
[(
opcode
&
BASE
)
>>
21
])
+
offset
);
reg
=
(
opcode
&
RT
)
>>
16
;
reg
=
(
opcode
&
RT
)
>>
16
;
if
((
unsigned
long
)
vaddr
&
3
)
{
if
((
unsigned
long
)
vaddr
&
3
)
{
...
@@ -498,7 +501,7 @@ asmlinkage void do_ov(struct pt_regs *regs)
...
@@ -498,7 +501,7 @@ asmlinkage void do_ov(struct pt_regs *regs)
info
.
si_code
=
FPE_INTOVF
;
info
.
si_code
=
FPE_INTOVF
;
info
.
si_signo
=
SIGFPE
;
info
.
si_signo
=
SIGFPE
;
info
.
si_errno
=
0
;
info
.
si_errno
=
0
;
info
.
si_addr
=
(
void
*
)
regs
->
cp0_epc
;
info
.
si_addr
=
(
void
__user
*
)
regs
->
cp0_epc
;
force_sig_info
(
SIGFPE
,
&
info
,
current
);
force_sig_info
(
SIGFPE
,
&
info
,
current
);
}
}
...
@@ -584,7 +587,7 @@ asmlinkage void do_bp(struct pt_regs *regs)
...
@@ -584,7 +587,7 @@ asmlinkage void do_bp(struct pt_regs *regs)
info
.
si_code
=
FPE_INTOVF
;
info
.
si_code
=
FPE_INTOVF
;
info
.
si_signo
=
SIGFPE
;
info
.
si_signo
=
SIGFPE
;
info
.
si_errno
=
0
;
info
.
si_errno
=
0
;
info
.
si_addr
=
(
void
*
)
regs
->
cp0_epc
;
info
.
si_addr
=
(
void
__user
*
)
regs
->
cp0_epc
;
force_sig_info
(
SIGFPE
,
&
info
,
current
);
force_sig_info
(
SIGFPE
,
&
info
,
current
);
break
;
break
;
default:
default:
...
@@ -621,7 +624,7 @@ asmlinkage void do_tr(struct pt_regs *regs)
...
@@ -621,7 +624,7 @@ asmlinkage void do_tr(struct pt_regs *regs)
info
.
si_code
=
FPE_INTOVF
;
info
.
si_code
=
FPE_INTOVF
;
info
.
si_signo
=
SIGFPE
;
info
.
si_signo
=
SIGFPE
;
info
.
si_errno
=
0
;
info
.
si_errno
=
0
;
info
.
si_addr
=
(
void
*
)
regs
->
cp0_epc
;
info
.
si_addr
=
(
void
__user
*
)
regs
->
cp0_epc
;
force_sig_info
(
SIGFPE
,
&
info
,
current
);
force_sig_info
(
SIGFPE
,
&
info
,
current
);
break
;
break
;
default:
default:
...
...
arch/mips/kernel/unaligned.c
View file @
fe00f943
...
@@ -94,7 +94,7 @@ unsigned long unaligned_instructions;
...
@@ -94,7 +94,7 @@ unsigned long unaligned_instructions;
#endif
#endif
static
inline
int
emulate_load_store_insn
(
struct
pt_regs
*
regs
,
static
inline
int
emulate_load_store_insn
(
struct
pt_regs
*
regs
,
void
*
addr
,
unsigned
long
pc
,
void
__user
*
addr
,
unsigned
int
__user
*
pc
,
unsigned
long
**
regptr
,
unsigned
long
*
newvalue
)
unsigned
long
**
regptr
,
unsigned
long
*
newvalue
)
{
{
union
mips_instruction
insn
;
union
mips_instruction
insn
;
...
@@ -107,7 +107,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
...
@@ -107,7 +107,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
/*
/*
* This load never faults.
* This load never faults.
*/
*/
__get_user
(
insn
.
word
,
(
unsigned
int
*
)
pc
);
__get_user
(
insn
.
word
,
pc
);
switch
(
insn
.
i_format
.
opcode
)
{
switch
(
insn
.
i_format
.
opcode
)
{
/*
/*
...
@@ -494,8 +494,8 @@ asmlinkage void do_ade(struct pt_regs *regs)
...
@@ -494,8 +494,8 @@ asmlinkage void do_ade(struct pt_regs *regs)
{
{
unsigned
long
*
regptr
,
newval
;
unsigned
long
*
regptr
,
newval
;
extern
int
do_dsemulret
(
struct
pt_regs
*
);
extern
int
do_dsemulret
(
struct
pt_regs
*
);
unsigned
int
__user
*
pc
;
mm_segment_t
seg
;
mm_segment_t
seg
;
unsigned
long
pc
;
/*
/*
* Address errors may be deliberately induced by the FPU emulator to
* Address errors may be deliberately induced by the FPU emulator to
...
@@ -515,7 +515,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
...
@@ -515,7 +515,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
if
((
regs
->
cp0_badvaddr
==
regs
->
cp0_epc
)
||
(
regs
->
cp0_epc
&
0x1
))
if
((
regs
->
cp0_badvaddr
==
regs
->
cp0_epc
)
||
(
regs
->
cp0_epc
&
0x1
))
goto
sigbus
;
goto
sigbus
;
pc
=
exception_epc
(
regs
);
pc
=
(
unsigned
int
__user
*
)
exception_epc
(
regs
);
if
((
current
->
thread
.
mflags
&
MF_FIXADE
)
==
0
)
if
((
current
->
thread
.
mflags
&
MF_FIXADE
)
==
0
)
goto
sigbus
;
goto
sigbus
;
...
@@ -526,7 +526,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
...
@@ -526,7 +526,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
seg
=
get_fs
();
seg
=
get_fs
();
if
(
!
user_mode
(
regs
))
if
(
!
user_mode
(
regs
))
set_fs
(
KERNEL_DS
);
set_fs
(
KERNEL_DS
);
if
(
!
emulate_load_store_insn
(
regs
,
(
void
*
)
regs
->
cp0_badvaddr
,
pc
,
if
(
!
emulate_load_store_insn
(
regs
,
(
void
__user
*
)
regs
->
cp0_badvaddr
,
pc
,
&
regptr
,
&
newval
))
{
&
regptr
,
&
newval
))
{
compute_return_epc
(
regs
);
compute_return_epc
(
regs
);
/*
/*
...
...
arch/mips/lib/csum_partial_copy.c
View file @
fe00f943
...
@@ -33,7 +33,7 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src,
...
@@ -33,7 +33,7 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src,
* Copy from userspace and compute checksum. If we catch an exception
* Copy from userspace and compute checksum. If we catch an exception
* then zero the rest of the buffer.
* then zero the rest of the buffer.
*/
*/
unsigned
int
csum_partial_copy_from_user
(
const
unsigned
char
*
src
,
unsigned
int
csum_partial_copy_from_user
(
const
unsigned
char
__user
*
src
,
unsigned
char
*
dst
,
int
len
,
unsigned
int
sum
,
int
*
err_ptr
)
unsigned
char
*
dst
,
int
len
,
unsigned
int
sum
,
int
*
err_ptr
)
{
{
int
missing
;
int
missing
;
...
...
arch/mips/mm/c-r4k.c
View file @
fe00f943
...
@@ -456,8 +456,8 @@ static void r4k_flush_data_cache_page(unsigned long addr)
...
@@ -456,8 +456,8 @@ static void r4k_flush_data_cache_page(unsigned long addr)
}
}
struct
flush_icache_range_args
{
struct
flush_icache_range_args
{
unsigned
long
start
;
unsigned
long
__user
start
;
unsigned
long
end
;
unsigned
long
__user
end
;
};
};
static
inline
void
local_r4k_flush_icache_range
(
void
*
args
)
static
inline
void
local_r4k_flush_icache_range
(
void
*
args
)
...
@@ -519,7 +519,8 @@ static inline void local_r4k_flush_icache_range(void *args)
...
@@ -519,7 +519,8 @@ static inline void local_r4k_flush_icache_range(void *args)
}
}
}
}
static
void
r4k_flush_icache_range
(
unsigned
long
start
,
unsigned
long
end
)
static
void
r4k_flush_icache_range
(
unsigned
long
__user
start
,
unsigned
long
__user
end
)
{
{
struct
flush_icache_range_args
args
;
struct
flush_icache_range_args
args
;
...
...
arch/mips/mm/cache.c
View file @
fe00f943
...
@@ -24,7 +24,8 @@ void (*flush_cache_mm)(struct mm_struct *mm);
...
@@ -24,7 +24,8 @@ void (*flush_cache_mm)(struct mm_struct *mm);
void
(
*
flush_cache_range
)(
struct
vm_area_struct
*
vma
,
unsigned
long
start
,
void
(
*
flush_cache_range
)(
struct
vm_area_struct
*
vma
,
unsigned
long
start
,
unsigned
long
end
);
unsigned
long
end
);
void
(
*
flush_cache_page
)(
struct
vm_area_struct
*
vma
,
unsigned
long
page
,
unsigned
long
pfn
);
void
(
*
flush_cache_page
)(
struct
vm_area_struct
*
vma
,
unsigned
long
page
,
unsigned
long
pfn
);
void
(
*
flush_icache_range
)(
unsigned
long
start
,
unsigned
long
end
);
void
(
*
flush_icache_range
)(
unsigned
long
__user
start
,
unsigned
long
__user
end
);
void
(
*
flush_icache_page
)(
struct
vm_area_struct
*
vma
,
struct
page
*
page
);
void
(
*
flush_icache_page
)(
struct
vm_area_struct
*
vma
,
struct
page
*
page
);
/* MIPS specific cache operations */
/* MIPS specific cache operations */
...
@@ -49,10 +50,10 @@ EXPORT_SYMBOL(_dma_cache_inv);
...
@@ -49,10 +50,10 @@ EXPORT_SYMBOL(_dma_cache_inv);
* We could optimize the case where the cache argument is not BCACHE but
* We could optimize the case where the cache argument is not BCACHE but
* that seems very atypical use ...
* that seems very atypical use ...
*/
*/
asmlinkage
int
sys_cacheflush
(
unsigned
long
addr
,
unsigned
long
int
bytes
,
asmlinkage
int
sys_cacheflush
(
unsigned
long
__user
addr
,
unsigned
int
cache
)
unsigned
long
bytes
,
unsigned
int
cache
)
{
{
if
(
!
access_ok
(
VERIFY_WRITE
,
(
void
*
)
addr
,
bytes
))
if
(
!
access_ok
(
VERIFY_WRITE
,
(
void
__user
*
)
addr
,
bytes
))
return
-
EFAULT
;
return
-
EFAULT
;
flush_icache_range
(
addr
,
addr
+
bytes
);
flush_icache_range
(
addr
,
addr
+
bytes
);
...
...
arch/mips/mm/fault.c
View file @
fe00f943
...
@@ -141,7 +141,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
...
@@ -141,7 +141,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
info
.
si_signo
=
SIGSEGV
;
info
.
si_signo
=
SIGSEGV
;
info
.
si_errno
=
0
;
info
.
si_errno
=
0
;
/* info.si_code has been set above */
/* info.si_code has been set above */
info
.
si_addr
=
(
void
*
)
address
;
info
.
si_addr
=
(
void
__user
*
)
address
;
force_sig_info
(
SIGSEGV
,
&
info
,
tsk
);
force_sig_info
(
SIGSEGV
,
&
info
,
tsk
);
return
;
return
;
}
}
...
@@ -197,7 +197,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
...
@@ -197,7 +197,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
info
.
si_signo
=
SIGBUS
;
info
.
si_signo
=
SIGBUS
;
info
.
si_errno
=
0
;
info
.
si_errno
=
0
;
info
.
si_code
=
BUS_ADRERR
;
info
.
si_code
=
BUS_ADRERR
;
info
.
si_addr
=
(
void
*
)
address
;
info
.
si_addr
=
(
void
__user
*
)
address
;
force_sig_info
(
SIGBUS
,
&
info
,
tsk
);
force_sig_info
(
SIGBUS
,
&
info
,
tsk
);
return
;
return
;
...
...
include/asm-mips/cacheflush.h
View file @
fe00f943
...
@@ -49,7 +49,8 @@ static inline void flush_dcache_page(struct page *page)
...
@@ -49,7 +49,8 @@ static inline void flush_dcache_page(struct page *page)
extern
void
(
*
flush_icache_page
)(
struct
vm_area_struct
*
vma
,
extern
void
(
*
flush_icache_page
)(
struct
vm_area_struct
*
vma
,
struct
page
*
page
);
struct
page
*
page
);
extern
void
(
*
flush_icache_range
)(
unsigned
long
start
,
unsigned
long
end
);
extern
void
(
*
flush_icache_range
)(
unsigned
long
__user
start
,
unsigned
long
__user
end
);
#define flush_cache_vmap(start, end) flush_cache_all()
#define flush_cache_vmap(start, end) flush_cache_all()
#define flush_cache_vunmap(start, end) flush_cache_all()
#define flush_cache_vunmap(start, end) flush_cache_all()
...
...
include/asm-mips/checksum.h
View file @
fe00f943
...
@@ -34,7 +34,8 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
...
@@ -34,7 +34,8 @@ unsigned int csum_partial(const unsigned char *buff, int len, unsigned int sum);
* this is a new version of the above that records errors it finds in *errp,
* this is a new version of the above that records errors it finds in *errp,
* but continues and zeros the rest of the buffer.
* but continues and zeros the rest of the buffer.
*/
*/
unsigned
int
csum_partial_copy_from_user
(
const
unsigned
char
*
src
,
unsigned
char
*
dst
,
int
len
,
unsigned
int
csum_partial_copy_from_user
(
const
unsigned
char
__user
*
src
,
unsigned
char
*
dst
,
int
len
,
unsigned
int
sum
,
int
*
errp
);
unsigned
int
sum
,
int
*
errp
);
/*
/*
...
...
include/asm-mips/io.h
View file @
fe00f943
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include <asm/page.h>
#include <asm/page.h>
#include <asm/pgtable-bits.h>
#include <asm/pgtable-bits.h>
#include <asm/processor.h>
#include <asm/processor.h>
#include <asm/string.h>
#include <mangle-port.h>
#include <mangle-port.h>
...
@@ -217,7 +218,7 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
...
@@ -217,7 +218,7 @@ static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
*/
*/
if
(
flags
==
_CACHE_UNCACHED
)
if
(
flags
==
_CACHE_UNCACHED
)
base
=
(
u64
)
IO_BASE
;
base
=
(
u64
)
IO_BASE
;
return
(
void
*
)
(
unsigned
long
)
(
base
+
offset
);
return
(
void
__iomem
*
)
(
unsigned
long
)
(
base
+
offset
);
}
}
return
__ioremap
(
offset
,
size
,
flags
);
return
__ioremap
(
offset
,
size
,
flags
);
...
@@ -486,9 +487,18 @@ BUILDSTRING(q, u64)
...
@@ -486,9 +487,18 @@ BUILDSTRING(q, u64)
/* Depends on MIPS II instruction set */
/* Depends on MIPS II instruction set */
#define mmiowb() asm volatile ("sync" ::: "memory")
#define mmiowb() asm volatile ("sync" ::: "memory")
#define memset_io(a,b,c) memset((void *)(a),(b),(c))
static
inline
void
memset_io
(
volatile
void
__iomem
*
addr
,
unsigned
char
val
,
int
count
)
#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
{
#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
memset
((
void
__force
*
)
addr
,
val
,
count
);
}
static
inline
void
memcpy_fromio
(
void
*
dst
,
const
volatile
void
__iomem
*
src
,
int
count
)
{
memcpy
(
dst
,
(
void
__force
*
)
src
,
count
);
}
static
inline
void
memcpy_toio
(
volatile
void
__iomem
*
dst
,
const
void
*
src
,
int
count
)
{
memcpy
((
void
__force
*
)
dst
,
src
,
count
);
}
/*
/*
* Memory Mapped I/O
* Memory Mapped I/O
...
...
include/asm-mips/irq.h
View file @
fe00f943
...
@@ -24,11 +24,9 @@ static inline int irq_canonicalize(int irq)
...
@@ -24,11 +24,9 @@ static inline int irq_canonicalize(int irq)
struct
pt_regs
;
struct
pt_regs
;
#ifdef CONFIG_PREEMPT
extern
asmlinkage
unsigned
int
do_IRQ
(
unsigned
int
irq
,
struct
pt_regs
*
regs
);
extern
asmlinkage
unsigned
int
do_IRQ
(
unsigned
int
irq
,
struct
pt_regs
*
regs
);
#
else
#
ifdef CONFIG_PREEMPT
/*
/*
* do_IRQ handles all normal device IRQ's (the special
* do_IRQ handles all normal device IRQ's (the special
...
...
include/asm-mips/sibyte/sb1250.h
View file @
fe00f943
...
@@ -58,6 +58,6 @@ extern void prom_printf(char *fmt, ...);
...
@@ -58,6 +58,6 @@ extern void prom_printf(char *fmt, ...);
#endif
#endif
#define IOADDR(a) ((vo
id
*)(IO_BASE + (a)))
#define IOADDR(a) ((vo
latile void __iomem
*)(IO_BASE + (a)))
#endif
#endif
include/asm-mips/uaccess.h
View file @
fe00f943
...
@@ -196,63 +196,56 @@
...
@@ -196,63 +196,56 @@
__get_user_nocheck((x),(ptr),sizeof(*(ptr)))
__get_user_nocheck((x),(ptr),sizeof(*(ptr)))
struct
__large_struct
{
unsigned
long
buf
[
100
];
};
struct
__large_struct
{
unsigned
long
buf
[
100
];
};
#define __m(x) (*(struct __large_struct *)(x))
#define __m(x) (*(struct __large_struct
__user
*)(x))
/*
/*
* Yuck. We need two variants, one for 64bit operation and one
* Yuck. We need two variants, one for 64bit operation and one
* for 32 bit mode and old iron.
* for 32 bit mode and old iron.
*/
*/
#ifdef __mips64
#ifdef __mips64
#define __GET_USER_DW(
__gu_err) __get_user_asm("ld", __gu_er
r)
#define __GET_USER_DW(
ptr) __get_user_asm("ld", pt
r)
#else
#else
#define __GET_USER_DW(
__gu_err) __get_user_asm_ll32(__gu_er
r)
#define __GET_USER_DW(
ptr) __get_user_asm_ll32(pt
r)
#endif
#endif
#define __get_user_nocheck(x,ptr,size) \
#define __get_user_nocheck(x,ptr,size) \
({ \
({ \
__typeof(*(ptr)) __gu_val = 0; \
__typeof(*(ptr)) __gu_val = (__typeof(*(ptr))) 0; \
long __gu_addr; \
long __gu_err = 0; \
long __gu_err = 0; \
\
\
might_sleep(); \
might_sleep(); \
__gu_addr = (long) (ptr); \
switch (size) { \
switch (size) { \
case 1: __get_user_asm("lb",
__gu_er
r); break; \
case 1: __get_user_asm("lb",
pt
r); break; \
case 2: __get_user_asm("lh",
__gu_er
r); break; \
case 2: __get_user_asm("lh",
pt
r); break; \
case 4: __get_user_asm("lw",
__gu_er
r); break; \
case 4: __get_user_asm("lw",
pt
r); break; \
case 8: __GET_USER_DW(
__gu_er
r); break; \
case 8: __GET_USER_DW(
pt
r); break; \
default: __get_user_unknown(); break; \
default: __get_user_unknown(); break; \
} \
} \
x
= (__typeof__(*(ptr))) __gu_val; \
(x)
= (__typeof__(*(ptr))) __gu_val; \
__gu_err; \
__gu_err; \
})
})
#define __get_user_check(x,ptr,size) \
#define __get_user_check(x,ptr,size) \
({ \
({ \
const __typeof__(*(ptr)) __user * __gu_addr = (ptr); \
__typeof__(*(ptr)) __gu_val = 0; \
__typeof__(*(ptr)) __gu_val = 0; \
long __gu_addr; \
long __gu_err = -EFAULT; \
long __gu_err; \
\
\
might_sleep(); \
if (likely(access_ok(VERIFY_READ, __gu_addr, size))) { \
__gu_addr = (long) (ptr); \
__gu_err = access_ok(VERIFY_READ, (void *) __gu_addr, size) \
? 0 : -EFAULT; \
\
if (likely(!__gu_err)) { \
switch (size) { \
switch (size) { \
case 1: __get_user_asm("lb", __gu_
er
r); break; \
case 1: __get_user_asm("lb", __gu_
add
r); break; \
case 2: __get_user_asm("lh", __gu_
er
r); break; \
case 2: __get_user_asm("lh", __gu_
add
r); break; \
case 4: __get_user_asm("lw", __gu_
er
r); break; \
case 4: __get_user_asm("lw", __gu_
add
r); break; \
case 8: __GET_USER_DW(__gu_
err); break;
\
case 8: __GET_USER_DW(__gu_
addr); break;
\
default: __get_user_unknown(); break; \
default: __get_user_unknown(); break; \
} \
} \
} \
} \
x
= (__typeof__(*(ptr))) __gu_val; \
(x)
= (__typeof__(*(ptr))) __gu_val; \
__gu_err; \
__gu_err; \
})
})
#define __get_user_asm(insn,
__gu_er
r) \
#define __get_user_asm(insn,
add
r) \
(
{ \
{ \
__asm__ __volatile__( \
__asm__ __volatile__( \
"1: " insn " %1, %3 \n" \
"1: " insn " %1, %3 \n" \
"2: \n" \
"2: \n" \
...
@@ -264,20 +257,20 @@ struct __large_struct { unsigned long buf[100]; };
...
@@ -264,20 +257,20 @@ struct __large_struct { unsigned long buf[100]; };
" "__UA_ADDR "\t1b, 3b \n" \
" "__UA_ADDR "\t1b, 3b \n" \
" .previous \n" \
" .previous \n" \
: "=r" (__gu_err), "=r" (__gu_val) \
: "=r" (__gu_err), "=r" (__gu_val) \
: "0" (
__gu_err), "o" (__m(__gu_addr)), "i" (-EFAULT));
\
: "0" (
0), "o" (__m(addr)), "i" (-EFAULT));
\
}
)
}
/*
/*
* Get a long long 64 using 32 bit registers.
* Get a long long 64 using 32 bit registers.
*/
*/
#define __get_user_asm_ll32(
__gu_er
r) \
#define __get_user_asm_ll32(
add
r) \
(
{ \
{ \
__asm__ __volatile__( \
__asm__ __volatile__( \
"1: lw %1,
%3
\n" \
"1: lw %1,
(%3)
\n" \
"2: lw %D1,
%4
\n" \
"2: lw %D1,
4(%3)
\n" \
" move %0, $0 \n" \
" move %0, $0 \n" \
"3: .section .fixup,\"ax\" \n" \
"3: .section .fixup,\"ax\" \n" \
"4: li %0, %
5
\n" \
"4: li %0, %
4
\n" \
" move %1, $0 \n" \
" move %1, $0 \n" \
" move %D1, $0 \n" \
" move %D1, $0 \n" \
" j 3b \n" \
" j 3b \n" \
...
@@ -287,9 +280,8 @@ struct __large_struct { unsigned long buf[100]; };
...
@@ -287,9 +280,8 @@ struct __large_struct { unsigned long buf[100]; };
" " __UA_ADDR " 2b, 4b \n" \
" " __UA_ADDR " 2b, 4b \n" \
" .previous \n" \
" .previous \n" \
: "=r" (__gu_err), "=&r" (__gu_val) \
: "=r" (__gu_err), "=&r" (__gu_val) \
: "0" (__gu_err), "o" (__m(__gu_addr)), \
: "0" (0), "r" (addr), "i" (-EFAULT)); \
"o" (__m(__gu_addr + 4)), "i" (-EFAULT)); \
}
})
extern
void
__get_user_unknown
(
void
);
extern
void
__get_user_unknown
(
void
);
...
@@ -298,25 +290,23 @@ extern void __get_user_unknown(void);
...
@@ -298,25 +290,23 @@ extern void __get_user_unknown(void);
* for 32 bit mode and old iron.
* for 32 bit mode and old iron.
*/
*/
#ifdef __mips64
#ifdef __mips64
#define __PUT_USER_DW(
__pu_val) __put_user_asm("sd", __pu_val
)
#define __PUT_USER_DW(
ptr) __put_user_asm("sd", ptr
)
#else
#else
#define __PUT_USER_DW(
__pu_val) __put_user_asm_ll32(__pu_val
)
#define __PUT_USER_DW(
ptr) __put_user_asm_ll32(ptr
)
#endif
#endif
#define __put_user_nocheck(x,ptr,size) \
#define __put_user_nocheck(x,ptr,size) \
({ \
({ \
__typeof__(*(ptr)) __pu_val; \
__typeof__(*(ptr)) __pu_val; \
long __pu_addr; \
long __pu_err = 0; \
long __pu_err = 0; \
\
\
might_sleep(); \
might_sleep(); \
__pu_val = (x); \
__pu_val = (x); \
__pu_addr = (long) (ptr); \
switch (size) { \
switch (size) { \
case 1: __put_user_asm("sb",
__pu_val
); break; \
case 1: __put_user_asm("sb",
ptr
); break; \
case 2: __put_user_asm("sh",
__pu_val
); break; \
case 2: __put_user_asm("sh",
ptr
); break; \
case 4: __put_user_asm("sw",
__pu_val
); break; \
case 4: __put_user_asm("sw",
ptr
); break; \
case 8: __PUT_USER_DW(
__pu_val
); break; \
case 8: __PUT_USER_DW(
ptr
); break; \
default: __put_user_unknown(); break; \
default: __put_user_unknown(); break; \
} \
} \
__pu_err; \
__pu_err; \
...
@@ -324,30 +314,24 @@ extern void __get_user_unknown(void);
...
@@ -324,30 +314,24 @@ extern void __get_user_unknown(void);
#define __put_user_check(x,ptr,size) \
#define __put_user_check(x,ptr,size) \
({ \
({ \
__typeof__(*(ptr)) __
pu_val;
\
__typeof__(*(ptr)) __
user *__pu_addr = (ptr);
\
long __pu_addr;
\
__typeof__(*(ptr)) __pu_val = (x);
\
long __pu_err
;
\
long __pu_err
= -EFAULT;
\
\
\
might_sleep(); \
if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { \
__pu_val = (x); \
__pu_addr = (long) (ptr); \
__pu_err = access_ok(VERIFY_WRITE, (void *) __pu_addr, size) \
? 0 : -EFAULT; \
\
if (likely(!__pu_err)) { \
switch (size) { \
switch (size) { \
case 1: __put_user_asm("sb", __pu_
val
); break; \
case 1: __put_user_asm("sb", __pu_
addr
); break; \
case 2: __put_user_asm("sh", __pu_
val
); break; \
case 2: __put_user_asm("sh", __pu_
addr
); break; \
case 4: __put_user_asm("sw", __pu_
val
); break; \
case 4: __put_user_asm("sw", __pu_
addr
); break; \
case 8: __PUT_USER_DW(__pu_
val); break;
\
case 8: __PUT_USER_DW(__pu_
addr); break;
\
default: __put_user_unknown(); break; \
default: __put_user_unknown(); break; \
} \
} \
} \
} \
__pu_err; \
__pu_err; \
})
})
#define __put_user_asm(insn,
__pu_val
) \
#define __put_user_asm(insn,
ptr
) \
(
{ \
{ \
__asm__ __volatile__( \
__asm__ __volatile__( \
"1: " insn " %z2, %3 # __put_user_asm\n" \
"1: " insn " %z2, %3 # __put_user_asm\n" \
"2: \n" \
"2: \n" \
...
@@ -359,18 +343,18 @@ extern void __get_user_unknown(void);
...
@@ -359,18 +343,18 @@ extern void __get_user_unknown(void);
" " __UA_ADDR " 1b, 3b \n" \
" " __UA_ADDR " 1b, 3b \n" \
" .previous \n" \
" .previous \n" \
: "=r" (__pu_err) \
: "=r" (__pu_err) \
: "0" (
__pu_err), "Jr" (__pu_val), "o" (__m(__pu_addr)),
\
: "0" (
0), "Jr" (__pu_val), "o" (__m(ptr)),
\
"i" (-EFAULT)); \
"i" (-EFAULT)); \
}
)
}
#define __put_user_asm_ll32(
__pu_val
) \
#define __put_user_asm_ll32(
ptr
) \
(
{ \
{ \
__asm__ __volatile__( \
__asm__ __volatile__( \
"1: sw %2,
%3
# __put_user_asm_ll32 \n" \
"1: sw %2,
(%3)
# __put_user_asm_ll32 \n" \
"2: sw %D2,
%4
\n" \
"2: sw %D2,
4(%3)
\n" \
"3: \n" \
"3: \n" \
" .section .fixup,\"ax\" \n" \
" .section .fixup,\"ax\" \n" \
"4: li %0, %
5
\n" \
"4: li %0, %
4
\n" \
" j 3b \n" \
" j 3b \n" \
" .previous \n" \
" .previous \n" \
" .section __ex_table,\"a\" \n" \
" .section __ex_table,\"a\" \n" \
...
@@ -378,9 +362,9 @@ extern void __get_user_unknown(void);
...
@@ -378,9 +362,9 @@ extern void __get_user_unknown(void);
" " __UA_ADDR " 2b, 4b \n" \
" " __UA_ADDR " 2b, 4b \n" \
" .previous" \
" .previous" \
: "=r" (__pu_err) \
: "=r" (__pu_err) \
: "0" (
__pu_err), "r" (__pu_val), "o" (__m(__pu_addr)),
\
: "0" (
0), "r" (__pu_val), "r" (ptr),
\
"
o" (__m(__pu_addr + 4)), "i" (-EFAULT));
\
"
i" (-EFAULT));
\
}
)
}
extern
void
__put_user_unknown
(
void
);
extern
void
__put_user_unknown
(
void
);
...
@@ -403,7 +387,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -403,7 +387,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
#define __invoke_copy_to_user(to,from,n) \
#define __invoke_copy_to_user(to,from,n) \
({ \
({ \
register void *__cu_to_r __asm__ ("$4"); \
register void
__user
*__cu_to_r __asm__ ("$4"); \
register const void *__cu_from_r __asm__ ("$5"); \
register const void *__cu_from_r __asm__ ("$5"); \
register long __cu_len_r __asm__ ("$6"); \
register long __cu_len_r __asm__ ("$6"); \
\
\
...
@@ -435,7 +419,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -435,7 +419,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
*/
*/
#define __copy_to_user(to,from,n) \
#define __copy_to_user(to,from,n) \
({ \
({ \
void
*__cu_to;
\
void
__user *__cu_to;
\
const void *__cu_from; \
const void *__cu_from; \
long __cu_len; \
long __cu_len; \
\
\
...
@@ -465,7 +449,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -465,7 +449,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
*/
*/
#define copy_to_user(to,from,n) \
#define copy_to_user(to,from,n) \
({ \
({ \
void
*__cu_to;
\
void
__user *__cu_to;
\
const void *__cu_from; \
const void *__cu_from; \
long __cu_len; \
long __cu_len; \
\
\
...
@@ -482,7 +466,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -482,7 +466,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
#define __invoke_copy_from_user(to,from,n) \
#define __invoke_copy_from_user(to,from,n) \
({ \
({ \
register void *__cu_to_r __asm__ ("$4"); \
register void *__cu_to_r __asm__ ("$4"); \
register const void *__cu_from_r __asm__ ("$5"); \
register const void
__user
*__cu_from_r __asm__ ("$5"); \
register long __cu_len_r __asm__ ("$6"); \
register long __cu_len_r __asm__ ("$6"); \
\
\
__cu_to_r = (to); \
__cu_to_r = (to); \
...
@@ -521,7 +505,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -521,7 +505,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
#define __copy_from_user(to,from,n) \
#define __copy_from_user(to,from,n) \
({ \
({ \
void *__cu_to; \
void *__cu_to; \
const void
*__cu_from;
\
const void
__user *__cu_from;
\
long __cu_len; \
long __cu_len; \
\
\
might_sleep(); \
might_sleep(); \
...
@@ -552,7 +536,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -552,7 +536,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
#define copy_from_user(to,from,n) \
#define copy_from_user(to,from,n) \
({ \
({ \
void *__cu_to; \
void *__cu_to; \
const void
*__cu_from;
\
const void
__user *__cu_from;
\
long __cu_len; \
long __cu_len; \
\
\
might_sleep(); \
might_sleep(); \
...
@@ -569,8 +553,8 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -569,8 +553,8 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
#define copy_in_user(to,from,n) \
#define copy_in_user(to,from,n) \
({ \
({ \
void
*__cu_to;
\
void
__user *__cu_to;
\
const void
*__cu_from;
\
const void
__user *__cu_from;
\
long __cu_len; \
long __cu_len; \
\
\
might_sleep(); \
might_sleep(); \
...
@@ -596,7 +580,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
...
@@ -596,7 +580,7 @@ extern size_t __copy_user(void *__to, const void *__from, size_t __n);
* On success, this will be zero.
* On success, this will be zero.
*/
*/
static
inline
__kernel_size_t
static
inline
__kernel_size_t
__clear_user
(
void
*
addr
,
__kernel_size_t
size
)
__clear_user
(
void
__user
*
addr
,
__kernel_size_t
size
)
{
{
__kernel_size_t
res
;
__kernel_size_t
res
;
...
@@ -616,7 +600,7 @@ __clear_user(void *addr, __kernel_size_t size)
...
@@ -616,7 +600,7 @@ __clear_user(void *addr, __kernel_size_t size)
#define clear_user(addr,n) \
#define clear_user(addr,n) \
({ \
({ \
void
* __cl_addr = (addr);
\
void
__user * __cl_addr = (addr);
\
unsigned long __cl_size = (n); \
unsigned long __cl_size = (n); \
if (__cl_size && access_ok(VERIFY_WRITE, \
if (__cl_size && access_ok(VERIFY_WRITE, \
((unsigned long)(__cl_addr)), __cl_size)) \
((unsigned long)(__cl_addr)), __cl_size)) \
...
@@ -645,7 +629,7 @@ __clear_user(void *addr, __kernel_size_t size)
...
@@ -645,7 +629,7 @@ __clear_user(void *addr, __kernel_size_t size)
* and returns @count.
* and returns @count.
*/
*/
static
inline
long
static
inline
long
__strncpy_from_user
(
char
*
__to
,
const
char
*
__from
,
long
__len
)
__strncpy_from_user
(
char
*
__to
,
const
char
__user
*
__from
,
long
__len
)
{
{
long
res
;
long
res
;
...
@@ -682,7 +666,7 @@ __strncpy_from_user(char *__to, const char *__from, long __len)
...
@@ -682,7 +666,7 @@ __strncpy_from_user(char *__to, const char *__from, long __len)
* and returns @count.
* and returns @count.
*/
*/
static
inline
long
static
inline
long
strncpy_from_user
(
char
*
__to
,
const
char
*
__from
,
long
__len
)
strncpy_from_user
(
char
*
__to
,
const
char
__user
*
__from
,
long
__len
)
{
{
long
res
;
long
res
;
...
@@ -701,7 +685,7 @@ strncpy_from_user(char *__to, const char *__from, long __len)
...
@@ -701,7 +685,7 @@ strncpy_from_user(char *__to, const char *__from, long __len)
}
}
/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
static
inline
long
__strlen_user
(
const
char
*
s
)
static
inline
long
__strlen_user
(
const
char
__user
*
s
)
{
{
long
res
;
long
res
;
...
@@ -731,7 +715,7 @@ static inline long __strlen_user(const char *s)
...
@@ -731,7 +715,7 @@ static inline long __strlen_user(const char *s)
* If there is a limit on the length of a valid string, you may wish to
* If there is a limit on the length of a valid string, you may wish to
* consider using strnlen_user() instead.
* consider using strnlen_user() instead.
*/
*/
static
inline
long
strlen_user
(
const
char
*
s
)
static
inline
long
strlen_user
(
const
char
__user
*
s
)
{
{
long
res
;
long
res
;
...
@@ -748,7 +732,7 @@ static inline long strlen_user(const char *s)
...
@@ -748,7 +732,7 @@ static inline long strlen_user(const char *s)
}
}
/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
/* Returns: 0 if bad, string length+1 (memory size) of string if ok */
static
inline
long
__strnlen_user
(
const
char
*
s
,
long
n
)
static
inline
long
__strnlen_user
(
const
char
__user
*
s
,
long
n
)
{
{
long
res
;
long
res
;
...
@@ -779,7 +763,7 @@ static inline long __strnlen_user(const char *s, long n)
...
@@ -779,7 +763,7 @@ static inline long __strnlen_user(const char *s, long n)
* If there is a limit on the length of a valid string, you may wish to
* If there is a limit on the length of a valid string, you may wish to
* consider using strnlen_user() instead.
* consider using strnlen_user() instead.
*/
*/
static
inline
long
strnlen_user
(
const
char
*
s
,
long
n
)
static
inline
long
strnlen_user
(
const
char
__user
*
s
,
long
n
)
{
{
long
res
;
long
res
;
...
...
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