ptrace.c (dcad7854fcce6a2d49b6a3ead5bbefeff047e559) | ptrace.c (e95a4f8cb985e759648b32ed0b721a472deb86a5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 4#include <linux/audit.h> 5#include <linux/elf.h> 6#include <linux/errno.h> 7#include <linux/kernel.h> 8#include <linux/mm.h> --- 62 unchanged lines hidden (view full) --- 71 72enum csky_regset { 73 REGSET_GPR, 74 REGSET_FPR, 75}; 76 77static int gpr_get(struct task_struct *target, 78 const struct user_regset *regset, | 1// SPDX-License-Identifier: GPL-2.0 2// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 4#include <linux/audit.h> 5#include <linux/elf.h> 6#include <linux/errno.h> 7#include <linux/kernel.h> 8#include <linux/mm.h> --- 62 unchanged lines hidden (view full) --- 71 72enum csky_regset { 73 REGSET_GPR, 74 REGSET_FPR, 75}; 76 77static int gpr_get(struct task_struct *target, 78 const struct user_regset *regset, |
79 struct membuf to) | 79 unsigned int pos, unsigned int count, 80 void *kbuf, void __user *ubuf) |
80{ | 81{ |
81 struct pt_regs *regs = task_pt_regs(target); | 82 struct pt_regs *regs; |
82 | 83 |
84 regs = task_pt_regs(target); 85 |
|
83 /* Abiv1 regs->tls is fake and we need sync here. */ 84 regs->tls = task_thread_info(target)->tp_value; 85 | 86 /* Abiv1 regs->tls is fake and we need sync here. */ 87 regs->tls = task_thread_info(target)->tp_value; 88 |
86 return membuf_write(&to, regs, sizeof(regs)); | 89 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs, 0, -1); |
87} 88 89static int gpr_set(struct task_struct *target, 90 const struct user_regset *regset, 91 unsigned int pos, unsigned int count, 92 const void *kbuf, const void __user *ubuf) 93{ 94 int ret; --- 11 unchanged lines hidden (view full) --- 106 107 *task_pt_regs(target) = regs; 108 109 return 0; 110} 111 112static int fpr_get(struct task_struct *target, 113 const struct user_regset *regset, | 90} 91 92static int gpr_set(struct task_struct *target, 93 const struct user_regset *regset, 94 unsigned int pos, unsigned int count, 95 const void *kbuf, const void __user *ubuf) 96{ 97 int ret; --- 11 unchanged lines hidden (view full) --- 109 110 *task_pt_regs(target) = regs; 111 112 return 0; 113} 114 115static int fpr_get(struct task_struct *target, 116 const struct user_regset *regset, |
114 struct membuf to) | 117 unsigned int pos, unsigned int count, 118 void *kbuf, void __user *ubuf) |
115{ 116 struct user_fp *regs = (struct user_fp *)&target->thread.user_fp; 117 118#if defined(CONFIG_CPU_HAS_FPUV2) && !defined(CONFIG_CPU_HAS_VDSP) 119 int i; 120 struct user_fp tmp = *regs; 121 122 for (i = 0; i < 16; i++) { 123 tmp.vr[i*4] = regs->vr[i*2]; 124 tmp.vr[i*4 + 1] = regs->vr[i*2 + 1]; 125 } 126 127 for (i = 0; i < 32; i++) 128 tmp.vr[64 + i] = regs->vr[32 + i]; 129 | 119{ 120 struct user_fp *regs = (struct user_fp *)&target->thread.user_fp; 121 122#if defined(CONFIG_CPU_HAS_FPUV2) && !defined(CONFIG_CPU_HAS_VDSP) 123 int i; 124 struct user_fp tmp = *regs; 125 126 for (i = 0; i < 16; i++) { 127 tmp.vr[i*4] = regs->vr[i*2]; 128 tmp.vr[i*4 + 1] = regs->vr[i*2 + 1]; 129 } 130 131 for (i = 0; i < 32; i++) 132 tmp.vr[64 + i] = regs->vr[32 + i]; 133 |
130 return membuf_write(&to, &tmp, sizeof(tmp)); | 134 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &tmp, 0, -1); |
131#else | 135#else |
132 return membuf_write(&to, regs, sizeof(*regs)); | 136 return user_regset_copyout(&pos, &count, &kbuf, &ubuf, regs, 0, -1); |
133#endif 134} 135 136static int fpr_set(struct task_struct *target, 137 const struct user_regset *regset, 138 unsigned int pos, unsigned int count, 139 const void *kbuf, const void __user *ubuf) 140{ --- 23 unchanged lines hidden (view full) --- 164} 165 166static const struct user_regset csky_regsets[] = { 167 [REGSET_GPR] = { 168 .core_note_type = NT_PRSTATUS, 169 .n = sizeof(struct pt_regs) / sizeof(u32), 170 .size = sizeof(u32), 171 .align = sizeof(u32), | 137#endif 138} 139 140static int fpr_set(struct task_struct *target, 141 const struct user_regset *regset, 142 unsigned int pos, unsigned int count, 143 const void *kbuf, const void __user *ubuf) 144{ --- 23 unchanged lines hidden (view full) --- 168} 169 170static const struct user_regset csky_regsets[] = { 171 [REGSET_GPR] = { 172 .core_note_type = NT_PRSTATUS, 173 .n = sizeof(struct pt_regs) / sizeof(u32), 174 .size = sizeof(u32), 175 .align = sizeof(u32), |
172 .regset_get = gpr_get, 173 .set = gpr_set, | 176 .get = &gpr_get, 177 .set = &gpr_set, |
174 }, 175 [REGSET_FPR] = { 176 .core_note_type = NT_PRFPREG, 177 .n = sizeof(struct user_fp) / sizeof(u32), 178 .size = sizeof(u32), 179 .align = sizeof(u32), | 178 }, 179 [REGSET_FPR] = { 180 .core_note_type = NT_PRFPREG, 181 .n = sizeof(struct user_fp) / sizeof(u32), 182 .size = sizeof(u32), 183 .align = sizeof(u32), |
180 .regset_get = fpr_get, 181 .set = fpr_set, | 184 .get = &fpr_get, 185 .set = &fpr_set, |
182 }, 183}; 184 185static const struct user_regset_view user_csky_view = { 186 .name = "csky", 187 .e_machine = ELF_ARCH, 188 .regsets = csky_regsets, 189 .n = ARRAY_SIZE(csky_regsets), --- 121 unchanged lines hidden (view full) --- 311 default: 312 ret = ptrace_request(child, request, addr, data); 313 break; 314 } 315 316 return ret; 317} 318 | 186 }, 187}; 188 189static const struct user_regset_view user_csky_view = { 190 .name = "csky", 191 .e_machine = ELF_ARCH, 192 .regsets = csky_regsets, 193 .n = ARRAY_SIZE(csky_regsets), --- 121 unchanged lines hidden (view full) --- 315 default: 316 ret = ptrace_request(child, request, addr, data); 317 break; 318 } 319 320 return ret; 321} 322 |
319asmlinkage void syscall_trace_enter(struct pt_regs *regs) | 323asmlinkage int syscall_trace_enter(struct pt_regs *regs) |
320{ 321 if (test_thread_flag(TIF_SYSCALL_TRACE)) 322 if (tracehook_report_syscall_entry(regs)) | 324{ 325 if (test_thread_flag(TIF_SYSCALL_TRACE)) 326 if (tracehook_report_syscall_entry(regs)) |
323 syscall_set_nr(current, regs, -1); | 327 return -1; |
324 | 328 |
329 if (secure_computing() == -1) 330 return -1; 331 |
|
325 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 326 trace_sys_enter(regs, syscall_get_nr(current, regs)); 327 328 audit_syscall_entry(regs_syscallid(regs), regs->a0, regs->a1, regs->a2, regs->a3); | 332 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) 333 trace_sys_enter(regs, syscall_get_nr(current, regs)); 334 335 audit_syscall_entry(regs_syscallid(regs), regs->a0, regs->a1, regs->a2, regs->a3); |
336 return 0; |
|
329} 330 331asmlinkage void syscall_trace_exit(struct pt_regs *regs) 332{ 333 audit_syscall_exit(regs); 334 335 if (test_thread_flag(TIF_SYSCALL_TRACE)) 336 tracehook_report_syscall_exit(regs, 0); --- 84 unchanged lines hidden --- | 337} 338 339asmlinkage void syscall_trace_exit(struct pt_regs *regs) 340{ 341 audit_syscall_exit(regs); 342 343 if (test_thread_flag(TIF_SYSCALL_TRACE)) 344 tracehook_report_syscall_exit(regs, 0); --- 84 unchanged lines hidden --- |