View | Details | Raw Unified | Return to bug 192516 | Differences between
and this patch

Collapse All | Expand All

(-)share/mk/sys.mk (-1 / +1 lines)
Lines 262-268 Link Here
262
	${CTFCONVERT_CMD}
262
	${CTFCONVERT_CMD}
263
263
264
.s.o:
264
.s.o:
265
	${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
265
	${AS} -mfpu=softvfp ${AFLAGS} -o ${.TARGET} ${.IMPSRC}
266
	${CTFCONVERT_CMD}
266
	${CTFCONVERT_CMD}
267
267
268
# XXX not -j safe
268
# XXX not -j safe
(-)cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h (+1 lines)
Lines 349-354 Link Here
349
/* ctf.c */
349
/* ctf.c */
350
caddr_t ctf_gen(iiburst_t *, size_t *, int);
350
caddr_t ctf_gen(iiburst_t *, size_t *, int);
351
tdata_t *ctf_load(char *, caddr_t, size_t, symit_data_t *, char *);
351
tdata_t *ctf_load(char *, caddr_t, size_t, symit_data_t *, char *);
352
int ctf_load_target_spec(char *);
352
353
353
/* iidesc.c */
354
/* iidesc.c */
354
iidesc_t *iidesc_new(char *);
355
iidesc_t *iidesc_new(char *);
(-)cddl/contrib/opensolaris/tools/ctf/cvt/ctf.c (-21 / +268 lines)
Lines 30-37 Link Here
30
#include <sys/types.h>
30
#include <sys/types.h>
31
#include <stdio.h>
31
#include <stdio.h>
32
#include <stdlib.h>
32
#include <stdlib.h>
33
#include <fcntl.h>
33
#include <strings.h>
34
#include <strings.h>
34
#include <ctype.h>
35
#include <ctype.h>
36
#include <unistd.h>
35
#include <zlib.h>
37
#include <zlib.h>
36
#include <elf.h>
38
#include <elf.h>
37
39
Lines 52-57 Link Here
52
#define	CTF_BUF_CHUNK_SIZE	(64 * 1024)
54
#define	CTF_BUF_CHUNK_SIZE	(64 * 1024)
53
#define	RES_BUF_CHUNK_SIZE	(64 * 1024)
55
#define	RES_BUF_CHUNK_SIZE	(64 * 1024)
54
56
57
#define	SPEC_BUF_SIZE		1024
58
#define	SPEC_MAX_FIELDS		16
59
55
struct ctf_buf {
60
struct ctf_buf {
56
	strtab_t ctb_strtab;	/* string table */
61
	strtab_t ctb_strtab;	/* string table */
57
	caddr_t ctb_base;	/* pointer to base of buffer */
62
	caddr_t ctb_base;	/* pointer to base of buffer */
Lines 73-79 Link Here
73
#define	SWAP_32(x)	(x) = BSWAP_32(x)
78
#define	SWAP_32(x)	(x) = BSWAP_32(x)
74
79
75
static int target_requires_swap;
80
static int target_requires_swap;
81
static int compactPresentation;
76
82
83
/*
84
 * In order to prevent frequent small-size allocation
85
 * we keep pre-allocated scratch-pad that should be used for 
86
 * converting host representation to target one
87
 */
88
struct ctf_struct_spec {
89
	size_t size;		/* structure size */
90
	size_t field_offset[SPEC_MAX_FIELDS];	/* Offsets for fields */
91
	char *scratchpad;	/* memory area of size bytes */
92
};
93
94
typedef enum {
95
	CTF_SPEC_STYPE = 0,
96
	CTF_SPEC_TYPE,
97
	CTF_SPEC_ARRAY,
98
	CTF_SPEC_MEMBER,
99
	CTF_SPEC_LMEMBER,
100
	CTF_SPEC_ENUM,
101
	CTF_SPEC_MAX,
102
} ctf_spec_type_t;
103
104
static const char* ctf_spec_type_name[] = 
105
{
106
	"ctf_stype_t",
107
	"ctf_type_t",
108
	"ctf_array_t",
109
	"ctf_member_t",
110
	"ctf_lmember_t",
111
	"ctf_enum_t"
112
};
113
114
static struct ctf_struct_spec target_specs[CTF_SPEC_MAX];
115
static uint_t ctf_spec_mask = 0;
116
77
/*PRINTFLIKE1*/
117
/*PRINTFLIKE1*/
78
static void
118
static void
79
parseterminate(const char *fmt, ...)
119
parseterminate(const char *fmt, ...)
Lines 142-147 Link Here
142
	}
182
	}
143
}
183
}
144
184
185
static void
186
ctf_scratchpad_reset(ctf_spec_type_t t)
187
{
188
189
	bzero(target_specs[t].scratchpad, target_specs[t].size);
190
}
191
192
static void
193
ctf_scratchpad_write(ctf_spec_type_t t, int field, void const *p, size_t n)
194
{
195
	size_t offset = target_specs[t].field_offset[field];
196
197
	if (offset + n > target_specs[t].size)
198
		terminate("Can't write outside scratchpad, type %s, field %d",
199
			ctf_spec_type_name[t]);
200
201
	bcopy(p, target_specs[t].scratchpad + offset, n);
202
}
203
204
static void
205
ctf_scratchpad_flush(ctf_buf_t *b, ctf_spec_type_t t)
206
{
207
208
	ctf_buf_write(b, target_specs[t].scratchpad, target_specs[t].size);
209
}
210
145
static int
211
static int
146
write_label(void *arg1, void *arg2)
212
write_label(void *arg1, void *arg2)
147
{
213
{
Lines 167-178 Link Here
167
{
233
{
168
	ushort_t id = (idp ? idp->ii_dtype->t_id : 0);
234
	ushort_t id = (idp ? idp->ii_dtype->t_id : 0);
169
235
170
	ctf_buf_write(b, &id, sizeof (id));
171
236
172
	if (target_requires_swap) {
237
	if (target_requires_swap) {
173
		SWAP_16(id);
238
		SWAP_16(id);
174
	}
239
	}
175
240
241
	ctf_buf_write(b, &id, sizeof (id));
242
176
	debug(3, "Wrote object %s (%d)\n", (idp ? idp->ii_name : "(null)"), id);
243
	debug(3, "Wrote object %s (%d)\n", (idp ? idp->ii_name : "(null)"), id);
177
}
244
}
178
245
Lines 227-232 Link Here
227
	debug(3, "Wrote function %s (%d args)\n", idp->ii_name, nargs);
294
	debug(3, "Wrote function %s (%d args)\n", idp->ii_name, nargs);
228
}
295
}
229
296
297
static void
298
write_unsized_type_rec(ctf_buf_t *b, ctf_type_t *ctt)
299
{
300
	ctf_stype_t *cts = (ctf_stype_t *)ctt;
301
302
	if (target_requires_swap) {
303
		SWAP_32(cts->ctt_name);
304
		SWAP_16(cts->ctt_info);
305
		SWAP_16(cts->ctt_size);
306
	}
307
308
	/* XXXCROSS 1 */
309
	if (compactPresentation) {
310
		ctf_scratchpad_reset(CTF_SPEC_STYPE);
311
		ctf_scratchpad_write(CTF_SPEC_STYPE, 0,
312
		    &cts->ctt_name, sizeof(cts->ctt_name));
313
		ctf_scratchpad_write(CTF_SPEC_STYPE, 1,
314
		    &cts->ctt_info, sizeof(cts->ctt_info));
315
		ctf_scratchpad_write(CTF_SPEC_STYPE, 2,
316
		    &cts->ctt_size, sizeof(cts->ctt_size));
317
		ctf_scratchpad_flush(b, CTF_SPEC_STYPE);
318
	} else 
319
		ctf_buf_write(b, cts, sizeof (*cts));
320
}
321
230
/*
322
/*
231
 * Depending on the size of the type being described, either a ctf_stype_t (for
323
 * Depending on the size of the type being described, either a ctf_stype_t (for
232
 * types with size < CTF_LSTRUCT_THRESH) or a ctf_type_t (all others) will be
324
 * types with size < CTF_LSTRUCT_THRESH) or a ctf_type_t (all others) will be
Lines 247-253 Link Here
247
			SWAP_32(ctt->ctt_lsizehi);
339
			SWAP_32(ctt->ctt_lsizehi);
248
			SWAP_32(ctt->ctt_lsizelo);
340
			SWAP_32(ctt->ctt_lsizelo);
249
		}
341
		}
250
		ctf_buf_write(b, ctt, sizeof (*ctt));
342
 		/* XXXCROSS 1 */
