forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/arch/openrisc/kernel/ptrace.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * OpenRISC ptrace.c
34 *
....@@ -9,11 +10,6 @@
910 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
1011 * Copyright (C) 2005 Gyorgy Jeney <nog@bsemi.com>
1112 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12
- *
13
- * This program is free software; you can redistribute it and/or
14
- * modify it under the terms of the GNU General Public License
15
- * as published by the Free Software Foundation; either version
16
- * 2 of the License, or (at your option) any later version.
1713 */
1814
1915 #include <linux/kernel.h>
....@@ -30,9 +26,7 @@
3026 #include <linux/elf.h>
3127
3228 #include <asm/thread_info.h>
33
-#include <asm/segment.h>
3429 #include <asm/page.h>
35
-#include <asm/pgtable.h>
3630
3731 /*
3832 * Copy the thread state to a regset that can be interpreted by userspace.
....@@ -50,29 +44,15 @@
5044 */
5145 static int genregs_get(struct task_struct *target,
5246 const struct user_regset *regset,
53
- unsigned int pos, unsigned int count,
54
- void *kbuf, void __user * ubuf)
47
+ struct membuf to)
5548 {
5649 const struct pt_regs *regs = task_pt_regs(target);
57
- int ret;
5850
5951 /* r0 */
60
- ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf, 0, 4);
61
-
62
- if (!ret)
63
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
64
- regs->gpr+1, 4, 4*32);
65
- if (!ret)
66
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
67
- &regs->pc, 4*32, 4*33);
68
- if (!ret)
69
- ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
70
- &regs->sr, 4*33, 4*34);
71
- if (!ret)
72
- ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
73
- 4*34, -1);
74
-
75
- return ret;
52
+ membuf_zero(&to, 4);
53
+ membuf_write(&to, regs->gpr + 1, 31 * 4);
54
+ membuf_store(&to, regs->pc);
55
+ return membuf_store(&to, regs->sr);
7656 }
7757
7858 /*
....@@ -120,7 +100,7 @@
120100 .n = ELF_NGREG,
121101 .size = sizeof(long),
122102 .align = sizeof(long),
123
- .get = genregs_get,
103
+ .regset_get = genregs_get,
124104 .set = genregs_set,
125105 },
126106 };