hwpmc_mips.c (232846) | hwpmc_mips.c (232992) |
---|---|
1/*- 2 * Copyright (c) 2010, George V. Neville-Neil <gnn@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010, George V. Neville-Neil <gnn@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_mips.c 232846 2012-03-12 01:19:41Z gonzo $"); | 29__FBSDID("$FreeBSD: head/sys/dev/hwpmc/hwpmc_mips.c 232992 2012-03-14 23:46:07Z gonzo $"); |
30 31#include <sys/param.h> 32#include <sys/pmc.h> 33#include <sys/systm.h> 34 35#include <machine/pmc_mdep.h> 36#include <machine/md_var.h> 37#include <machine/mips_opcode.h> --- 107 unchanged lines hidden (view full) --- 145 case OP_BCx: 146 case OP_BCy: 147 more = 2; /* stop after next instruction */ 148 }; 149 break; 150 151 case OP_SW: 152 case OP_SD: | 30 31#include <sys/param.h> 32#include <sys/pmc.h> 33#include <sys/systm.h> 34 35#include <machine/pmc_mdep.h> 36#include <machine/md_var.h> 37#include <machine/mips_opcode.h> --- 107 unchanged lines hidden (view full) --- 145 case OP_BCx: 146 case OP_BCy: 147 more = 2; /* stop after next instruction */ 148 }; 149 break; 150 151 case OP_SW: 152 case OP_SD: |
153 /* 154 * SP is being saved using S8(FP). Most likely it indicates 155 * that SP is modified in the function and we can't get 156 * its value safely without emulating code backward 157 * So just bail out on functions like this 158 */ 159 if ((i.IType.rs == 30) && (i.IType.rt = 29)) 160 return (-1); 161 |
|
153 /* look for saved registers on the stack */ 154 if (i.IType.rs != 29) 155 break; 156 /* only restore the first one */ 157 if (mask & (1 << i.IType.rt)) 158 break; 159 mask |= (1 << i.IType.rt); 160 if (i.IType.rt == 31) --- 161 unchanged lines hidden (view full) --- 322 323int 324pmc_save_kernel_callchain(uintptr_t *cc, int nframes, 325 struct trapframe *tf) 326{ 327 register_t pc, ra, sp; 328 int frames = 0; 329 | 162 /* look for saved registers on the stack */ 163 if (i.IType.rs != 29) 164 break; 165 /* only restore the first one */ 166 if (mask & (1 << i.IType.rt)) 167 break; 168 mask |= (1 << i.IType.rt); 169 if (i.IType.rt == 31) --- 161 unchanged lines hidden (view full) --- 331 332int 333pmc_save_kernel_callchain(uintptr_t *cc, int nframes, 334 struct trapframe *tf) 335{ 336 register_t pc, ra, sp; 337 int frames = 0; 338 |
330 pc = (uint64_t)tf->pc; 331 sp = (uint64_t)tf->sp; 332 ra = (uint64_t)tf->ra; | 339 pc = tf->pc; 340 sp = tf->sp; 341 ra = tf->ra; |
333 334 /* 335 * Unwind, and unwind, and unwind 336 */ 337 while (1) { 338 cc[frames++] = pc; 339 if (frames >= nframes) 340 break; --- 7 unchanged lines hidden (view full) --- 348 349int 350pmc_save_user_callchain(uintptr_t *cc, int nframes, 351 struct trapframe *tf) 352{ 353 register_t pc, ra, sp; 354 int frames = 0; 355 | 342 343 /* 344 * Unwind, and unwind, and unwind 345 */ 346 while (1) { 347 cc[frames++] = pc; 348 if (frames >= nframes) 349 break; --- 7 unchanged lines hidden (view full) --- 357 358int 359pmc_save_user_callchain(uintptr_t *cc, int nframes, 360 struct trapframe *tf) 361{ 362 register_t pc, ra, sp; 363 int frames = 0; 364 |
356 pc = (uint64_t)tf->pc; 357 sp = (uint64_t)tf->sp; 358 ra = (uint64_t)tf->ra; | 365 pc = tf->pc; 366 sp = tf->sp; 367 ra = tf->ra; |
359 360 /* 361 * Unwind, and unwind, and unwind 362 */ 363 while (1) { 364 cc[frames++] = pc; 365 if (frames >= nframes) 366 break; 367 368 if (pmc_next_uframe(&pc, &sp, &ra) < 0) 369 break; 370 } 371 372 return (frames); 373} | 368 369 /* 370 * Unwind, and unwind, and unwind 371 */ 372 while (1) { 373 cc[frames++] = pc; 374 if (frames >= nframes) 375 break; 376 377 if (pmc_next_uframe(&pc, &sp, &ra) < 0) 378 break; 379 } 380 381 return (frames); 382} |