343
 		if (compactPresentation) {
344
 			ctf_scratchpad_reset(CTF_SPEC_TYPE);
345
 			ctf_scratchpad_write(CTF_SPEC_TYPE, 0,
346
 			    &ctt->ctt_name, sizeof(ctt->ctt_name));
347
 			ctf_scratchpad_write(CTF_SPEC_TYPE, 1,
348
 			    &ctt->ctt_info, sizeof(ctt->ctt_info));
349
 			ctf_scratchpad_write(CTF_SPEC_TYPE, 2,
350
 			    &ctt->ctt_size, sizeof(ctt->ctt_size));
351
 			ctf_scratchpad_write(CTF_SPEC_TYPE, 3,
352
 			    &ctt->ctt_lsizehi, sizeof(ctt->ctt_lsizehi));
353
 			ctf_scratchpad_write(CTF_SPEC_TYPE, 4,
354
 			    &ctt->ctt_lsizelo, sizeof(ctt->ctt_lsizelo));
355
 			ctf_scratchpad_flush(b, CTF_SPEC_TYPE);
356
 
357
 		} else 
358
			ctf_buf_write(b, ctt, sizeof (*ctt));
251
	} else {
359
	} else {
252
		ctf_stype_t *cts = (ctf_stype_t *)ctt;
360
		ctf_stype_t *cts = (ctf_stype_t *)ctt;
253
361
Lines 259-282 Link Here
259
			SWAP_16(cts->ctt_size);
367
			SWAP_16(cts->ctt_size);
260
		}
368
		}
261
369
262
		ctf_buf_write(b, cts, sizeof (*cts));
370
 		write_unsized_type_rec(b, ctt);
263
	}
371
	}
264
}
372
}
265
373
266
static void
267
write_unsized_type_rec(ctf_buf_t *b, ctf_type_t *ctt)
268
{
269
	ctf_stype_t *cts = (ctf_stype_t *)ctt;
270
271
	if (target_requires_swap) {
272
		SWAP_32(cts->ctt_name);
273
		SWAP_16(cts->ctt_info);
274
		SWAP_16(cts->ctt_size);
275
	}
276
277
	ctf_buf_write(b, cts, sizeof (*cts));
278
}
279
280
static int
374
static int
281
write_type(void *arg1, void *arg2)
375
write_type(void *arg1, void *arg2)
282
{
376
{
Lines 372-378 Link Here
372
			SWAP_16(cta.cta_index);
466
			SWAP_16(cta.cta_index);
373
			SWAP_32(cta.cta_nelems);
467
			SWAP_32(cta.cta_nelems);
374
		}
468
		}
375
		ctf_buf_write(b, &cta, sizeof (cta));
469
 		/* XXXCROSS 1 */
470
 		if (compactPresentation) {
471
			ctf_scratchpad_reset(CTF_SPEC_ARRAY);
472
 			ctf_scratchpad_write(CTF_SPEC_ARRAY, 0,
473
 			    &cta.cta_contents, sizeof(cta.cta_contents));
474
 			ctf_scratchpad_write(CTF_SPEC_ARRAY, 1,
475
 			    &cta.cta_index, sizeof(cta.cta_index));
476
 			ctf_scratchpad_write(CTF_SPEC_ARRAY, 2,
477
 			    &cta.cta_nelems, sizeof(cta.cta_nelems));
478
 			ctf_scratchpad_flush(b, CTF_SPEC_ARRAY);
479
 		}
480
 		else
481
 			ctf_buf_write(b, &cta, sizeof (cta));
482
376
		break;
483
		break;
377
484
378
	case STRUCT:
485
	case STRUCT:
Lines 406-412 Link Here
406
					SWAP_16(ctm.ctm_type);
513
					SWAP_16(ctm.ctm_type);
407
					SWAP_16(ctm.ctm_offset);
514
					SWAP_16(ctm.ctm_offset);
408
				}
515
				}
409
				ctf_buf_write(b, &ctm, sizeof (ctm));
516
517
 				/* XXXCROSS 1 */
518
 				if (compactPresentation) {
519
 					ctf_scratchpad_reset(CTF_SPEC_MEMBER);
520
 					ctf_scratchpad_write(CTF_SPEC_MEMBER, 0,
521
 					    &ctm.ctm_name, sizeof(ctm.ctm_name));
522
 					ctf_scratchpad_write(CTF_SPEC_MEMBER, 1,
523
 					    &ctm.ctm_type, sizeof(ctm.ctm_type));
524
					ctf_scratchpad_write(CTF_SPEC_MEMBER, 2,
525
 					    &ctm.ctm_offset, sizeof(ctm.ctm_offset));
526
 					ctf_scratchpad_flush(b, CTF_SPEC_MEMBER);
527
 				}
528
 				else
529
					ctf_buf_write(b, &ctm, sizeof (ctm));
410
			}
530
			}
411
		} else {
531
		} else {
412
			for (mp = tp->t_members; mp != NULL; mp = mp->ml_next) {
532
			for (mp = tp->t_members; mp != NULL; mp = mp->ml_next) {
Lines 428-434 Link Here
428
					SWAP_32(ctlm.ctlm_offsetlo);
548
					SWAP_32(ctlm.ctlm_offsetlo);
429
				}
549
				}
430
550
431
				ctf_buf_write(b, &ctlm, sizeof (ctlm));
551
 				/* XXXCROSS 1 */
552
 				if (compactPresentation) {
553
 					ctf_scratchpad_reset(CTF_SPEC_LMEMBER);
554
 					ctf_scratchpad_write(CTF_SPEC_LMEMBER, 0,
555
 					    &ctlm.ctlm_name, sizeof(ctlm.ctlm_name));
556
 					ctf_scratchpad_write(CTF_SPEC_LMEMBER, 1,
557
 					    &ctlm.ctlm_type, sizeof(ctlm.ctlm_type));
558
 					ctf_scratchpad_write(CTF_SPEC_LMEMBER, 2,
559
 					    &ctlm.ctlm_offsethi, sizeof(ctlm.ctlm_offsethi));
560
 					ctf_scratchpad_write(CTF_SPEC_LMEMBER, 3,
561
 					    &ctlm.ctlm_offsetlo, sizeof(ctlm.ctlm_offsetlo));
562
 					ctf_scratchpad_flush(b, CTF_SPEC_LMEMBER);
563
 				}
564
 				else
565
 					ctf_buf_write(b, &ctlm, sizeof (ctlm));
566
432
			}
567
			}
433
		}
568
		}
434
		break;
569
		break;
Lines 456-462 Link Here
456
				SWAP_32(cte.cte_value);
591
				SWAP_32(cte.cte_value);
457
			}
592
			}
458
593
459
			ctf_buf_write(b, &cte, sizeof (cte));
594
 			/* XXXCROSS 1 */
595
 			if (compactPresentation) {
596
 				ctf_scratchpad_reset(CTF_SPEC_ENUM);
597
 				ctf_scratchpad_write(CTF_SPEC_ENUM, 0,
598
 				    &cte.cte_name, sizeof(cte.cte_name));
599
 				ctf_scratchpad_write(CTF_SPEC_ENUM, 1,
600
 				    &cte.cte_value, sizeof(cte.cte_value));
601
 				ctf_scratchpad_flush(b, CTF_SPEC_ENUM);
602
 
603
 			}
604
 			else
605
 				ctf_buf_write(b, &cte, sizeof (cte));
460
			i--;
606
			i--;
461
		}
607
		}
462
		break;
608
		break;
Lines 1299-1304 Link Here
1299
	return (td);
1445
	return (td);
