Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
3c37026d
Commit
3c37026d
authored
Apr 13, 2005
by
Ralf Baechle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NPTL, round one.
Signed-off-by:
Ralf Baechle
<
ralf@linux-mips.org
>
parent
38551576
Changes
14
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
129 additions
and
14 deletions
+129
-14
arch/mips/kernel/asm-offsets.c
arch/mips/kernel/asm-offsets.c
+1
-0
arch/mips/kernel/linux32.c
arch/mips/kernel/linux32.c
+27
-0
arch/mips/kernel/process.c
arch/mips/kernel/process.c
+4
-0
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace.c
+5
-0
arch/mips/kernel/ptrace32.c
arch/mips/kernel/ptrace32.c
+5
-0
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall32-o32.S
+1
-0
arch/mips/kernel/scall64-64.S
arch/mips/kernel/scall64-64.S
+1
-0
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-n32.S
+1
-0
arch/mips/kernel/scall64-o32.S
arch/mips/kernel/scall64-o32.S
+2
-1
arch/mips/kernel/syscall.c
arch/mips/kernel/syscall.c
+28
-3
arch/mips/kernel/traps.c
arch/mips/kernel/traps.c
+43
-3
include/asm-mips/inst.h
include/asm-mips/inst.h
+1
-1
include/asm-mips/thread_info.h
include/asm-mips/thread_info.h
+1
-0
include/asm-mips/unistd.h
include/asm-mips/unistd.h
+9
-6
No files found.
arch/mips/kernel/asm-offsets.c
View file @
3c37026d
...
...
@@ -95,6 +95,7 @@ void output_thread_info_defines(void)
offset
(
"#define TI_PRE_COUNT "
,
struct
thread_info
,
preempt_count
);
offset
(
"#define TI_ADDR_LIMIT "
,
struct
thread_info
,
addr_limit
);
offset
(
"#define TI_RESTART_BLOCK "
,
struct
thread_info
,
restart_block
);
offset
(
"#define TI_TP_VALUE "
,
struct
thread_info
,
tp_value
);
constant
(
"#define _THREAD_SIZE_ORDER "
,
THREAD_SIZE_ORDER
);
constant
(
"#define _THREAD_SIZE "
,
THREAD_SIZE
);
constant
(
"#define _THREAD_MASK "
,
THREAD_MASK
);
...
...
arch/mips/kernel/linux32.c
View file @
3c37026d
...
...
@@ -1468,3 +1468,30 @@ sysn32_rt_sigtimedwait(const sigset_t __user *uthese,
}
return
sys_rt_sigtimedwait
(
uthese
,
uinfo
,
uts
,
sigsetsize
);
}
save_static_function
(
sys32_clone
);
__attribute_used__
noinline
static
int
_sys32_clone
(
nabi_no_regargs
struct
pt_regs
regs
)
{
unsigned
long
clone_flags
;
unsigned
long
newsp
;
int
__user
*
parent_tidptr
,
*
child_tidptr
;
clone_flags
=
regs
.
regs
[
4
];
newsp
=
regs
.
regs
[
5
];
if
(
!
newsp
)
newsp
=
regs
.
regs
[
29
];
parent_tidptr
=
(
int
*
)
regs
.
regs
[
6
];
/* Use __dummy4 instead of getting it off the stack, so that
syscall() works. */
child_tidptr
=
(
int
__user
*
)
__dummy4
;
return
do_fork
(
clone_flags
,
newsp
,
&
regs
,
0
,
parent_tidptr
,
child_tidptr
);
}
extern
asmlinkage
void
sys_set_thread_area
(
u32
addr
);
asmlinkage
void
sys32_set_thread_area
(
u32
addr
)
{
sys_set_thread_area
(
AA
(
addr
));
}
arch/mips/kernel/process.c
View file @
3c37026d
...
...
@@ -89,6 +89,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
struct
thread_info
*
ti
=
p
->
thread_info
;
struct
pt_regs
*
childregs
;
long
childksp
;
p
->
set_child_tid
=
p
->
clear_child_tid
=
NULL
;
childksp
=
(
unsigned
long
)
ti
+
THREAD_SIZE
-
32
;
...
...
@@ -134,6 +135,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
childregs
->
cp0_status
&=
~
(
ST0_CU2
|
ST0_CU1
);
clear_tsk_thread_flag
(
p
,
TIF_USEDFPU
);
if
(
clone_flags
&
CLONE_SETTLS
)
ti
->
tp_value
=
regs
->
regs
[
7
];
return
0
;
}
...
...
arch/mips/kernel/ptrace.c
View file @
3c37026d
...
...
@@ -289,6 +289,11 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
ret
=
ptrace_detach
(
child
,
data
);
break
;
case
PTRACE_GET_THREAD_AREA
:
ret
=
put_user
(
child
->
thread_info
->
tp_value
,
(
unsigned
long
__user
*
)
data
);
break
;
default:
ret
=
ptrace_request
(
child
,
request
,
addr
,
data
);
break
;
...
...
arch/mips/kernel/ptrace32.c
View file @
3c37026d
...
...
@@ -268,6 +268,11 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
wake_up_process
(
child
);
break
;
case
PTRACE_GET_THREAD_AREA
:
ret
=
put_user
(
child
->
thread_info
->
tp_value
,
(
unsigned
int
__user
*
)
(
unsigned
long
)
data
);
break
;
case
PTRACE_DETACH
:
/* detach a process that was attached. */
ret
=
ptrace_detach
(
child
,
data
);
break
;
...
...
arch/mips/kernel/scall32-o32.S
View file @
3c37026d
...
...
@@ -623,6 +623,7 @@ einval: li v0, -EINVAL
sys
sys_add_key
5
sys
sys_request_key
4
sys
sys_keyctl
5
sys
sys_set_thread_area
1
.
endm
...
...
arch/mips/kernel/scall64-64.S
View file @
3c37026d
...
...
@@ -449,3 +449,4 @@ sys_call_table:
PTR
sys_add_key
PTR
sys_request_key
/*
5240
*/
PTR
sys_keyctl
PTR
sys_set_thread_area
arch/mips/kernel/scall64-n32.S
View file @
3c37026d
...
...
@@ -363,3 +363,4 @@ EXPORT(sysn32_call_table)
PTR
sys_add_key
PTR
sys_request_key
PTR
sys_keyctl
/*
6245
*/
PTR
sys_set_thread_area
arch/mips/kernel/scall64-o32.S
View file @
3c37026d
...
...
@@ -322,7 +322,7 @@ sys_call_table:
PTR
sys32_ipc
PTR
sys_fsync
PTR
sys32_sigreturn
PTR
sys_clone
/*
4120
*/
PTR
sys
32
_clone
/*
4120
*/
PTR
sys_setdomainname
PTR
sys32_newuname
PTR
sys_ni_syscall
/*
sys_modify_ldt
*/
...
...
@@ -485,4 +485,5 @@ sys_call_table:
PTR
sys_add_key
/*
4280
*/
PTR
sys_request_key
PTR
sys_keyctl
PTR
sys_set_thread_area
.
size
sys_call_table
,
.
-
sys_call_table
arch/mips/kernel/syscall.c
View file @
3c37026d
...
...
@@ -7,6 +7,7 @@
* Copyright (C) 1999, 2000 Silicon Graphics, Inc.
* Copyright (C) 2001 MIPS Technologies, Inc.
*/
#include <linux/config.h>
#include <linux/a.out.h>
#include <linux/errno.h>
#include <linux/linkage.h>
...
...
@@ -176,14 +177,28 @@ _sys_clone(nabi_no_regargs struct pt_regs regs)
{
unsigned
long
clone_flags
;
unsigned
long
newsp
;
int
*
parent_tidptr
,
*
child_tidptr
;
int
__user
*
parent_tidptr
,
*
child_tidptr
;
clone_flags
=
regs
.
regs
[
4
];
newsp
=
regs
.
regs
[
5
];
if
(
!
newsp
)
newsp
=
regs
.
regs
[
29
];
parent_tidptr
=
(
int
*
)
regs
.
regs
[
6
];
child_tidptr
=
(
int
*
)
regs
.
regs
[
7
];
parent_tidptr
=
(
int
__user
*
)
regs
.
regs
[
6
];
#ifdef CONFIG_32BIT
/* We need to fetch the fifth argument off the stack. */
child_tidptr
=
NULL
;
if
(
clone_flags
&
(
CLONE_CHILD_SETTID
|
CLONE_CHILD_CLEARTID
))
{
int
__user
*
__user
*
usp
=
(
int
__user
*
__user
*
)
regs
.
regs
[
29
];
if
(
regs
.
regs
[
2
]
==
__NR_syscall
)
{
if
(
get_user
(
child_tidptr
,
&
usp
[
5
]))
return
-
EFAULT
;
}
else
if
(
get_user
(
child_tidptr
,
&
usp
[
4
]))
return
-
EFAULT
;
}
#else
child_tidptr
=
(
int
__user
*
)
regs
.
regs
[
8
];
#endif
return
do_fork
(
clone_flags
,
newsp
,
&
regs
,
0
,
parent_tidptr
,
child_tidptr
);
}
...
...
@@ -245,6 +260,16 @@ asmlinkage int sys_olduname(struct oldold_utsname * name)
return
error
;
}
void
sys_set_thread_area
(
unsigned
long
addr
)
{
struct
thread_info
*
ti
=
current
->
thread_info
;
ti
->
tp_value
=
addr
;
/* If some future MIPS implementation has this register in hardware,
* we will need to update it here (and in context switches). */
}
asmlinkage
int
_sys_sysmips
(
int
cmd
,
long
arg1
,
int
arg2
,
int
arg3
)
{
int
tmp
,
len
;
...
...
arch/mips/kernel/traps.c
View file @
3c37026d
...
...
@@ -360,6 +360,10 @@ static inline int get_insn_opcode(struct pt_regs *regs, unsigned int *opcode)
#define OFFSET 0x0000ffff
#define LL 0xc0000000
#define SC 0xe0000000
#define SPEC3 0x7c000000
#define RD 0x0000f800
#define FUNC 0x0000003f
#define RDHWR 0x0000003b
/*
* The ll_bit is cleared by r*_switch.S
...
...
@@ -495,6 +499,37 @@ static inline int simulate_llsc(struct pt_regs *regs)
return
-
EFAULT
;
/* Strange things going on ... */
}
/*
* Simulate trapping 'rdhwr' instructions to provide user accessible
* registers not implemented in hardware. The only current use of this
* is the thread area pointer.
*/
static
inline
int
simulate_rdhwr
(
struct
pt_regs
*
regs
)
{
struct
thread_info
*
ti
=
current
->
thread_info
;
unsigned
int
opcode
;
if
(
unlikely
(
get_insn_opcode
(
regs
,
&
opcode
)))
return
-
EFAULT
;
if
(
unlikely
(
compute_return_epc
(
regs
)))
return
-
EFAULT
;
if
((
opcode
&
OPCODE
)
==
SPEC3
&&
(
opcode
&
FUNC
)
==
RDHWR
)
{
int
rd
=
(
opcode
&
RD
)
>>
11
;
int
rt
=
(
opcode
&
RT
)
>>
16
;
switch
(
rd
)
{
case
29
:
regs
->
regs
[
rt
]
=
ti
->
tp_value
;
break
;
default:
return
-
EFAULT
;
}
}
return
0
;
}
asmlinkage
void
do_ov
(
struct
pt_regs
*
regs
)
{
siginfo_t
info
;
...
...
@@ -641,6 +676,9 @@ asmlinkage void do_ri(struct pt_regs *regs)
if
(
!
simulate_llsc
(
regs
))
return
;
if
(
!
simulate_rdhwr
(
regs
))
return
;
force_sig
(
SIGILL
,
current
);
}
...
...
@@ -654,11 +692,13 @@ asmlinkage void do_cpu(struct pt_regs *regs)
switch
(
cpid
)
{
case
0
:
if
(
cpu_has_llsc
)
break
;
if
(
!
cpu_has_llsc
)
if
(
!
simulate_llsc
(
regs
))
return
;
if
(
!
simulate_rdhwr
(
regs
))
return
;
break
;
case
1
:
...
...
include/asm-mips/inst.h
View file @
3c37026d
...
...
@@ -28,7 +28,7 @@ enum major_op {
sdl_op
,
sdr_op
,
swr_op
,
cache_op
,
ll_op
,
lwc1_op
,
lwc2_op
,
pref_op
,
lld_op
,
ldc1_op
,
ldc2_op
,
ld_op
,
sc_op
,
swc1_op
,
swc2_op
,
major_3b_op
,
/* Opcode 0x3b is unused */
sc_op
,
swc1_op
,
swc2_op
,
rdhwr_op
,
scd_op
,
sdc1_op
,
sdc2_op
,
sd_op
};
...
...
include/asm-mips/thread_info.h
View file @
3c37026d
...
...
@@ -26,6 +26,7 @@ struct thread_info {
struct
task_struct
*
task
;
/* main task structure */
struct
exec_domain
*
exec_domain
;
/* execution domain */
unsigned
long
flags
;
/* low level flags */
unsigned
long
tp_value
;
/* thread pointer */
__u32
cpu
;
/* current CPU */
int
preempt_count
;
/* 0 => preemptable, <0 => BUG */
...
...
include/asm-mips/unistd.h
View file @
3c37026d
...
...
@@ -303,16 +303,17 @@
#define __NR_add_key (__NR_Linux + 280)
#define __NR_request_key (__NR_Linux + 281)
#define __NR_keyctl (__NR_Linux + 282)
#define __NR_set_thread_area (__NR_Linux + 283)
/*
* Offset of the last Linux o32 flavoured syscall
*/
#define __NR_Linux_syscalls 28
2
#define __NR_Linux_syscalls 28
3
#endif
/* _MIPS_SIM == _MIPS_SIM_ABI32 */
#define __NR_O32_Linux 4000
#define __NR_O32_Linux_syscalls 28
2
#define __NR_O32_Linux_syscalls 28
3
#if _MIPS_SIM == _MIPS_SIM_ABI64
...
...
@@ -562,16 +563,17 @@
#define __NR_add_key (__NR_Linux + 239)
#define __NR_request_key (__NR_Linux + 240)
#define __NR_keyctl (__NR_Linux + 241)
#define __NR_set_thread_area (__NR_Linux + 242)
/*
* Offset of the last Linux 64-bit flavoured syscall
*/
#define __NR_Linux_syscalls 24
1
#define __NR_Linux_syscalls 24
2
#endif
/* _MIPS_SIM == _MIPS_SIM_ABI64 */
#define __NR_64_Linux 5000
#define __NR_64_Linux_syscalls 24
1
#define __NR_64_Linux_syscalls 24
2
#if _MIPS_SIM == _MIPS_SIM_NABI32
...
...
@@ -825,16 +827,17 @@
#define __NR_add_key (__NR_Linux + 243)
#define __NR_request_key (__NR_Linux + 244)
#define __NR_keyctl (__NR_Linux + 245)
#define __NR_set_thread_area (__NR_Linux + 246)
/*
* Offset of the last N32 flavoured syscall
*/
#define __NR_Linux_syscalls 24
5
#define __NR_Linux_syscalls 24
6
#endif
/* _MIPS_SIM == _MIPS_SIM_NABI32 */
#define __NR_N32_Linux 6000
#define __NR_N32_Linux_syscalls 24
5
#define __NR_N32_Linux_syscalls 24
6
#ifndef __ASSEMBLY__
...
...
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