| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * OpenRISC ptrace.c |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> |
|---|
| 10 | 11 | * Copyright (C) 2005 Gyorgy Jeney <nog@bsemi.com> |
|---|
| 11 | 12 | * 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. |
|---|
| 17 | 13 | */ |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 30 | 26 | #include <linux/elf.h> |
|---|
| 31 | 27 | |
|---|
| 32 | 28 | #include <asm/thread_info.h> |
|---|
| 33 | | -#include <asm/segment.h> |
|---|
| 34 | 29 | #include <asm/page.h> |
|---|
| 35 | | -#include <asm/pgtable.h> |
|---|
| 36 | 30 | |
|---|
| 37 | 31 | /* |
|---|
| 38 | 32 | * Copy the thread state to a regset that can be interpreted by userspace. |
|---|
| .. | .. |
|---|
| 50 | 44 | */ |
|---|
| 51 | 45 | static int genregs_get(struct task_struct *target, |
|---|
| 52 | 46 | const struct user_regset *regset, |
|---|
| 53 | | - unsigned int pos, unsigned int count, |
|---|
| 54 | | - void *kbuf, void __user * ubuf) |
|---|
| 47 | + struct membuf to) |
|---|
| 55 | 48 | { |
|---|
| 56 | 49 | const struct pt_regs *regs = task_pt_regs(target); |
|---|
| 57 | | - int ret; |
|---|
| 58 | 50 | |
|---|
| 59 | 51 | /* 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 | | - ®s->pc, 4*32, 4*33); |
|---|
| 68 | | - if (!ret) |
|---|
| 69 | | - ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, |
|---|
| 70 | | - ®s->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); |
|---|
| 76 | 56 | } |
|---|
| 77 | 57 | |
|---|
| 78 | 58 | /* |
|---|
| .. | .. |
|---|
| 120 | 100 | .n = ELF_NGREG, |
|---|
| 121 | 101 | .size = sizeof(long), |
|---|
| 122 | 102 | .align = sizeof(long), |
|---|
| 123 | | - .get = genregs_get, |
|---|
| 103 | + .regset_get = genregs_get, |
|---|
| 124 | 104 | .set = genregs_set, |
|---|
| 125 | 105 | }, |
|---|
| 126 | 106 | }; |
|---|