1300
}
1446
}
1301
1447
1448
static ctf_spec_type_t
1449
type_by_name(char *name)
1450
{
1451
	int i;
1452
1453
	for (i = 0; i < CTF_SPEC_MAX; i++) {
1454
		if (streq(ctf_spec_type_name[i], name))
1455
			break;
1456
	}
1457
1458
	return (i);
1459
}
1460
1461
static void
1462
parse_spec_line(char *line)
1463
{
1464
	char *ptr;
1465
	int got_type, got_size;
1466
	int field;
1467
	ctf_spec_type_t ctf_type = CTF_SPEC_MAX;
1468
1469
	field = got_type = got_size = 0;
1470
	for (ptr = strtok(line, ":"); ptr; ptr = strtok(NULL, ":"))
1471
        {
1472
		if (!got_type) {
1473
			ctf_type = type_by_name(ptr);
1474
			if (ctf_type == CTF_SPEC_MAX)
1475
				terminate("%s: unknown type in spec", ptr);
1476
			got_type = 1;
1477
		} else if (!got_size) {
1478
			target_specs[ctf_type].size = atoi(ptr);
1479
			got_size = 1;
1480
		} else
1481
			target_specs[ctf_type].field_offset[field++] = atoi(ptr);
1482
	}
1483
1484
	if (ctf_type == CTF_SPEC_MAX)
1485
		terminate("internal error\n");
1486
1487
	if (target_specs[ctf_type].size == 0)
1488
		terminate("%s: structure size is zero", ctf_spec_type_name[ctf_type]);
1489
1490
	target_specs[ctf_type].scratchpad = xcalloc(target_specs[ctf_type].size);
1491
1492
	debug(3, "Spec: Type %s, size: %d, fields: %d\n", ctf_spec_type_name[ctf_type],
1493
	    target_specs[ctf_type].size, field);
1494
1495
	return;
1496
}
1497
1498
int
1499
ctf_load_target_spec(char *file)
1500
{
1501
	int fd;
1502
	char *buf;
1503
	int bytes;
1504
	char *line;
1505
	int i, j;
1506
1507
	if ((buf = xcalloc(SPEC_BUF_SIZE)) == NULL)
1508
		terminate("%s: Cannot allocate buffer for reading spec", file);
1509
1510
	if ((line = xcalloc(SPEC_BUF_SIZE)) == NULL)
1511
		terminate("%s: Cannot allocate buffer for reading spec", file);
1512
1513
	if ((fd = open(file, O_RDONLY)) < 0)
1514
		terminate("%s: Cannot open for reading", file);
1515
1516
	j = 0;
1517
	while ((bytes = read(fd, buf, SPEC_BUF_SIZE)) > 0) {
1518
		for (i = 0; i < bytes; i++) {
1519
			if (buf[i] == '\n') {
1520
				/*
1521
				 * Parse line
1522
				 */
1523
				line[j++] = 0;
1524
				parse_spec_line(line);
1525
1526
				/*
1527
				 * Reset line
1528
				 */
1529
				j = 0;
1530
				bzero(line, SPEC_BUF_SIZE);
1531
				continue;
1532
			}
1533
				
1534
			if (!isspace(buf[i]))
1535
				line[j++] = buf[i];
1536
		}
1537
	}
1538
1539
	compactPresentation = 1;
1540
	ctf_spec_mask = 1;
1541
1542
	free(buf);
1543
	free(line);
1544
	close(fd);
1545
1546
	return (0);
1547
}
1548
1302
static size_t
1549
static size_t
1303
decompress_ctf(caddr_t cbuf, size_t cbufsz, caddr_t dbuf, size_t dbufsz)
1550
decompress_ctf(caddr_t cbuf, size_t cbufsz, caddr_t dbuf, size_t dbufsz)
1304
{
1551
{
(-)cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c (-1 / +12 lines)
Lines 754-759 Link Here
754
	char *uniqfile = NULL, *uniqlabel = NULL;
754
	char *uniqfile = NULL, *uniqlabel = NULL;
755
	char *withfile = NULL;
755
	char *withfile = NULL;
756
	char *label = NULL;
756
	char *label = NULL;
757
 	char *target_specfile = NULL;
757
	char **ifiles, **tifiles;
758
	char **ifiles, **tifiles;
758
	int verbose = 0, docopy = 0;
759
	int verbose = 0, docopy = 0;
759
	int write_fuzzy_match = 0;
760
	int write_fuzzy_match = 0;
Lines 768-774 Link Here
768
		debug_level = atoi(getenv("CTFMERGE_DEBUG_LEVEL"));
769
		debug_level = atoi(getenv("CTFMERGE_DEBUG_LEVEL"));
769
770
770
	err = 0;
771
	err = 0;
771
	while ((c = getopt(argc, argv, ":cd:D:fgl:L:o:tvw:s")) != EOF) {
772
 	while ((c = getopt(argc, argv, ":cd:D:fgl:L:o:tvw:sX:")) != EOF) {
772
		switch (c) {
773
		switch (c) {
773
		case 'c':
774
		case 'c':
774
			docopy = 1;
775
			docopy = 1;
Lines 816-821 Link Here
816
			/* use the dynsym rather than the symtab */
817
			/* use the dynsym rather than the symtab */
817
			dynsym = CTF_USE_DYNSYM;
818
			dynsym = CTF_USE_DYNSYM;
818
			break;
819
			break;
820
 		case 'X':
821
 			/* spec for types structure memory layout */
822
 			target_specfile = optarg;
823
 			break;
819
		default:
824
		default:
820
			usage();
825
			usage();
821
			exit(2);
826
			exit(2);
Lines 849-854 Link Here
849
		exit(2);
854
		exit(2);
850
	}
855
	}
851
856
857
 	/*
858
 	 * try loading spec file if provided
859
 	 */
860
	if (target_specfile)
861
 		ctf_load_target_spec(target_specfile);
862
 
852
	if (getenv("STRIPSTABS_KEEP_STABS") != NULL)
863
	if (getenv("STRIPSTABS_KEEP_STABS") != NULL)
853
		keep_stabs = CTF_KEEP_STABS;
864
		keep_stabs = CTF_KEEP_STABS;
854
865
(-)cddl/contrib/opensolaris/lib/libdtrace/arm/dt_isadep.c (+181 lines)
Line 0 Link Here
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
 *
9
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
 * or http://www.opensolaris.org/os/licensing.
11
 * See the License for the specific language governing permissions
12
 * and limitations under the License.
13
 *
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
/*
23
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24
 * Use is subject to license terms.
25
 */
26
27
#pragma ident	"%Z%%M%	%I%	%E% SMI"
28
29
#include <stdlib.h>
30
#include <assert.h>
31
#include <errno.h>
32
#include <string.h>
33
#include <libgen.h>
34
35
#include <dt_impl.h>
36
#include <dt_pid.h>
37
38
#define	OP(x)		((x) >> 30)
39
#define	OP2(x)		(((x) >> 22) & 0x07)
40
#define	COND(x)		(((x) >> 25) & 0x0f)
41
#define	A(x)		(((x) >> 29) & 0x01)
42
43
#define	OP_BRANCH	0
44
45
#define	OP2_BPcc	0x1
46
#define	OP2_Bicc	0x2
47
#define	OP2_BPr		0x3
48
#define	OP2_FBPfcc	0x5
49
#define	OP2_FBfcc	0x6
50
51
/*ARGSUSED*/
52
int
53
dt_pid_create_entry_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
54
    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp)
55
{
56
	ftp->ftps_type = DTFTP_ENTRY;
57
	ftp->ftps_pc = (uintptr_t)symp->st_value;
58
	ftp->ftps_size = (size_t)symp->st_size;
59
	ftp->ftps_noffs = 1;
60
	ftp->ftps_offs[0] = 0;
61
62
	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
63
		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
64
		    strerror(errno));
65
		return (dt_set_errno(dtp, errno));
66
	}
67
68
	return (1);
69
}
70
71
int
72
dt_pid_create_return_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
73
    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, uint64_t *stret)
74
{
75
76
	uint32_t *text;
77
	int i;
78
	int srdepth = 0;
79
80
	dt_dprintf("%s: unimplemented\n", __func__);
81
	return (DT_PROC_ERR);
82
83
	if ((text = malloc(symp->st_size + 4)) == NULL) {
84
		dt_dprintf("mr sparkle: malloc() failed\n");
85
		return (DT_PROC_ERR);
86
	}
87
88
	if (Pread(P, text, symp->st_size, symp->st_value) != symp->st_size) {
89
		dt_dprintf("mr sparkle: Pread() failed\n");
90
		free(text);
91
		return (DT_PROC_ERR);
92
	}
93
94
	/*
95
	 * Leave a dummy instruction in the last slot to simplify edge
96
	 * conditions.
97
	 */
98
	text[symp->st_size / 4] = 0;
99
100
	ftp->ftps_type = DTFTP_RETURN;
101
	ftp->ftps_pc = symp->st_value;
102
	ftp->ftps_size = symp->st_size;
103
	ftp->ftps_noffs = 0;
104
105
106
	free(text);
107
	if (ftp->ftps_noffs > 0) {
108
		if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
109
			dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
110
			    strerror(errno));
111
			return (dt_set_errno(dtp, errno));
112
		}
113
	}
114
115
116
	return (ftp->ftps_noffs);
117
}
118
119
/*ARGSUSED*/
120
int
121
dt_pid_create_offset_probe(struct ps_prochandle *P, dtrace_hdl_t *dtp,
122
    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, ulong_t off)
123
{
124
	if (off & 0x3)
125
		return (DT_PROC_ALIGN);
126
127
	ftp->ftps_type = DTFTP_OFFSETS;
128
	ftp->ftps_pc = (uintptr_t)symp->st_value;
129
	ftp->ftps_size = (size_t)symp->st_size;
130
	ftp->ftps_noffs = 1;
131
	ftp->ftps_offs[0] = off;
132
133
	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
134
		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
135
		    strerror(errno));
136
		return (dt_set_errno(dtp, errno));
137
	}
138
139
	return (1);
140
}
141
142
/*ARGSUSED*/
143
int
144
dt_pid_create_glob_offset_probes(struct ps_prochandle *P, dtrace_hdl_t *dtp,
145
    fasttrap_probe_spec_t *ftp, const GElf_Sym *symp, const char *pattern)
