dtrace_isa.c (269557) | dtrace_isa.c (281482) |
---|---|
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: stable/10/sys/cddl/dev/dtrace/i386/dtrace_isa.c 269557 2014-08-05 01:53:15Z markj $ | 22 * $FreeBSD: stable/10/sys/cddl/dev/dtrace/i386/dtrace_isa.c 281482 2015-04-13 01:42:24Z markj $ |
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> --- 19 unchanged lines hidden (view full) --- 50#define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK && \ 51 ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS) 52 53uint8_t dtrace_fuword8_nocheck(void *); 54uint16_t dtrace_fuword16_nocheck(void *); 55uint32_t dtrace_fuword32_nocheck(void *); 56uint64_t dtrace_fuword64_nocheck(void *); 57 | 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> --- 19 unchanged lines hidden (view full) --- 50#define INKERNEL(va) (((vm_offset_t)(va)) >= USRSTACK && \ 51 ((vm_offset_t)(va)) < VM_MAX_KERNEL_ADDRESS) 52 53uint8_t dtrace_fuword8_nocheck(void *); 54uint16_t dtrace_fuword16_nocheck(void *); 55uint32_t dtrace_fuword32_nocheck(void *); 56uint64_t dtrace_fuword64_nocheck(void *); 57 |
58int dtrace_ustackdepth_max = 2048; 59 |
|
58void 59dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, 60 uint32_t *intrpc) 61{ 62 int depth = 0; 63 register_t ebp; 64 struct i386_frame *frame; 65 vm_offset_t callpc; --- 42 unchanged lines hidden (view full) --- 108dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, 109 uintptr_t sp) 110{ 111#ifdef notyet 112 proc_t *p = curproc; 113 uintptr_t oldcontext = lwp->lwp_oldcontext; /* XXX signal stack. */ 114 size_t s1, s2; 115#endif | 60void 61dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes, 62 uint32_t *intrpc) 63{ 64 int depth = 0; 65 register_t ebp; 66 struct i386_frame *frame; 67 vm_offset_t callpc; --- 42 unchanged lines hidden (view full) --- 110dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc, 111 uintptr_t sp) 112{ 113#ifdef notyet 114 proc_t *p = curproc; 115 uintptr_t oldcontext = lwp->lwp_oldcontext; /* XXX signal stack. */ 116 size_t s1, s2; 117#endif |
118 uintptr_t oldsp; |
|
116 volatile uint16_t *flags = 117 (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; 118 int ret = 0; 119 120 ASSERT(pcstack == NULL || pcstack_limit > 0); | 119 volatile uint16_t *flags = 120 (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags; 121 int ret = 0; 122 123 ASSERT(pcstack == NULL || pcstack_limit > 0); |
124 ASSERT(dtrace_ustackdepth_max > 0); |
|
121 122#ifdef notyet /* XXX signal stack. */ 123 if (p->p_model == DATAMODEL_NATIVE) { 124 s1 = sizeof (struct frame) + 2 * sizeof (long); 125 s2 = s1 + sizeof (siginfo_t); 126 } else { 127 s1 = sizeof (struct frame32) + 3 * sizeof (int); 128 s2 = s1 + sizeof (siginfo32_t); 129 } 130#endif 131 132 while (pc != 0) { | 125 126#ifdef notyet /* XXX signal stack. */ 127 if (p->p_model == DATAMODEL_NATIVE) { 128 s1 = sizeof (struct frame) + 2 * sizeof (long); 129 s2 = s1 + sizeof (siginfo_t); 130 } else { 131 s1 = sizeof (struct frame32) + 3 * sizeof (int); 132 s2 = s1 + sizeof (siginfo32_t); 133 } 134#endif 135 136 while (pc != 0) { |
133 ret++; | 137 /* 138 * We limit the number of times we can go around this 139 * loop to account for a circular stack. 140 */ 141 if (ret++ >= dtrace_ustackdepth_max) { 142 *flags |= CPU_DTRACE_BADSTACK; 143 cpu_core[curcpu].cpuc_dtrace_illval = sp; 144 break; 145 } 146 |
134 if (pcstack != NULL) { 135 *pcstack++ = (uint64_t)pc; 136 pcstack_limit--; 137 if (pcstack_limit <= 0) 138 break; 139 } 140 141 if (sp == 0) 142 break; 143 | 147 if (pcstack != NULL) { 148 *pcstack++ = (uint64_t)pc; 149 pcstack_limit--; 150 if (pcstack_limit <= 0) 151 break; 152 } 153 154 if (sp == 0) 155 break; 156 |
157 oldsp = sp; 158 |
|
144#ifdef notyet /* XXX signal stack. */ 145 if (oldcontext == sp + s1 || oldcontext == sp + s2) { 146 if (p->p_model == DATAMODEL_NATIVE) { 147 ucontext_t *ucp = (ucontext_t *)oldcontext; 148 greg_t *gregs = ucp->uc_mcontext.gregs; 149 150 sp = dtrace_fulword(&gregs[REG_FP]); 151 pc = dtrace_fulword(&gregs[REG_PC]); --- 22 unchanged lines hidden (view full) --- 174 } 175 } 176#else 177 pc = dtrace_fuword32((void *)(sp + 178 offsetof(struct i386_frame, f_retaddr))); 179 sp = dtrace_fuword32((void *)sp); 180#endif /* ! notyet */ 181 | 159#ifdef notyet /* XXX signal stack. */ 160 if (oldcontext == sp + s1 || oldcontext == sp + s2) { 161 if (p->p_model == DATAMODEL_NATIVE) { 162 ucontext_t *ucp = (ucontext_t *)oldcontext; 163 greg_t *gregs = ucp->uc_mcontext.gregs; 164 165 sp = dtrace_fulword(&gregs[REG_FP]); 166 pc = dtrace_fulword(&gregs[REG_PC]); --- 22 unchanged lines hidden (view full) --- 189 } 190 } 191#else 192 pc = dtrace_fuword32((void *)(sp + 193 offsetof(struct i386_frame, f_retaddr))); 194 sp = dtrace_fuword32((void *)sp); 195#endif /* ! notyet */ 196 |
197 if (sp == oldsp) { 198 *flags |= CPU_DTRACE_BADSTACK; 199 cpu_core[curcpu].cpuc_dtrace_illval = sp; 200 break; 201 } 202 |
|
182 /* 183 * This is totally bogus: if we faulted, we're going to clear 184 * the fault and break. This is to deal with the apparently 185 * broken Java stacks on x86. 186 */ 187 if (*flags & CPU_DTRACE_FAULT) { 188 *flags &= ~CPU_DTRACE_FAULT; 189 break; --- 467 unchanged lines hidden --- | 203 /* 204 * This is totally bogus: if we faulted, we're going to clear 205 * the fault and break. This is to deal with the apparently 206 * broken Java stacks on x86. 207 */ 208 if (*flags & CPU_DTRACE_FAULT) { 209 *flags &= ~CPU_DTRACE_FAULT; 210 break; --- 467 unchanged lines hidden --- |