Deleted Added
full compact
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/amd64/dtrace_isa.c 269557 2014-08-05 01:53:15Z markj $
22 * $FreeBSD: stable/10/sys/cddl/dev/dtrace/amd64/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>

--- 13 unchanged lines hidden (view full) ---

44
45#include "regset.h"
46
47uint8_t dtrace_fuword8_nocheck(void *);
48uint16_t dtrace_fuword16_nocheck(void *);
49uint32_t dtrace_fuword32_nocheck(void *);
50uint64_t dtrace_fuword64_nocheck(void *);
51
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>

--- 13 unchanged lines hidden (view full) ---

44
45#include "regset.h"
46
47uint8_t dtrace_fuword8_nocheck(void *);
48uint16_t dtrace_fuword16_nocheck(void *);
49uint32_t dtrace_fuword32_nocheck(void *);
50uint64_t dtrace_fuword64_nocheck(void *);
51
52int dtrace_ustackdepth_max = 2048;
53
52void
53dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
54 uint32_t *intrpc)
55{
56 int depth = 0;
57 register_t rbp;
58 struct amd64_frame *frame;
59 vm_offset_t callpc;

--- 37 unchanged lines hidden (view full) ---

97 pcstack[depth] = 0;
98 }
99}
100
101static int
102dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc,
103 uintptr_t sp)
104{
54void
55dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
56 uint32_t *intrpc)
57{
58 int depth = 0;
59 register_t rbp;
60 struct amd64_frame *frame;
61 vm_offset_t callpc;

--- 37 unchanged lines hidden (view full) ---

99 pcstack[depth] = 0;
100 }
101}
102
103static int
104dtrace_getustack_common(uint64_t *pcstack, int pcstack_limit, uintptr_t pc,
105 uintptr_t sp)
106{
107 uintptr_t oldsp;
105 volatile uint16_t *flags =
106 (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags;
107 int ret = 0;
108
109 ASSERT(pcstack == NULL || pcstack_limit > 0);
108 volatile uint16_t *flags =
109 (volatile uint16_t *)&cpu_core[curcpu].cpuc_dtrace_flags;
110 int ret = 0;
111
112 ASSERT(pcstack == NULL || pcstack_limit > 0);
113 ASSERT(dtrace_ustackdepth_max > 0);
110
111 while (pc != 0) {
114
115 while (pc != 0) {
112 ret++;
116 /*
117 * We limit the number of times we can go around this
118 * loop to account for a circular stack.
119 */
120 if (ret++ >= dtrace_ustackdepth_max) {
121 *flags |= CPU_DTRACE_BADSTACK;
122 cpu_core[curcpu].cpuc_dtrace_illval = sp;
123 break;
124 }
125
113 if (pcstack != NULL) {
114 *pcstack++ = (uint64_t)pc;
115 pcstack_limit--;
116 if (pcstack_limit <= 0)
117 break;
118 }
119
120 if (sp == 0)
121 break;
122
126 if (pcstack != NULL) {
127 *pcstack++ = (uint64_t)pc;
128 pcstack_limit--;
129 if (pcstack_limit <= 0)
130 break;
131 }
132
133 if (sp == 0)
134 break;
135
136 oldsp = sp;
137
123 pc = dtrace_fuword64((void *)(sp +
124 offsetof(struct amd64_frame, f_retaddr)));
125 sp = dtrace_fuword64((void *)sp);
126
138 pc = dtrace_fuword64((void *)(sp +
139 offsetof(struct amd64_frame, f_retaddr)));
140 sp = dtrace_fuword64((void *)sp);
141
142 if (sp == oldsp) {
143 *flags |= CPU_DTRACE_BADSTACK;
144 cpu_core[curcpu].cpuc_dtrace_illval = sp;
145 break;
146 }
147
127 /*
128 * This is totally bogus: if we faulted, we're going to clear
129 * the fault and break. This is to deal with the apparently
130 * broken Java stacks on x86.
131 */
132 if (*flags & CPU_DTRACE_FAULT) {
133 *flags &= ~CPU_DTRACE_FAULT;
134 break;

--- 513 unchanged lines hidden ---
148 /*
149 * This is totally bogus: if we faulted, we're going to clear
150 * the fault and break. This is to deal with the apparently
151 * broken Java stacks on x86.
152 */
153 if (*flags & CPU_DTRACE_FAULT) {
154 *flags &= ~CPU_DTRACE_FAULT;
155 break;

--- 513 unchanged lines hidden ---