146
{
147
	ulong_t i;
148
149
	ftp->ftps_type = DTFTP_OFFSETS;
150
	ftp->ftps_pc = (uintptr_t)symp->st_value;
151
	ftp->ftps_size = (size_t)symp->st_size;
152
	ftp->ftps_noffs = 0;
153
154
	/*
155
	 * If we're matching against everything, just iterate through each
156
	 * instruction in the function, otherwise look for matching offset
157
	 * names by constructing the string and comparing it against the
158
	 * pattern.
159
	 */
160
	if (strcmp("*", pattern) == 0) {
161
		for (i = 0; i < symp->st_size; i += 4) {
162
			ftp->ftps_offs[ftp->ftps_noffs++] = i;
163
		}
164
	} else {
165
		char name[sizeof (i) * 2 + 1];
166
167
		for (i = 0; i < symp->st_size; i += 4) {
168
			(void) sprintf(name, "%lx", i);
169
			if (gmatch(name, pattern))
170
				ftp->ftps_offs[ftp->ftps_noffs++] = i;
171
		}
172
	}
173
174
	if (ioctl(dtp->dt_ftfd, FASTTRAPIOC_MAKEPROBE, ftp) != 0) {
175
		dt_dprintf("fasttrap probe creation ioctl failed: %s\n",
176
		    strerror(errno));
177
		return (dt_set_errno(dtp, errno));
178
	}
179
180
	return (ftp->ftps_noffs);
181
}
(-)cddl/usr.sbin/Makefile (+4 lines)
Lines 21-26 Link Here
21
_lockstat=	lockstat
21
_lockstat=	lockstat
22
.endif
22
.endif
23
23
24
.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "mips"
25
_dtrace=	dtrace
26
.endif
27
24
.if ${MACHINE_CPUARCH} == "mips"
28
.if ${MACHINE_CPUARCH} == "mips"
25
_dtrace=	dtrace
29
_dtrace=	dtrace
26
.endif
30
.endif
(-)cddl/lib/libdtrace/Makefile (+4 lines)
Lines 74-79 Link Here
74
CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
74
CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/mips
75
.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/mips
75
.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/mips
76
.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/mips
76
.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/mips
77
.elif ${MACHINE_CPUARCH} == "arm"
78
CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/arm
79
.PATH:		${.CURDIR}/../../../cddl/contrib/opensolaris/lib/libdtrace/arm
80
.PATH:		${.CURDIR}/../../../sys/cddl/dev/dtrace/arm
77
.else
81
.else
78
# temporary hack
82
# temporary hack
79
CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
83
CFLAGS+=	-I${OPENSOLARIS_SYS_DISTDIR}/uts/intel
(-)cddl/lib/Makefile (-1 / +1 lines)
Lines 19-25 Link Here
19
.endif
19
.endif
20
.endif
20
.endif
21
21
22
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" ||  ${MACHINE_CPUARCH} == "mips"
22
.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_CPUARCH} == "arm"  || ${MACHINE_ARCH} == "i386" ||  ${MACHINE_CPUARCH} == "mips"
23
_drti=		drti
23
_drti=		drti
24
_libdtrace=	libdtrace
24
_libdtrace=	libdtrace
25
.endif
25
.endif
(-)sys/cddl/contrib/opensolaris/uts/arm/dtrace/fasttrap_isa.c (+30 lines)
Line 0 Link Here
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 (the "License").
6
 * You may not use this file except in compliance with the License.
7
 *
8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9
 * or http://www.opensolaris.org/os/licensing.
10
 * See the License for the specific language governing permissions
11
 * and limitations under the License.
12
 *
13
 * When distributing Covered Code, include this CDDL HEADER in each
14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15
 * If applicable, add the following below this CDDL HEADER, with the
16
 * fields enclosed by brackets "[]" replaced with your own identifying
17
 * information: Portions Copyright [yyyy] [name of copyright owner]
18
 *
19
 * CDDL HEADER END
20
 */
21
22
/*
23
 * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
24
 * Use is subject to license terms.
25
 */
26
27
28
/*
29
 *	XXX: Placeholder for MISP fasttrap code
30
 */
(-)sys/cddl/contrib/opensolaris/uts/arm/sys/fasttrap_isa.h (+94 lines)
Line 0 Link Here
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
 *
9
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
 * or http://www.opensolaris.org/os/licensing.
11
 * See the License for the specific language governing permissions
12
 * and limitations under the License.
13
 *
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
/*
23
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24
 * Use is subject to license terms.
25
 */
