dtrace_isa.c (233409) | dtrace_isa.c (233525) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * --- 5 unchanged lines hidden (view full) --- 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 * | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * --- 5 unchanged lines hidden (view full) --- 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 * |
22 * $FreeBSD: head/sys/cddl/dev/dtrace/mips/dtrace_isa.c 233409 2012-03-24 05:14:37Z gonzo $ | 22 * $FreeBSD: head/sys/cddl/dev/dtrace/mips/dtrace_isa.c 233525 2012-03-26 21:47:06Z gonzo $ |
23 */ 24/* 25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. 27 */ 28#include <sys/cdefs.h> 29 30#include <sys/param.h> --- 451 unchanged lines hidden (view full) --- 482 } 483 484 if (!MIPS_IS_VALID_KERNELADDR(ra)) 485 return (-1); 486 487 *pc = ra; 488 *sp += stksize; 489 | 23 */ 24/* 25 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 26 * Use is subject to license terms. 27 */ 28#include <sys/cdefs.h> 29 30#include <sys/param.h> --- 451 unchanged lines hidden (view full) --- 482 } 483 484 if (!MIPS_IS_VALID_KERNELADDR(ra)) 485 return (-1); 486 487 *pc = ra; 488 *sp += stksize; 489 |
490#if defined(__mips_o32) 491 /* 492 * For MIPS32 fill out arguments 5..8 from the stack 493 */ 494 for (arg = 4; arg < 8; arg++) { 495 addr = (vm_offset_t)(*sp + arg*sizeof(register_t)); 496 if (args) 497 args[arg] = kdbpeekd((int *)addr); 498 if (valid_args) 499 valid_args[arg] = 1; 500 } 501#endif 502 |
|
490 return (0); 491error: 492 return (-1); 493} 494 495static int 496dtrace_next_uframe(register_t *pc, register_t *sp, register_t *ra) 497{ 498 int offset, registers_on_stack; 499 uint32_t opcode, mask; 500 register_t function_start; 501 int stksize; 502 InstFmt i; 503 | 503 return (0); 504error: 505 return (-1); 506} 507 508static int 509dtrace_next_uframe(register_t *pc, register_t *sp, register_t *ra) 510{ 511 int offset, registers_on_stack; 512 uint32_t opcode, mask; 513 register_t function_start; 514 int stksize; 515 InstFmt i; 516 |
517 volatile uint16_t *flags = 518 (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; 519 |
|
504 registers_on_stack = 0; 505 mask = 0; 506 function_start = 0; 507 offset = 0; 508 stksize = 0; 509 510 while (offset < MAX_FUNCTION_SIZE) { 511 opcode = dtrace_fuword32((void *)(vm_offset_t)(*pc - offset)); 512 | 520 registers_on_stack = 0; 521 mask = 0; 522 function_start = 0; 523 offset = 0; 524 stksize = 0; 525 526 while (offset < MAX_FUNCTION_SIZE) { 527 opcode = dtrace_fuword32((void *)(vm_offset_t)(*pc - offset)); 528 |
529 if (*flags & CPU_DTRACE_FAULT) 530 goto fault; 531 |
|
513 /* [d]addiu sp, sp, -X*/ 514 if (((opcode & 0xffff8000) == 0x27bd8000) 515 || ((opcode & 0xffff8000) == 0x67bd8000)) { 516 function_start = *pc - offset; 517 registers_on_stack = 1; 518 break; 519 } 520 --- 67 unchanged lines hidden (view full) --- 588 case OP_DADDIU: 589 /* look for stack pointer adjustment */ 590 if (i.IType.rs != 29 || i.IType.rt != 29) 591 break; 592 stksize = -((short)i.IType.imm); 593 } 594 595 offset += sizeof(int); | 532 /* [d]addiu sp, sp, -X*/ 533 if (((opcode & 0xffff8000) == 0x27bd8000) 534 || ((opcode & 0xffff8000) == 0x67bd8000)) { 535 function_start = *pc - offset; 536 registers_on_stack = 1; 537 break; 538 } 539 --- 67 unchanged lines hidden (view full) --- 607 case OP_DADDIU: 608 /* look for stack pointer adjustment */ 609 if (i.IType.rs != 29 || i.IType.rt != 29) 610 break; 611 stksize = -((short)i.IType.imm); 612 } 613 614 offset += sizeof(int); |
615 616 if (*flags & CPU_DTRACE_FAULT) 617 goto fault; |
|
596 } 597 } 598 599 /* 600 * We reached the end of backtrace 601 */ 602 if (*pc == *ra) 603 return (-1); 604 605 *pc = *ra; 606 *sp += stksize; 607 608 return (0); | 618 } 619 } 620 621 /* 622 * We reached the end of backtrace 623 */ 624 if (*pc == *ra) 625 return (-1); 626 627 *pc = *ra; 628 *sp += stksize; 629 630 return (0); |
631fault: 632 /* 633 * We just got lost in backtrace, no big deal 634 */ 635 *flags &= ~CPU_DTRACE_FAULT; 636 return (-1); |
|
609} 610 611static int 612dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) 613{ 614 615 if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { 616 DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); --- 82 unchanged lines hidden --- | 637} 638 639static int 640dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size) 641{ 642 643 if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) { 644 DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR); --- 82 unchanged lines hidden --- |