Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
7e243643
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
7e243643
编写于
11月 07, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
arm: switch to struct ksignal * passing
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
cfd60c07
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
47 addition
and
61 deletion
+47
-61
arch/arm/kernel/signal.c
arch/arm/kernel/signal.c
+47
-61
未找到文件。
arch/arm/kernel/signal.c
浏览文件 @
7e243643
...
...
@@ -318,17 +318,11 @@ setup_sigframe(struct sigframe __user *sf, struct pt_regs *regs, sigset_t *set)
}
static
inline
void
__user
*
get_sigframe
(
struct
k
_sigaction
*
ka
,
struct
pt_regs
*
regs
,
int
framesize
)
get_sigframe
(
struct
k
signal
*
ksig
,
struct
pt_regs
*
regs
,
int
framesize
)
{
unsigned
long
sp
=
regs
->
ARM_sp
;
unsigned
long
sp
=
sigsp
(
regs
->
ARM_sp
,
ksig
)
;
void
__user
*
frame
;
/*
* This is the X/Open sanctioned signal stack switching.
*/
if
((
ka
->
sa
.
sa_flags
&
SA_ONSTACK
)
&&
!
sas_ss_flags
(
sp
))
sp
=
current
->
sas_ss_sp
+
current
->
sas_ss_size
;
/*
* ATPCS B01 mandates 8-byte alignment
*/
...
...
@@ -343,11 +337,22 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
return
frame
;
}
/*
* translate the signal
*/
static
inline
int
map_sig
(
int
sig
)
{
struct
thread_info
*
thread
=
current_thread_info
();
if
(
sig
<
32
&&
thread
->
exec_domain
&&
thread
->
exec_domain
->
signal_invmap
)
sig
=
thread
->
exec_domain
->
signal_invmap
[
sig
];
return
sig
;
}
static
int
setup_return
(
struct
pt_regs
*
regs
,
struct
k
_sigaction
*
ka
,
unsigned
long
__user
*
rc
,
void
__user
*
frame
,
int
usig
)
setup_return
(
struct
pt_regs
*
regs
,
struct
k
signal
*
ksig
,
unsigned
long
__user
*
rc
,
void
__user
*
frame
)
{
unsigned
long
handler
=
(
unsigned
long
)
k
a
->
sa
.
sa_handler
;
unsigned
long
handler
=
(
unsigned
long
)
k
sig
->
ka
.
sa
.
sa_handler
;
unsigned
long
retcode
;
int
thumb
=
0
;
unsigned
long
cpsr
=
regs
->
ARM_cpsr
&
~
(
PSR_f
|
PSR_E_BIT
);
...
...
@@ -357,7 +362,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
/*
* Maybe we need to deliver a 32-bit signal to a 26-bit task.
*/
if
(
k
a
->
sa
.
sa_flags
&
SA_THIRTYTWO
)
if
(
k
sig
->
ka
.
sa
.
sa_flags
&
SA_THIRTYTWO
)
cpsr
=
(
cpsr
&
~
MODE_MASK
)
|
USR_MODE
;
#ifdef CONFIG_ARM_THUMB
...
...
@@ -379,12 +384,12 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
}
#endif
if
(
k
a
->
sa
.
sa_flags
&
SA_RESTORER
)
{
retcode
=
(
unsigned
long
)
k
a
->
sa
.
sa_restorer
;
if
(
k
sig
->
ka
.
sa
.
sa_flags
&
SA_RESTORER
)
{
retcode
=
(
unsigned
long
)
k
sig
->
ka
.
sa
.
sa_restorer
;
}
else
{
unsigned
int
idx
=
thumb
<<
1
;
if
(
k
a
->
sa
.
sa_flags
&
SA_SIGINFO
)
if
(
k
sig
->
ka
.
sa
.
sa_flags
&
SA_SIGINFO
)
idx
+=
3
;
if
(
__put_user
(
sigreturn_codes
[
idx
],
rc
)
||
...
...
@@ -409,7 +414,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
}
}
regs
->
ARM_r0
=
usig
;
regs
->
ARM_r0
=
map_sig
(
ksig
->
sig
)
;
regs
->
ARM_sp
=
(
unsigned
long
)
frame
;
regs
->
ARM_lr
=
retcode
;
regs
->
ARM_pc
=
handler
;
...
...
@@ -419,9 +424,9 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
}
static
int
setup_frame
(
int
usig
,
struct
k_sigaction
*
ka
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
setup_frame
(
struct
ksignal
*
ksig
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
struct
sigframe
__user
*
frame
=
get_sigframe
(
k
a
,
regs
,
sizeof
(
*
frame
));
struct
sigframe
__user
*
frame
=
get_sigframe
(
k
sig
,
regs
,
sizeof
(
*
frame
));
int
err
=
0
;
if
(
!
frame
)
...
...
@@ -434,22 +439,21 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg
err
|=
setup_sigframe
(
frame
,
regs
,
set
);
if
(
err
==
0
)
err
=
setup_return
(
regs
,
k
a
,
frame
->
retcode
,
frame
,
usig
);
err
=
setup_return
(
regs
,
k
sig
,
frame
->
retcode
,
frame
);
return
err
;
}
static
int
setup_rt_frame
(
int
usig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
setup_rt_frame
(
struct
ksignal
*
ksig
,
sigset_t
*
set
,
struct
pt_regs
*
regs
)
{
struct
rt_sigframe
__user
*
frame
=
get_sigframe
(
k
a
,
regs
,
sizeof
(
*
frame
));
struct
rt_sigframe
__user
*
frame
=
get_sigframe
(
k
sig
,
regs
,
sizeof
(
*
frame
));
int
err
=
0
;
if
(
!
frame
)
return
1
;
err
|=
copy_siginfo_to_user
(
&
frame
->
info
,
info
);
err
|=
copy_siginfo_to_user
(
&
frame
->
info
,
&
ksig
->
info
);
__put_user_error
(
0
,
&
frame
->
sig
.
uc
.
uc_flags
,
err
);
__put_user_error
(
NULL
,
&
frame
->
sig
.
uc
.
uc_link
,
err
);
...
...
@@ -457,7 +461,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
err
|=
__save_altstack
(
&
frame
->
sig
.
uc
.
uc_stack
,
regs
->
ARM_sp
);
err
|=
setup_sigframe
(
&
frame
->
sig
,
regs
,
set
);
if
(
err
==
0
)
err
=
setup_return
(
regs
,
k
a
,
frame
->
sig
.
retcode
,
frame
,
usig
);
err
=
setup_return
(
regs
,
k
sig
,
frame
->
sig
.
retcode
,
frame
);
if
(
err
==
0
)
{
/*
...
...
@@ -475,40 +479,25 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
/*
* OK, we're invoking a handler
*/
static
void
handle_signal
(
unsigned
long
sig
,
struct
k_sigaction
*
ka
,
siginfo_t
*
info
,
struct
pt_regs
*
regs
)
static
void
handle_signal
(
struct
ksignal
*
ksig
,
struct
pt_regs
*
regs
)
{
struct
thread_info
*
thread
=
current_thread_info
();
struct
task_struct
*
tsk
=
current
;
sigset_t
*
oldset
=
sigmask_to_save
();
int
usig
=
sig
;
int
ret
;
/*
* translate the signal
*/
if
(
usig
<
32
&&
thread
->
exec_domain
&&
thread
->
exec_domain
->
signal_invmap
)
usig
=
thread
->
exec_domain
->
signal_invmap
[
usig
];
/*
* Set up the stack frame
*/
if
(
k
a
->
sa
.
sa_flags
&
SA_SIGINFO
)
ret
=
setup_rt_frame
(
usig
,
ka
,
info
,
oldset
,
regs
);
if
(
k
sig
->
ka
.
sa
.
sa_flags
&
SA_SIGINFO
)
ret
=
setup_rt_frame
(
ksig
,
oldset
,
regs
);
else
ret
=
setup_frame
(
usig
,
ka
,
oldset
,
regs
);
ret
=
setup_frame
(
ksig
,
oldset
,
regs
);
/*
* Check that the resulting registers are actually sane.
*/
ret
|=
!
valid_user_regs
(
regs
);
if
(
ret
!=
0
)
{
force_sigsegv
(
sig
,
tsk
);
return
;
}
signal_delivered
(
sig
,
info
,
ka
,
regs
,
0
);
signal_setup_done
(
ret
,
ksig
,
0
);
}
/*
...
...
@@ -523,9 +512,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka,
static
int
do_signal
(
struct
pt_regs
*
regs
,
int
syscall
)
{
unsigned
int
retval
=
0
,
continue_addr
=
0
,
restart_addr
=
0
;
struct
k_sigaction
ka
;
siginfo_t
info
;
int
signr
;
struct
ksignal
ksig
;
int
restart
=
0
;
/*
...
...
@@ -557,33 +544,32 @@ static int do_signal(struct pt_regs *regs, int syscall)
* Get the signal to deliver. When running under ptrace, at this
* point the debugger may change all our registers ...
*/
signr
=
get_signal_to_deliver
(
&
info
,
&
ka
,
regs
,
NULL
);
/*
* Depending on the signal settings we may need to revert the
* decision to restart the system call. But skip this if a
* debugger has chosen to restart at a different PC.
*/
if
(
regs
->
ARM_pc
!=
restart_addr
)
restart
=
0
;
if
(
signr
>
0
)
{
if
(
unlikely
(
restart
))
{
if
(
get_signal
(
&
ksig
))
{
/* handler */
if
(
unlikely
(
restart
)
&&
regs
->
ARM_pc
==
restart_addr
)
{
if
(
retval
==
-
ERESTARTNOHAND
||
retval
==
-
ERESTART_RESTARTBLOCK
||
(
retval
==
-
ERESTARTSYS
&&
!
(
ka
.
sa
.
sa_flags
&
SA_RESTART
)))
{
&&
!
(
k
sig
.
k
a
.
sa
.
sa_flags
&
SA_RESTART
)))
{
regs
->
ARM_r0
=
-
EINTR
;
regs
->
ARM_pc
=
continue_addr
;
}
}
handle_signal
(
signr
,
&
ka
,
&
info
,
regs
);
return
0
;
handle_signal
(
&
ksig
,
regs
);
}
else
{
/* no handler */
restore_saved_sigmask
();
if
(
unlikely
(
restart
)
&&
regs
->
ARM_pc
==
restart_addr
)
{
regs
->
ARM_pc
=
continue_addr
;
return
restart
;
}
}
restore_saved_sigmask
();
if
(
unlikely
(
restart
))
regs
->
ARM_pc
=
continue_addr
;
return
restart
;
return
0
;
}
asmlinkage
int
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录