26
27
#ifndef	_FASTTRAP_ISA_H
28
#define	_FASTTRAP_ISA_H
29
30
#pragma ident	"%Z%%M%	%I%	%E% SMI"
31
32
#include <sys/types.h>
33
34
#ifdef	__cplusplus
35
extern "C" {
36
#endif
37
38
/*
39
 * This is our reserved trap instruction: ta 0x38
40
 */
41
#define	FASTTRAP_INSTR			0x91d02038
42
43
#define	FASTTRAP_SUNWDTRACE_SIZE	128
44
45
typedef uint32_t	fasttrap_instr_t;
46
47
typedef struct fasttrap_machtp {
48
	fasttrap_instr_t	ftmt_instr;	/* original instruction */
49
	uintptr_t		ftmt_dest;	/* destination of DCTI */
50
	uint8_t			ftmt_type;	/* emulation type */
51
	uint8_t			ftmt_flags;	/* emulation flags */
52
	uint8_t			ftmt_cc;	/* which cc to look at */
53
	uint8_t			ftmt_code;	/* branch condition */
54
} fasttrap_machtp_t;
55
56
#define	ftt_instr	ftt_mtp.ftmt_instr
57
#define	ftt_dest	ftt_mtp.ftmt_dest
58
#define	ftt_type	ftt_mtp.ftmt_type
59
#define	ftt_flags	ftt_mtp.ftmt_flags
60
#define	ftt_cc		ftt_mtp.ftmt_cc
61
#define	ftt_code	ftt_mtp.ftmt_code
62
63
#define	FASTTRAP_T_COMMON	0x00	/* common case -- no emulation */
64
#define	FASTTRAP_T_CCR		0x01	/* integer condition code branch */
65
#define	FASTTRAP_T_FCC		0x02	/* floating-point branch */
66
#define	FASTTRAP_T_REG		0x03	/* register predicated branch */
67
#define	FASTTRAP_T_ALWAYS	0x04	/* branch always */
68
#define	FASTTRAP_T_CALL		0x05	/* call instruction */
69
#define	FASTTRAP_T_JMPL		0x06	/* jmpl instruction */
70
#define	FASTTRAP_T_RDPC		0x07	/* rdpc instruction */
71
#define	FASTTRAP_T_RETURN	0x08	/* return instruction */
72
73
/*
74
 * For performance rather than correctness.
75
 */
76
#define	FASTTRAP_T_SAVE		0x10	/* save instruction (func entry only) */
77
#define	FASTTRAP_T_RESTORE	0x11	/* restore instruction */
78
#define	FASTTRAP_T_OR		0x12	/* mov instruction */
79
#define	FASTTRAP_T_SETHI	0x13	/* sethi instruction (includes nop) */
80
81
#define	FASTTRAP_F_ANNUL	0x01	/* branch is annulled */
82
#define	FASTTRAP_F_RETMAYBE	0x02	/* not definitely a return site */
83
84
#define	FASTTRAP_AFRAMES		3
85
#define	FASTTRAP_RETURN_AFRAMES		4
86
#define	FASTTRAP_ENTRY_AFRAMES		3
87
#define	FASTTRAP_OFFSET_AFRAMES		3
88
89
90
#ifdef	__cplusplus
91
}
92
#endif
93
94
#endif	/* _FASTTRAP_ISA_H */
(-)sys/cddl/dev/lockstat/lockstat.c (-1 / +1 lines)
Lines 45-51 Link Here
45
#include <sys/dtrace.h>
45
#include <sys/dtrace.h>
46
#include <sys/lockstat.h>
46
#include <sys/lockstat.h>
47
47
48
#if defined(__i386__) || defined(__amd64__) || defined(__mips__)
48
#if defined(__amd64__) || defined(__arm__) || defined(__i386__) || defined(__mips__)
49
#define LOCKSTAT_AFRAMES 1
49
#define LOCKSTAT_AFRAMES 1
50
#else
50
#else
51
#error "architecture not supported"
51
#error "architecture not supported"
(-)sys/cddl/dev/profile/profile.c (+10 lines)
Lines 119-124 Link Here
119
#define	PROF_ARTIFICIAL_FRAMES	3
119
#define	PROF_ARTIFICIAL_FRAMES	3
120
#endif
120
#endif
121
121
122
#ifdef __mips
123
/* bogus */
124
#define	PROF_ARTIFICIAL_FRAMES	3
125
#endif
126
127
#ifdef __arm__
128
/* bogus */
129
#define	PROF_ARTIFICIAL_FRAMES	3
130
#endif
131
122
typedef struct profile_probe {
132
typedef struct profile_probe {
123
	char		prof_name[PROF_NAMELEN];
133
	char		prof_name[PROF_NAMELEN];
124
	dtrace_id_t	prof_id;
134
	dtrace_id_t	prof_id;
(-)sys/cddl/dev/dtrace/arm/dtrace_isa.c (+325 lines)
Line 0 Link Here
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
 *
9
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
 * or http://www.opensolaris.org/os/licensing.
11
 * See the License for the specific language governing permissions
12
 * and limitations under the License.
13
 *
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$
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>
31
#include <sys/systm.h>
32
#include <sys/kernel.h>
33
#include <sys/stack.h>
34
#include <sys/pcpu.h>
35
36
#include <machine/frame.h>
37
#include <machine/md_var.h>
38
#include <machine/reg.h>
39
40
#include <vm/vm.h>
41
#include <vm/vm_param.h>
42
#include <vm/pmap.h>
43
44
#include <machine/db_machdep.h>
45
#include <machine/md_var.h>
46
#include <machine/vmparam.h>
47
#include <machine/stack.h>
48
#include <ddb/db_sym.h>
49
#include <ddb/ddb.h>
50
#include <sys/kdb.h>
51
52
#include "regset.h"
53
54
/*
55
 * Wee need some reasonable default to prevent backtrace code
56
 * from wandering too far
57
 */
58
#define	MAX_FUNCTION_SIZE 0x10000
59
#define	MAX_PROLOGUE_SIZE 0x100
60
61
62
uint8_t dtrace_fuword8_nocheck(void *);
63
uint16_t dtrace_fuword16_nocheck(void *);
64
uint32_t dtrace_fuword32_nocheck(void *);
65
uint64_t dtrace_fuword64_nocheck(void *);
66
67
void
68
dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, int aframes,
69
    uint32_t *intrpc)
70
{
71
	u_int32_t	*frame, *lastframe;
72
	int	scp_offset;
73
	int	depth = 0;
74
	pc_t caller = (pc_t) solaris_cpu[curcpu].cpu_dtrace_caller;
75
76
	if (intrpc != 0)
77
		pcstack[depth++] = (pc_t) intrpc;
78
79
	aframes++;
80
81
	frame = (u_int32_t *)__builtin_frame_address(0);;
82
	lastframe = NULL;
83
	scp_offset = -(get_pc_str_offset() >> 2);
84
85
	while ((frame != NULL) && (depth < pcstack_limit)) {
86
		db_addr_t	scp;
87
#if 0 
88
		u_int32_t	savecode;
89
		int		r;
90
		u_int32_t	*rp;
91
#endif
92
93
		/*
94
		 * In theory, the SCP isn't guaranteed to be in the function
95
		 * that generated the stack frame.  We hope for the best.
96
		 */
97
		scp = frame[FR_SCP];
98
		printf("--> %08x\n", (uint32_t)scp);
99
100
		if (aframes > 0) {
101
			aframes--;
102
			if ((aframes == 0) && (caller != 0)) {
103
				pcstack[depth++] = caller;
104
			}
105
		}
106
		else {
107
			printf("++ --> %08x\n", (uint32_t)scp);
108
			pcstack[depth++] = scp;
109
		}
110
111
#if 0
112
		savecode = ((u_int32_t *)scp)[scp_offset];
113
		if ((savecode & 0x0e100000) == 0x08000000) {
114
			/* Looks like an STM */
115
			rp = frame - 4;
116
			for (r = 10; r >= 0; r--) {
117
				if (savecode & (1 << r)) {
118
					/* register r == *rp-- */
119
				}
120
			}
121
		}
122
#endif
123
124
		/*
125
		 * Switch to next frame up
126
		 */
127
		if (frame[FR_RFP] == 0)
128
			break; /* Top of stack */
129
130
		lastframe = frame;
131
		frame = (u_int32_t *)(frame[FR_RFP]);
132
133
		if (INKERNEL((int)frame)) {
134
			/* staying in kernel */
135
			if (frame <= lastframe) {
136
				/* bad frame pointer */
137
				break;
138
			}
139
		}
140
		else
141
			break;
142
	}
143
144
	for (; depth < pcstack_limit; depth++) {
145
		pcstack[depth] = 0;
146
	}
147
}
148
149
void
150
dtrace_getupcstack(uint64_t *pcstack, int pcstack_limit)
151
{
152
	printf("unimplemented\n");
153
}
154
155
int
156
dtrace_getustackdepth(void)
157
{
158
	printf("unimplemented\n");
159
	return (0);
160
}
161
162
void
163
dtrace_getufpstack(uint64_t *pcstack, uint64_t *fpstack, int pcstack_limit)
164
{
165
	printf("IMPLEMENT ME: %s\n", __func__);
166
}
167
168
/*ARGSUSED*/
169
uint64_t
170
dtrace_getarg(int arg, int aframes)
171
{
172
	printf("unimplemented\n");
173
174
	return (0);
175
}
176
177
int
178
dtrace_getstackdepth(int aframes)
179
{
180
	u_int32_t	*frame, *lastframe;
181
	int	scp_offset;
182
	int	depth = 1;
183
184
	frame = (u_int32_t *)__builtin_frame_address(0);;
185
	lastframe = NULL;
186
	scp_offset = -(get_pc_str_offset() >> 2);
187
188
	while (frame != NULL) {
189
		db_addr_t	scp;
190
#if 0 
191
		u_int32_t	savecode;
192
		int		r;
193
		u_int32_t	*rp;
194
#endif
195
196
		/*
197
		 * In theory, the SCP isn't guaranteed to be in the function
198
		 * that generated the stack frame.  We hope for the best.
199
		 */
200
		scp = frame[FR_SCP];
201
202
		depth++;
203
204
		/*
205
		 * Switch to next frame up
206
		 */
207
		if (frame[FR_RFP] == 0)
208
			break; /* Top of stack */
209
210
		lastframe = frame;
211
		frame = (u_int32_t *)(frame[FR_RFP]);
212
213
		if (INKERNEL((int)frame)) {
214
			/* staying in kernel */
215
			if (frame <= lastframe) {
216
				/* bad frame pointer */
217
				break;
218
			}
219
		}
220
		else
221
			break;
222
	}
223
224
	if (depth < aframes)
225
		return 0;
226
	else
227
		return depth - aframes;
228
229
}
230
231
ulong_t
232
dtrace_getreg(struct trapframe *rp, uint_t reg)
233
{
234
235
	return (0);
236
}
237
238
static int
239
dtrace_copycheck(uintptr_t uaddr, uintptr_t kaddr, size_t size)
240
{
241
242
	if (uaddr + size > VM_MAXUSER_ADDRESS || uaddr + size < uaddr) {
243
		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
244
		cpu_core[curcpu].cpuc_dtrace_illval = uaddr;
245
		return (0);
246
	}
247
248
	return (1);
249
}
250
251
void
252
dtrace_copyin(uintptr_t uaddr, uintptr_t kaddr, size_t size,
253
    volatile uint16_t *flags)
254
{
255
	if (dtrace_copycheck(uaddr, kaddr, size))
256
		dtrace_copy(uaddr, kaddr, size);
257
}
258
259
void
260
dtrace_copyout(uintptr_t kaddr, uintptr_t uaddr, size_t size,
261
    volatile uint16_t *flags)
262
{
263
	if (dtrace_copycheck(uaddr, kaddr, size))
264
		dtrace_copy(kaddr, uaddr, size);
265
}
266
267
void
268
dtrace_copyinstr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
269
    volatile uint16_t *flags)
270
{
271
	if (dtrace_copycheck(uaddr, kaddr, size))
272
		dtrace_copystr(uaddr, kaddr, size, flags);
273
}
274
275
void
276
dtrace_copyoutstr(uintptr_t kaddr, uintptr_t uaddr, size_t size,
277
    volatile uint16_t *flags)
278
{
279
	if (dtrace_copycheck(uaddr, kaddr, size))
280
		dtrace_copystr(kaddr, uaddr, size, flags);
281
}
282
283
uint8_t
284
dtrace_fuword8(void *uaddr)
285
{
286
	if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) {
287
		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
288
		cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr;
289
		return (0);
290
	}
291
	return (dtrace_fuword8_nocheck(uaddr));
292
}
293
294
uint16_t
295
dtrace_fuword16(void *uaddr)
296
{
297
	if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) {
298
		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
299
		cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr;
300
		return (0);
301
	}
302
	return (dtrace_fuword16_nocheck(uaddr));
303
}
304
305
uint32_t
306
dtrace_fuword32(void *uaddr)
307
{
308
	if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) {
309
		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
310
		cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr;
311
		return (0);
312
	}
313
	return (dtrace_fuword32_nocheck(uaddr));
