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
d256eb8d
Commit
d256eb8d
authored
Feb 07, 2008
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SPARC32]: Use regsets in arch_ptrace().
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
9473272a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
68 deletions
+47
-68
arch/sparc/kernel/ptrace.c
arch/sparc/kernel/ptrace.c
+47
-68
No files found.
arch/sparc/kernel/ptrace.c
View file @
d256eb8d
...
...
@@ -322,54 +322,39 @@ const struct user_regset_view *task_user_regset_view(struct task_struct *task)
long
arch_ptrace
(
struct
task_struct
*
child
,
long
request
,
long
addr
,
long
data
)
{
unsigned
long
addr2
=
current
->
thread
.
kregs
->
u_regs
[
UREG_I4
];
int
i
,
ret
;
const
struct
user_regset_view
*
view
;
int
ret
;
view
=
task_user_regset_view
(
child
);
switch
(
request
)
{
case
PTRACE_GETREGS
:
{
struct
pt_regs
__user
*
pregs
=
(
struct
pt_regs
__user
*
)
addr
;
struct
pt_regs
*
cregs
=
child
->
thread
.
kregs
;
ret
=
-
EFAULT
;
if
(
!
access_ok
(
VERIFY_WRITE
,
pregs
,
sizeof
(
struct
pt_regs
)))
break
;
__put_user
(
cregs
->
psr
,
(
&
pregs
->
psr
));
__put_user
(
cregs
->
pc
,
(
&
pregs
->
pc
));
__put_user
(
cregs
->
npc
,
(
&
pregs
->
npc
));
__put_user
(
cregs
->
y
,
(
&
pregs
->
y
));
for
(
i
=
1
;
i
<
16
;
i
++
)
__put_user
(
cregs
->
u_regs
[
i
],
&
pregs
->
u_regs
[
i
-
1
]);
ret
=
0
;
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u32
),
4
*
sizeof
(
u32
),
&
pregs
->
psr
);
if
(
!
ret
)
copy_regset_to_user
(
child
,
view
,
REGSET_GENERAL
,
1
*
sizeof
(
u32
),
15
*
sizeof
(
u32
),
&
pregs
->
u_regs
[
0
]);
break
;
}
case
PTRACE_SETREGS
:
{
struct
pt_regs
__user
*
pregs
=
(
struct
pt_regs
__user
*
)
addr
;
struct
pt_regs
*
cregs
=
child
->
thread
.
kregs
;
unsigned
long
psr
,
pc
,
npc
,
y
;
/* Must be careful, tracing process can only set certain
* bits in the psr.
*/
ret
=
-
EFAULT
;
if
(
!
access_ok
(
VERIFY_READ
,
pregs
,
sizeof
(
struct
pt_regs
)))
break
;
__get_user
(
psr
,
(
&
pregs
->
psr
));
__get_user
(
pc
,
(
&
pregs
->
pc
));
__get_user
(
npc
,
(
&
pregs
->
npc
));
__get_user
(
y
,
(
&
pregs
->
y
));
psr
&=
PSR_ICC
;
cregs
->
psr
&=
~
PSR_ICC
;
cregs
->
psr
|=
psr
;
if
(
!
((
pc
|
npc
)
&
3
))
{
cregs
->
pc
=
pc
;
cregs
->
npc
=
npc
;
}
cregs
->
y
=
y
;
for
(
i
=
1
;
i
<
16
;
i
++
)
__get_user
(
cregs
->
u_regs
[
i
],
&
pregs
->
u_regs
[
i
-
1
]);
ret
=
0
;
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
32
*
sizeof
(
u32
),
4
*
sizeof
(
u32
),
&
pregs
->
psr
);
if
(
!
ret
)
copy_regset_from_user
(
child
,
view
,
REGSET_GENERAL
,
1
*
sizeof
(
u32
),
15
*
sizeof
(
u32
),
&
pregs
->
u_regs
[
0
]);
break
;
}
...
...
@@ -387,23 +372,23 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
};
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
ret
=
-
EFAULT
;
if
(
!
access_ok
(
VERIFY_WRITE
,
fps
,
sizeof
(
struct
fps
)))
break
;
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u32
),
32
*
sizeof
(
u32
),
&
fps
->
regs
[
0
]);
if
(
!
ret
)
ret
=
copy_regset_to_user
(
child
,
view
,
REGSET_FP
,
33
*
sizeof
(
u32
),
1
*
sizeof
(
u32
),
&
fps
->
fsr
);
for
(
i
=
0
;
i
<
32
;
i
++
)
__put_user
(
child
->
thread
.
float_regs
[
i
],
&
fps
->
regs
[
i
]);
__put_user
(
child
->
thread
.
fsr
,
(
&
fps
->
fsr
));
__put_user
(
child
->
thread
.
fpqdepth
,
(
&
fps
->
fpqd
));
__put_user
(
0
,
(
&
fps
->
flags
));
__put_user
(
0
,
(
&
fps
->
extra
));
for
(
i
=
0
;
i
<
16
;
i
++
)
{
__put_user
(
child
->
thread
.
fpqueue
[
i
].
insn_addr
,
(
&
fps
->
fpq
[
i
].
insnaddr
));
__put_user
(
child
->
thread
.
fpqueue
[
i
].
insn
,
&
fps
->
fpq
[
i
].
insn
);
if
(
!
ret
)
{
if
(
__put_user
(
0
,
&
fps
->
fpqd
)
||
__put_user
(
0
,
&
fps
->
flags
)
||
__put_user
(
0
,
&
fps
->
extra
)
||
clear_user
(
fps
->
fpq
,
sizeof
(
fps
->
fpq
)))
ret
=
-
EFAULT
;
}
ret
=
0
;
break
;
}
...
...
@@ -421,21 +406,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
};
struct
fps
__user
*
fps
=
(
struct
fps
__user
*
)
addr
;
ret
=
-
EFAULT
;
if
(
!
access_ok
(
VERIFY_READ
,
fps
,
sizeof
(
struct
fps
)))
break
;
copy_from_user
(
&
child
->
thread
.
float_regs
[
0
],
&
fps
->
regs
[
0
],
(
32
*
sizeof
(
unsigned
long
)));
__get_user
(
child
->
thread
.
fsr
,
(
&
fps
->
fsr
));
__get_user
(
child
->
thread
.
fpqdepth
,
(
&
fps
->
fpqd
));
for
(
i
=
0
;
i
<
16
;
i
++
)
{
__get_user
(
child
->
thread
.
fpqueue
[
i
].
insn_addr
,
(
&
fps
->
fpq
[
i
].
insnaddr
));
__get_user
(
child
->
thread
.
fpqueue
[
i
].
insn
,
&
fps
->
fpq
[
i
].
insn
);
}
ret
=
0
;
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_FP
,
0
*
sizeof
(
u32
),
32
*
sizeof
(
u32
),
&
fps
->
regs
[
0
]);
if
(
!
ret
)
ret
=
copy_regset_from_user
(
child
,
view
,
REGSET_FP
,
33
*
sizeof
(
u32
),
1
*
sizeof
(
u32
),
&
fps
->
fsr
);
break
;
}
...
...
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