提交 ecd3d4bc 编写于 作者: K Kyle McMartin 提交者: Kyle McMartin

parisc: stop using task->ptrace for {single,block}step flags

task->ptrace flags belong to generic code, so instead thief some
TIF_ bits to use. Somewhat risky conversion of code to test TASK_FLAGS
instead of TASK_PTRACE in assembly, but it looks alright in the end.
Signed-off-by: NKyle McMartin <kyle@mcmartin.ca>
上级 2798af1a
...@@ -60,6 +60,8 @@ struct thread_info { ...@@ -60,6 +60,8 @@ struct thread_info {
#define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */ #define TIF_RESTORE_SIGMASK 6 /* restore saved signal mask */
#define TIF_FREEZE 7 /* is freezing for suspend */ #define TIF_FREEZE 7 /* is freezing for suspend */
#define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */
#define TIF_SINGLESTEP 9 /* single stepping? */
#define TIF_BLOCKSTEP 10 /* branch stepping? */
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
...@@ -69,6 +71,8 @@ struct thread_info { ...@@ -69,6 +71,8 @@ struct thread_info {
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#define _TIF_FREEZE (1 << TIF_FREEZE) #define _TIF_FREEZE (1 << TIF_FREEZE)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
#define _TIF_BLOCKSTEP (1 << TIF_BLOCKSTEP)
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \ #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | \
_TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK) _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
......
...@@ -270,8 +270,8 @@ int main(void) ...@@ -270,8 +270,8 @@ int main(void)
DEFINE(DTLB_OFF_COUNT, offsetof(struct pdc_cache_info, dt_off_count)); DEFINE(DTLB_OFF_COUNT, offsetof(struct pdc_cache_info, dt_off_count));
DEFINE(DTLB_LOOP, offsetof(struct pdc_cache_info, dt_loop)); DEFINE(DTLB_LOOP, offsetof(struct pdc_cache_info, dt_loop));
BLANK(); BLANK();
DEFINE(PA_BLOCKSTEP_BIT, 31-PT_BLOCKSTEP_BIT); DEFINE(TIF_BLOCKSTEP_PA_BIT, 31-TIF_BLOCKSTEP);
DEFINE(PA_SINGLESTEP_BIT, 31-PT_SINGLESTEP_BIT); DEFINE(TIF_SINGLESTEP_PA_BIT, 31-TIF_SINGLESTEP);
BLANK(); BLANK();
DEFINE(ASM_PMD_SHIFT, PMD_SHIFT); DEFINE(ASM_PMD_SHIFT, PMD_SHIFT);
DEFINE(ASM_PGDIR_SHIFT, PGDIR_SHIFT); DEFINE(ASM_PGDIR_SHIFT, PGDIR_SHIFT);
......
...@@ -2047,12 +2047,13 @@ syscall_do_signal: ...@@ -2047,12 +2047,13 @@ syscall_do_signal:
b,n syscall_check_sig b,n syscall_check_sig
syscall_restore: syscall_restore:
/* Are we being ptraced? */
LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1 LDREG TI_TASK-THREAD_SZ_ALGN-FRAME_SIZE(%r30),%r1
ldw TASK_PTRACE(%r1), %r19 /* Are we being ptraced? */
bb,< %r19,31,syscall_restore_rfi ldw TASK_FLAGS(%r1),%r19
nop ldi (_TIF_SINGLESTEP|_TIF_BLOCKSTEP),%r2
and,COND(=) %r19,%r2,%r0
b,n syscall_restore_rfi
ldo TASK_PT_FR31(%r1),%r19 /* reload fpregs */ ldo TASK_PT_FR31(%r1),%r19 /* reload fpregs */
rest_fp %r19 rest_fp %r19
...@@ -2113,16 +2114,16 @@ syscall_restore_rfi: ...@@ -2113,16 +2114,16 @@ syscall_restore_rfi:
ldi 0x0b,%r20 /* Create new PSW */ ldi 0x0b,%r20 /* Create new PSW */
depi -1,13,1,%r20 /* C, Q, D, and I bits */ depi -1,13,1,%r20 /* C, Q, D, and I bits */
/* The values of PA_SINGLESTEP_BIT and PA_BLOCKSTEP_BIT are /* The values of SINGLESTEP_BIT and BLOCKSTEP_BIT are
* set in include/linux/ptrace.h and converted to PA bitmap * set in thread_info.h and converted to PA bitmap
* numbers in asm-offsets.c */ * numbers in asm-offsets.c */
/* if ((%r19.PA_SINGLESTEP_BIT)) { %r20.27=1} */ /* if ((%r19.SINGLESTEP_BIT)) { %r20.27=1} */
extru,= %r19,PA_SINGLESTEP_BIT,1,%r0 extru,= %r19,TIF_SINGLESTEP_PA_BIT,1,%r0
depi -1,27,1,%r20 /* R bit */ depi -1,27,1,%r20 /* R bit */
/* if ((%r19.PA_BLOCKSTEP_BIT)) { %r20.7=1} */ /* if ((%r19.BLOCKSTEP_BIT)) { %r20.7=1} */
extru,= %r19,PA_BLOCKSTEP_BIT,1,%r0 extru,= %r19,TIF_BLOCKSTEP_PA_BIT,1,%r0
depi -1,7,1,%r20 /* T bit */ depi -1,7,1,%r20 /* T bit */
STREG %r20,TASK_PT_PSW(%r1) STREG %r20,TASK_PT_PSW(%r1)
......
...@@ -36,7 +36,8 @@ ...@@ -36,7 +36,8 @@
*/ */
void ptrace_disable(struct task_struct *task) void ptrace_disable(struct task_struct *task)
{ {
task->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP); clear_tsk_thread_flag(task, TIF_SINGLESTEP);
clear_tsk_thread_flag(task, TIF_BLOCKSTEP);
/* make sure the trap bits are not set */ /* make sure the trap bits are not set */
pa_psw(task)->r = 0; pa_psw(task)->r = 0;
...@@ -56,8 +57,8 @@ void user_disable_single_step(struct task_struct *task) ...@@ -56,8 +57,8 @@ void user_disable_single_step(struct task_struct *task)
void user_enable_single_step(struct task_struct *task) void user_enable_single_step(struct task_struct *task)
{ {
task->ptrace &= ~PT_BLOCKSTEP; clear_tsk_thread_flag(task, TIF_BLOCKSTEP);
task->ptrace |= PT_SINGLESTEP; set_tsk_thread_flag(task, TIF_SINGLESTEP);
if (pa_psw(task)->n) { if (pa_psw(task)->n) {
struct siginfo si; struct siginfo si;
...@@ -99,8 +100,8 @@ void user_enable_single_step(struct task_struct *task) ...@@ -99,8 +100,8 @@ void user_enable_single_step(struct task_struct *task)
void user_enable_block_step(struct task_struct *task) void user_enable_block_step(struct task_struct *task)
{ {
task->ptrace &= ~PT_SINGLESTEP; clear_tsk_thread_flag(task, TIF_SINGLESTEP);
task->ptrace |= PT_BLOCKSTEP; set_tsk_thread_flag(task, TIF_BLOCKSTEP);
/* Enable taken branch trap. */ /* Enable taken branch trap. */
pa_psw(task)->r = 0; pa_psw(task)->r = 0;
...@@ -275,7 +276,8 @@ long do_syscall_trace_enter(struct pt_regs *regs) ...@@ -275,7 +276,8 @@ long do_syscall_trace_enter(struct pt_regs *regs)
void do_syscall_trace_exit(struct pt_regs *regs) void do_syscall_trace_exit(struct pt_regs *regs)
{ {
int stepping = !!(current->ptrace & (PT_SINGLESTEP|PT_BLOCKSTEP)); int stepping = test_thread_flag(TIF_SINGLESTEP) ||
test_thread_flag(TIF_BLOCKSTEP);
if (stepping || test_thread_flag(TIF_SYSCALL_TRACE)) if (stepping || test_thread_flag(TIF_SYSCALL_TRACE))
tracehook_report_syscall_exit(regs, stepping); tracehook_report_syscall_exit(regs, stepping);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册