314
}
315
316
uint64_t
317
dtrace_fuword64(void *uaddr)
318
{
319
	if ((uintptr_t)uaddr > VM_MAXUSER_ADDRESS) {
320
		DTRACE_CPUFLAG_SET(CPU_DTRACE_BADADDR);
321
		cpu_core[curcpu].cpuc_dtrace_illval = (uintptr_t)uaddr;
322
		return (0);
323
	}
324
	return (dtrace_fuword64_nocheck(uaddr));
325
}
(-)sys/cddl/dev/dtrace/arm/regset.h (+62 lines)
Line 0 Link Here
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
 *
9
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
 * or http://www.opensolaris.org/os/licensing.
11
 * See the License for the specific language governing permissions
12
 * and limitations under the License.
13
 *
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$ 
23
 */
24
/*
25
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
26
 * Use is subject to license terms.
27
 */
28
29
/*	Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
30
31
/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T		*/
32
/*	All Rights Reserved	*/
33
34
#ifndef	_REGSET_H
35
#define	_REGSET_H
36
37
/*
38
 * #pragma ident	"@(#)regset.h	1.11	05/06/08 SMI"
39
 */
40
41
#ifdef __cplusplus
42
extern "C" {
43
#endif
44
45
/*
46
 * XXX: define registers properly 
47
 */
48
49
#if 0
50
#define REG_PC  PC
51
#define REG_FP  EBP
52
#define REG_SP  SP
53
#define REG_PS  EFL
54
#define REG_R0  EAX
55
#define REG_R1  EDX
56
#endif
57
58
#ifdef	__cplusplus
59
}
60
#endif
61
62
#endif	/* _REGSET_H */
(-)sys/cddl/dev/dtrace/arm/dtrace_asm.S (+222 lines)
Line 0 Link Here
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
 *
9
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
 * or http://www.opensolaris.org/os/licensing.
11
 * See the License for the specific language governing permissions
12
 * and limitations under the License.
13
 *
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$
23
 */
24
/*
25
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
26
 * Use is subject to license terms.
27
 */
28
29
#define _ASM
30
#define _LOCORE
31
#define LOCORE
32
33
#include <sys/cpuvar_defs.h>
34
#include <sys/dtrace.h>
35
36
#include <machine/asm.h>
37
38
#include "assym.s"
39
40
/*
41
void dtrace_membar_producer(void)
42
*/
43
ENTRY(dtrace_membar_producer)
44
	RET
45
46
/*
47
void dtrace_membar_consumer(void)
48
*/
49
ENTRY(dtrace_membar_consumer)
50
	RET
51
52
/*
53
dtrace_icookie_t dtrace_interrupt_disable(void)
54
*/
55
ENTRY(dtrace_interrupt_disable)
56
	mrs	r0, cpsr
57
	mov	r1, r0
58
	orr	r1, r1, #(I32_bit|F32_bit)
59
	msr	cpsr_c, r1
60
	RET
61
/*
62
void dtrace_interrupt_enable(dtrace_icookie_t cookie)
63
*/
64
ENTRY(dtrace_interrupt_enable)
65
	and	r0, r0, #(I32_bit|F32_bit)
66
	mrs	r1, cpsr
67
	bic	r1, r1, #(I32_bit|F32_bit)
68
	orr	r1, r1, r0
69
	msr	cpsr_c, r1
70
	RET
71
72
/*
73
uint32_t dtrace_cas32(uint32_t *target, uint32_t cmp, uint32_t new)
74
XXX: just disable interrupts for now, add proper implementation for
75
ARMv6/ARMv7 later
76
*/
77
ENTRY_NP(dtrace_casptr)
78
ENTRY(dtrace_cas32)
79
	stmfd	sp!, {r4, r5}
80
81
	mrs	r3, cpsr
82
	mov	r4, r3
83
	orr	r4, r4, #(I32_bit|F32_bit)
84
	msr	cpsr_c, r4
85
86
	ldr	r5, [r0]
87
	cmp	r5, r2
88
	movne	r0, #0
89
	bne	2f
90
91
	str	r2, [r0]
92
	mov	r0, #1
93
94
2:
95
	msr	cpsr_c, r3
96
	ldmfd	sp!, {r4, r5}
97
	RET
98
99
/*
100
uint8_t
101
dtrace_fuword8_nocheck(void *addr)
102
*/
103
ENTRY(dtrace_fuword8_nocheck)
104
	ldrb	r3, [r0]
105
	mov 	r0, r3
106
	RET
107
108
/*
109
uint16_t
110
dtrace_fuword16_nocheck(void *addr)
111
*/
112
ENTRY(dtrace_fuword16_nocheck)
113
	ldrh	r3, [r0]
114
	mov 	r0, r3
115
	RET
116
117
/*
118
uint32_t
119
dtrace_fuword32_nocheck(void *addr)
120
*/
121
ENTRY(dtrace_fuword32_nocheck)
122
	ldr	r3, [r0]
123
	mov 	r0, r3
124
	RET
125
126
/*
127
uint64_t
128
dtrace_fuword64_nocheck(void *addr)
129
XXX: add byteorder check
130
*/
131
ENTRY(dtrace_fuword64_nocheck)
132
	ldm	r0, {r2, r3}
133
134
	mov	r0, r2
135
	mov	r1, r3
136
#if 0
137
/* little endian */
138
	mov	r0, r2
139
	mov	r1, r3
140
/* big endian */
141
	mov	r0, r3
142
	mov	r1, r2
143
#endif
144
	RET
145
146
/*
147
void
148
dtrace_copy(uintptr_t uaddr, uintptr_t kaddr, size_t size)
149
*/
150
ENTRY(dtrace_copy)
151
	stmfd   sp!, {r4-r5}			/* stack is 8 byte aligned */
152
	teq     r2, #0x00000000
153
	mov     r5, #0x00000000
154
	beq     2f
155
156
1:	ldrb    r4, [r0], #0x0001
157
	add     r5, r5, #0x00000001
158
	strb    r4, [r1], #0x0001
159
	teqne   r5, r2
160
	bne     1b
161
162
2:	ldmfd   sp!, {r4-r5}			/* stack is 8 byte aligned */
163
	RET
164
165
166
/*
167
void
168
dtrace_copystr(uintptr_t uaddr, uintptr_t kaddr, size_t size,
169
    volatile uint16_t *flags)
170
XXX: Check for flags?
171
*/
172
ENTRY(dtrace_copystr)
173
	stmfd   sp!, {r4-r5}			/* stack is 8 byte aligned */
174
	teq     r2, #0x00000000
175
	mov     r5, #0x00000000
176
	beq     2f
177
178
1:	ldrb    r4, [r0], #0x0001
179
	add     r5, r5, #0x00000001
180
	teq     r4, #0x00000000
181
	strb    r4, [r1], #0x0001
182
	teqne   r5, r2
183
	bne     1b
184
185
2:	ldmfd   sp!, {r4-r5}			/* stack is 8 byte aligned */
186
	RET
187
188
189
/*
190
void dtrace_invop_init(void)
191
*/
192
ENTRY(dtrace_invop_init)
193
	RET
194
195
/*
196
void dtrace_invop_uninit(void)
197
*/
198
ENTRY(dtrace_invop_uninit)
199
	RET
200
201
/*
202
void
203
vpanic(const char *format, va_list alist)
204
*/
205
ENTRY(vpanic)				/* Initial stack layout: */
206
vpanic_common:
207
	RET
208
209
/*
210
void
211
dtrace_vpanic(const char *format, va_list alist)
212
*/
213
ENTRY(dtrace_vpanic)			/* Initial stack layout: */
214
	RET
215
216
/*
217
uintptr_t
218
dtrace_caller(int aframes)
219
*/
220
ENTRY(dtrace_caller)
221
	mov	r0, #-1
222
	RET
(-)sys/cddl/dev/dtrace/arm/dtrace_subr.c (+187 lines)
Line 0 Link Here
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
 *
9
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10
 * or http://www.opensolaris.org/os/licensing.
11
 * See the License for the specific language governing permissions
12
 * and limitations under the License.
13
 *
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$
23
 *
24
 */
25
/*
26
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
27
 * Use is subject to license terms.
28
 */
29
30
#include <sys/cdefs.h>
31
__FBSDID("$FreeBSD$");
32
33
#include <sys/param.h>
34
#include <sys/systm.h>
35
#include <sys/types.h>
36
#include <sys/kernel.h>
37
#include <sys/malloc.h>
38
#include <sys/kmem.h>
39
#include <sys/smp.h>
40
#include <sys/dtrace_impl.h>
41
#include <sys/dtrace_bsd.h>
42
#include <machine/clock.h>
43
#include <machine/frame.h>
44
#include <machine/trap.h>
45
#include <vm/pmap.h>
46
47
#define	DELAYBRANCH(x)	((int)(x) < 0)
48
		
49
extern uintptr_t 	dtrace_in_probe_addr;
50
extern int		dtrace_in_probe;
51
extern dtrace_id_t	dtrace_probeid_error;
52
53
int dtrace_invop(uintptr_t, uintptr_t *, uintptr_t);
54
55
typedef struct dtrace_invop_hdlr {
56
	int (*dtih_func)(uintptr_t, uintptr_t *, uintptr_t);
57
	struct dtrace_invop_hdlr *dtih_next;
58
} dtrace_invop_hdlr_t;
59
60
dtrace_invop_hdlr_t *dtrace_invop_hdlr;
61
62
int
63
dtrace_invop(uintptr_t addr, uintptr_t *stack, uintptr_t eax)
64
{
65
	dtrace_invop_hdlr_t *hdlr;
66
	int rval;
67
68
	for (hdlr = dtrace_invop_hdlr; hdlr != NULL; hdlr = hdlr->dtih_next)
69
		if ((rval = hdlr->dtih_func(addr, stack, eax)) != 0)
70
			return (rval);
71
72
	return (0);
73
}
74
75
76
/*ARGSUSED*/
77
void
78
dtrace_toxic_ranges(void (*func)(uintptr_t base, uintptr_t limit))
79
{
80
	printf("IMPLEMENT ME: dtrace_toxic_ranges\n");
81
}
82
83
void
84
dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, void *arg)
85
{
86
	cpuset_t cpus;
87
88
	if (cpu == DTRACE_CPUALL)
89
		cpus = all_cpus;
90
	else
91
		CPU_SETOF(cpu, &cpus);
92
93
	smp_rendezvous_cpus(cpus, smp_no_rendevous_barrier, func,
94
	    smp_no_rendevous_barrier, arg);
95
}
96
97
static void
98
dtrace_sync_func(void)
99
{
100
}
101
102
void
103
dtrace_sync(void)
104
{
105
        dtrace_xcall(DTRACE_CPUALL, (dtrace_xcall_t)dtrace_sync_func, NULL);
106
}
107
108
/*
109
 * DTrace needs a high resolution time function which can
110
 * be called from a probe context and guaranteed not to have
111
 * instrumented with probes itself.
112
 *
113
 * Returns nanoseconds since boot.
114
 */
115
uint64_t
116
dtrace_gethrtime()
117
{
118
	struct      timespec curtime;
119
120
	nanouptime(&curtime);
121
122
	return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);
123
124
}
125
126
uint64_t
127
dtrace_gethrestime(void)
128
{
129
	struct      timespec curtime;
130
131
	getnanotime(&curtime);
132
133
	return (curtime.tv_sec * 1000000000UL + curtime.tv_nsec);
134
}
135
136
/* Function to handle DTrace traps during probes. See amd64/amd64/trap.c */
137
int
138
dtrace_trap(struct trapframe *frame, u_int type)
139
{
140
	/*
141
	 * A trap can occur while DTrace executes a probe. Before
142
	 * executing the probe, DTrace blocks re-scheduling and sets
143
	 * a flag in it's per-cpu flags to indicate that it doesn't
144
	 * want to fault. On returning from the probe, the no-fault
145
	 * flag is cleared and finally re-scheduling is enabled.
146
	 *
147
	 * Check if DTrace has enabled 'no-fault' mode:
148
	 *
149
	 */
150
	if ((cpu_core[curcpu].cpuc_dtrace_flags & CPU_DTRACE_NOFAULT) != 0) {
151
		/*
152
		 * There are only a couple of trap types that are expected.
153
		 * All the rest will be handled in the usual way.
154
		 */
155
		switch (type) {
156
		/* Page fault. */
157
		case 0:
158
			/* Flag a bad address. */
159
			cpu_core[curcpu].cpuc_dtrace_flags |= CPU_DTRACE_BADADDR;
160
			cpu_core[curcpu].cpuc_dtrace_illval = 0;
161
162
			/*
163
			 * Offset the instruction pointer to the instruction
164
			 * following the one causing the fault.
165
			 */
166
			panic("%s", __func__);
167
			// frame->pc += sizeof(int);
168
			return (1);
169
		default:
170
			/* Handle all other traps in the usual way. */
171
			break;
172
		}
173
	}
174
175
	/* Handle the trap in the usual way. */
176
	return (0);
177
}
178
179
void
180
dtrace_probe_error(dtrace_state_t *state, dtrace_epid_t epid, int which,
181
    int fault, int fltoffs, uintptr_t illval)
182
{
183
184
	dtrace_probe(dtrace_probeid_error, (uint64_t)(uintptr_t)state,
185
	    (uintptr_t)epid,
186
	    (uintptr_t)which, (uintptr_t)fault, (uintptr_t)fltoffs);
187
}
(-)sys/sys/elf_common.h (+1 lines)
Lines 296-301 Link Here
296
#define	SHT_HIOS		0x6fffffff	/* Last of OS specific semantics */
296
#define	SHT_HIOS		0x6fffffff	/* Last of OS specific semantics */
297
#define	SHT_LOPROC		0x70000000	/* reserved range for processor */
297
#define	SHT_LOPROC		0x70000000	/* reserved range for processor */
298
#define	SHT_AMD64_UNWIND	0x70000001	/* unwind information */
298
#define	SHT_AMD64_UNWIND	0x70000001	/* unwind information */
299
#define SHT_ARM_ATTRIBUTES	0x70000003	/* Section holds attributes.  */
299
#define	SHT_MIPS_REGINFO	0x70000006
300
#define	SHT_MIPS_REGINFO	0x70000006
300
#define	SHT_MIPS_OPTIONS	0x7000000d
301
#define	SHT_MIPS_OPTIONS	0x7000000d
301
#define	SHT_MIPS_DWARF		0x7000001e	/* MIPS gcc uses MIPS_DWARF */
302
#define	SHT_MIPS_DWARF		0x7000001e	/* MIPS gcc uses MIPS_DWARF */
(-)sys/arm/arm/machdep.c (-2 / +2 lines)
Lines 756-763 Link Here
756
	strcpy((char*)&fake_preload[i++], "kernel");
756
	strcpy((char*)&fake_preload[i++], "kernel");
757
	i += 1;
757
	i += 1;
758
	fake_preload[i++] = MODINFO_TYPE;
758
	fake_preload[i++] = MODINFO_TYPE;
759
	fake_preload[i++] = strlen("elf kernel") + 1;
759
	fake_preload[i++] = strlen("/boot/kernel/kernel") + 1;
760
	strcpy((char*)&fake_preload[i++], "elf kernel");
760
	strcpy((char*)&fake_preload[i++], "/boot/kernel/kernel");
761
	i += 2;
761
	i += 2;
762
	fake_preload[i++] = MODINFO_ADDR;
762
	fake_preload[i++] = MODINFO_ADDR;
763
	fake_preload[i++] = sizeof(vm_offset_t);
763
	fake_preload[i++] = sizeof(vm_offset_t);
(-)sys/arm/arm/trap.c (+27 lines)
Lines 80-85 Link Here
80
80
81
81
82
#include "opt_ktrace.h"
82
#include "opt_ktrace.h"
83
#include "opt_kdtrace.h"
83
84
84
#include <sys/cdefs.h>
85
#include <sys/cdefs.h>
85
__FBSDID("$FreeBSD$");
86
__FBSDID("$FreeBSD$");
Lines 122-128 Link Here
122
#include <sys/kdb.h>
123
#include <sys/kdb.h>
123
#endif
124
#endif
124
125
126
#ifdef KDTRACE_HOOKS
127
#include <sys/dtrace_bsd.h>
125
128
129
/*
130
 * This is a hook which is initialised by the dtrace module
131
 * to handle traps which might occur during DTrace probe
132
 * execution.
133
 */
134
dtrace_trap_func_t	dtrace_trap_func;
135
136
dtrace_doubletrap_func_t	dtrace_doubletrap_func;
137
138
/*
139
 * This is a hook which is initialised by the systrace module
140
 * when it is loaded. This keeps the DTrace syscall provider
141
 * implementation opaque. 
142
 */
143
systrace_probe_func_t	systrace_probe_func;
144
145
/*
146
 * These hooks are necessary for the pid, usdt and fasttrap providers.
147
 */
148
dtrace_fasttrap_probe_ptr_t	dtrace_fasttrap_probe_ptr;
149
dtrace_pid_probe_ptr_t		dtrace_pid_probe_ptr;
150
dtrace_return_probe_ptr_t	dtrace_return_probe_ptr;
151
#endif
152
126
void swi_handler(trapframe_t *);
153
void swi_handler(trapframe_t *);
127
void undefinedinstruction(trapframe_t *);
154
void undefinedinstruction(trapframe_t *);
128
155
(-)sys/arm/arm/identcpu.c (-1 / +1 lines)
Lines 457-463 Link Here
457
	u_int8_t type, linesize;
457
	u_int8_t type, linesize;
458
	int i;
458
	int i;
459
459
460
	cpuid = cpu_id();
460
	cpuid = cpu_ident();
461
461
462
	if (cpuid == 0) {
462
	if (cpuid == 0) {
463
		printf("Processor failed probe - no CPU ID\n");
463
		printf("Processor failed probe - no CPU ID\n");
(-)sys/arm/include/cpufunc.h (-1 / +1 lines)
Lines 167-173 Link Here
167
extern struct cpu_functions cpufuncs;
167
extern struct cpu_functions cpufuncs;
168
extern u_int cputype;
168
extern u_int cputype;
169
169
170
#define cpu_id()		cpufuncs.cf_id()
170
#define cpu_ident()		cpufuncs.cf_id()
171
#define	cpu_cpwait()		cpufuncs.cf_cpwait()
171
#define	cpu_cpwait()		cpufuncs.cf_cpwait()
172
172
173
#define cpu_control(c, e)	cpufuncs.cf_control(c, e)
173
#define cpu_control(c, e)	cpufuncs.cf_control(c, e)
(-)sys/arm/conf/PANDABOARD (-2 / +7 lines)
Lines 31-38 Link Here
31
include     "../ti/omap4/pandaboard/std.pandaboard"
31
include     "../ti/omap4/pandaboard/std.pandaboard"
32
32
33
#To statically compile in device wiring instead of /boot/device.hints
33
#To statically compile in device wiring instead of /boot/device.hints
34
makeoptions	MODULES_OVERRIDE=""
35
makeoptions WITHOUT_MODULES="ahc"
34
makeoptions WITHOUT_MODULES="ahc"
35
options KDTRACE_HOOKS        # all architectures - enable general DTrace hooks
36
options DDB_CTF              # all architectures - kernel ELF linker loads CTF data
37
makeoptions DEBUG="-g"
38
makeoptions WITH_CTF=1
39
makeoptions     MODULES_OVERRIDE="opensolaris dtrace cyclic dtrace/dtnfsclient dtrace/dtnfscl dtrace/lockstat dtrace/profile"
40
# makeoptions     MODULES_OVERRIDE=""
36
41
37
makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
42
makeoptions	DEBUG=-g		#Build kernel with gdb(1) debug symbols
38
options 	HZ=100
43
options 	HZ=100
Lines 46-52 Link Here
46
options 	UFS_DIRHASH		#Improve performance on big directories
51
options 	UFS_DIRHASH		#Improve performance on big directories
47
options 	NFSCLIENT		#Network Filesystem Client
52
options 	NFSCLIENT		#Network Filesystem Client
48
device		snp
53
device		snp
49
#options		NFSCL
54
options		NFSCL
50
#options 	NFSSERVER		#Network Filesystem Server
55
#options 	NFSSERVER		#Network Filesystem Server
51
options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
56
options 	NFS_ROOT		#NFS usable as /, requires NFSCLIENT
52
options		BREAK_TO_DEBUGGER
57
options		BREAK_TO_DEBUGGER
(-)sys/conf/kern.post.mk (-1 / +1 lines)
Lines 126-132 Link Here
126
	@echo linking ${.TARGET}
126
	@echo linking ${.TARGET}
127
	${SYSTEM_LD}
127
	${SYSTEM_LD}
128
.if ${MK_CTF} != "no"
128
.if ${MK_CTF} != "no"
129
	${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
129
	${CTFMERGE} -X $S/conf/ctfspec.arm ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJS} vers.o
130
.endif
130
.endif
131
.if !defined(DEBUG)
131
.if !defined(DEBUG)
132
	${OBJCOPY} --strip-debug ${.TARGET}
132
	${OBJCOPY} --strip-debug ${.TARGET}
(-)sys/conf/ctfspec.arm (+6 lines)
Line 0 Link Here
1
ctf_stype_t:12:0:4:8
2
ctf_type_t:20:0:4:8:12:16
3
ctf_array_t:8:0:2:4
4
ctf_member_t:8:0:4:6
5
ctf_lmember_t:16:0:4:8:12
6
ctf_enum_t:8:0:4
(-)lib/Makefile (-2 / +5 lines)
Lines 188-203 Link Here
188
_libypclnt=	libypclnt
188
_libypclnt=	libypclnt
189
.endif
189
.endif
190
190
191
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
191
.if ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "mips"
192
.if ${MK_NCP} != "no"
192
.if ${MK_NCP} != "no"
193
_libncp=	libncp
193
_libncp=	libncp
194
.endif
194
.endif
195
_libsmb=	libsmb
195
_libsmb=	libsmb
196
_libvgl=	libvgl
197
_libproc=	libproc
196
_libproc=	libproc
198
_librtld_db=	librtld_db
197
_librtld_db=	librtld_db
199
.endif
198
.endif
200
199
200
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "mips"
201
_libvgl=	libvgl
202
.endif
203
201
.if ${MACHINE_CPUARCH} == "ia64"
204
.if ${MACHINE_CPUARCH} == "ia64"
202
_libefi=	libefi
205
_libefi=	libefi
203
_libsmb=	libsmb
206
_libsmb=	libsmb
(-)lib/libproc/proc_regs.c (+8 lines)
Lines 56-61 Link Here
56
	case REG_PC:
56
	case REG_PC:
57
#if defined(__amd64__)
57
#if defined(__amd64__)
58
		*regvalue = regs.r_rip;
58
		*regvalue = regs.r_rip;
59
#elif defined(__arm__)
60
		*regvalue = regs.r_pc;
59
#elif defined(__i386__)
61
#elif defined(__i386__)
60
		*regvalue = regs.r_eip;
62
		*regvalue = regs.r_eip;
61
#elif defined(__mips__)
63
#elif defined(__mips__)
Lines 65-70 Link Here
65
	case REG_SP:
67
	case REG_SP:
66
#if defined(__amd64__)
68
#if defined(__amd64__)
67
		*regvalue = regs.r_rsp;
69
		*regvalue = regs.r_rsp;
70
#elif defined(__arm__)
71
		*regvalue = regs.r_sp;
68
#elif defined(__i386__)
72
#elif defined(__i386__)
69
		*regvalue = regs.r_esp;
73
		*regvalue = regs.r_esp;
70
#elif defined(__mips__)
74
#elif defined(__mips__)
Lines 95-100 Link Here
95
	case REG_PC:
99
	case REG_PC:
96
#if defined(__amd64__)
100
#if defined(__amd64__)
97
		regs.r_rip = regvalue;
101
		regs.r_rip = regvalue;
102
#elif defined(__arm__)
103
		regs.r_pc = regvalue;
98
#elif defined(__i386__)
104
#elif defined(__i386__)
99
		regs.r_eip = regvalue;
105
		regs.r_eip = regvalue;
100
#elif defined(__mips__)
106
#elif defined(__mips__)
Lines 104-109 Link Here
104
	case REG_SP:
110
	case REG_SP:
105
#if defined(__amd64__)
111
#if defined(__amd64__)
106
		regs.r_rsp = regvalue;
112
		regs.r_rsp = regvalue;
113
#elif defined(__arm__)
114
		regs.r_sp = regvalue;
107
#elif defined(__i386__)
115
#elif defined(__i386__)
108
		regs.r_esp = regvalue;
116
		regs.r_esp = regvalue;
109
#elif defined(__mips__)
117
#elif defined(__mips__)
(-)lib/libproc/proc_bkpt.c (+3 lines)
Lines 47-52 Link Here
47
#elif defined(__mips__)
47
#elif defined(__mips__)
48
#define BREAKPOINT_INSTR	0xd	/* break */
48
#define BREAKPOINT_INSTR	0xd	/* break */
49
#define	BREAKPOINT_INSTR_SZ	4
49
#define	BREAKPOINT_INSTR_SZ	4
50
#elif defined(__arm__)
51
#define BREAKPOINT_INSTR	0xe7ffffff	/* bkpt */
52
#define	BREAKPOINT_INSTR_SZ	4
50
#else
53
#else
51
#error "Add support for your architecture"
54
#error "Add support for your architecture"
52
#endif
55
#endif
(-)lib/libelf/libelf_data.c (+2 lines)
Lines 84-89 Link Here
84
	case SHT_SUNW_dof:
84
	case SHT_SUNW_dof:
85
		return (ELF_T_BYTE);
85
		return (ELF_T_BYTE);
86
#endif
86
#endif
87
 	case SHT_ARM_ATTRIBUTES:
88
 		/* FALLTHROUGH */
87
	case SHT_MIPS_DWARF:
89
	case SHT_MIPS_DWARF:
88
		/* FALLTHROUGH */
90
		/* FALLTHROUGH */
89
	case SHT_MIPS_REGINFO:
91
	case SHT_MIPS_REGINFO:

Return to bug 192516