aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2016-07-20 00:02:10 +0000
committerMark Johnston <markj@FreeBSD.org>2016-07-20 00:02:10 +0000
commite86e17af79cbb6dc93e0c9762c4351f310dffa4e (patch)
treea0b5ddf4acfb83f2539d8c5a705e455817c68400 /sys
parentb4932d18ee55c8f9058d446997489d508afe0b4a (diff)
downloadsrc-e86e17af79cbb6dc93e0c9762c4351f310dffa4e.tar.gz
src-e86e17af79cbb6dc93e0c9762c4351f310dffa4e.zip
Merge {amd64,i386}/instr_size.c into x86_instr_size.c.
Also reduce the diff between us and upstream: the input data model will always be DATAMODEL_NATIVE because of a bug (p_model is never set but is always initialized to 0), so we don't need to override the caller anyway. This change is also necessary to support the pid provider for 32-bit processes on amd64. MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=303050
Diffstat (limited to 'sys')
-rw-r--r--sys/cddl/dev/dtrace/amd64/instr_size.c139
-rw-r--r--sys/cddl/dev/dtrace/x86/instr_size.c (renamed from sys/cddl/dev/dtrace/i386/instr_size.c)5
-rw-r--r--sys/conf/files.amd642
-rw-r--r--sys/conf/files.i3862
4 files changed, 5 insertions, 143 deletions
diff --git a/sys/cddl/dev/dtrace/amd64/instr_size.c b/sys/cddl/dev/dtrace/amd64/instr_size.c
deleted file mode 100644
index b3afcb744a58..000000000000
--- a/sys/cddl/dev/dtrace/amd64/instr_size.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- * $FreeBSD$
- */
-/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-#ifdef illumos
-#pragma ident "@(#)instr_size.c 1.14 05/07/08 SMI"
-#endif
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/proc.h>
-#ifdef illumos
-#include <sys/cmn_err.h>
-#include <sys/archsystm.h>
-#include <sys/copyops.h>
-#include <vm/seg_enum.h>
-#include <sys/privregs.h>
-#else
-typedef u_int model_t;
-#define DATAMODEL_NATIVE 0
-int dtrace_instr_size(uchar_t *);
-int dtrace_instr_size_isa(uchar_t *, model_t, int *);
-#endif
-
-#include <dis_tables.h>
-
-/*
- * This subsystem (with the minor exception of the instr_size() function) is
- * is called from DTrace probe context. This imposes several requirements on
- * the implementation:
- *
- * 1. External subsystems and functions may not be referenced. The one current
- * exception is for cmn_err, but only to signal the detection of table
- * errors. Assuming the tables are correct, no combination of input is to
- * trigger a cmn_err call.
- *
- * 2. These functions can't be allowed to be traced. To prevent this,
- * all functions in the probe path (everything except instr_size()) must
- * have names that begin with "dtrace_".
- */
-
-typedef enum dis_isize {
- DIS_ISIZE_INSTR,
- DIS_ISIZE_OPERAND
-} dis_isize_t;
-
-
-/*
- * get a byte from instruction stream
- */
-static int
-dtrace_dis_get_byte(void *p)
-{
- int ret;
- uchar_t **instr = p;
-
- ret = **instr;
- *instr += 1;
-
- return (ret);
-}
-
-/*
- * Returns either the size of a given instruction, in bytes, or the size of that
- * instruction's memory access (if any), depending on the value of `which'.
- * If a programming error in the tables is detected, the system will panic to
- * ease diagnosis. Invalid instructions will not be flagged. They will appear
- * to have an instruction size between 1 and the actual size, and will be
- * reported as having no memory impact.
- */
-/* ARGSUSED2 */
-static int
-dtrace_dis_isize(uchar_t *instr, dis_isize_t which, model_t model, int *rmindex)
-{
- int sz;
- dis86_t x;
- uint_t mode = SIZE64;
-
-#ifdef illumos
- mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32;
-#endif
-
- x.d86_data = (void **)&instr;
- x.d86_get_byte = dtrace_dis_get_byte;
- x.d86_check_func = NULL;
-
- if (dtrace_disx86(&x, mode) != 0)
- return (-1);
-
- if (which == DIS_ISIZE_INSTR)
- sz = x.d86_len; /* length of the instruction */
- else
- sz = x.d86_memsize; /* length of memory operand */
-
- if (rmindex != NULL)
- *rmindex = x.d86_rmindex;
- return (sz);
-}
-
-int
-dtrace_instr_size_isa(uchar_t *instr, model_t model, int *rmindex)
-{
- return (dtrace_dis_isize(instr, DIS_ISIZE_INSTR, model, rmindex));
-}
-
-int
-dtrace_instr_size(uchar_t *instr)
-{
- return (dtrace_dis_isize(instr, DIS_ISIZE_INSTR, DATAMODEL_NATIVE,
- NULL));
-}
diff --git a/sys/cddl/dev/dtrace/i386/instr_size.c b/sys/cddl/dev/dtrace/x86/instr_size.c
index 11fbf9b3434c..6eea987244b1 100644
--- a/sys/cddl/dev/dtrace/i386/instr_size.c
+++ b/sys/cddl/dev/dtrace/x86/instr_size.c
@@ -44,6 +44,9 @@
#include <vm/seg_enum.h>
#include <sys/privregs.h>
#else
+#include <sys/cred.h>
+#include <cddl/dev/dtrace/dtrace_cddl.h>
+
typedef u_int model_t;
#define DATAMODEL_NATIVE 0
int dtrace_instr_size(uchar_t *);
@@ -104,9 +107,7 @@ dtrace_dis_isize(uchar_t *instr, dis_isize_t which, model_t model, int *rmindex)
dis86_t x;
uint_t mode = SIZE32;
-#ifdef illumos
mode = (model == DATAMODEL_LP64) ? SIZE64 : SIZE32;
-#endif
x.d86_data = (void **)&instr;
x.d86_get_byte = dtrace_dis_get_byte;
diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64
index 0396739ae4a8..5f138cf6ad1d 100644
--- a/sys/conf/files.amd64
+++ b/sys/conf/files.amd64
@@ -142,7 +142,7 @@ cddl/dev/dtrace/amd64/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
cddl/dev/dtrace/amd64/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
-cddl/dev/dtrace/amd64/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
+cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
crypto/aesni/aeskeys_amd64.S optional aesni
crypto/aesni/aesni.c optional aesni
aesni_ghash.o optional aesni \
diff --git a/sys/conf/files.i386 b/sys/conf/files.i386
index f9111a70d36a..178d5a330406 100644
--- a/sys/conf/files.i386
+++ b/sys/conf/files.i386
@@ -83,7 +83,7 @@ cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace compile-with "${DTRACE_S}"
cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}"
cddl/dev/fbt/x86/fbt_isa.c optional dtrace_fbt | dtraceall compile-with "${FBT_C}"
cddl/dev/dtrace/x86/dis_tables.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
-cddl/dev/dtrace/i386/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
+cddl/dev/dtrace/x86/instr_size.c optional dtrace_fbt | dtraceall compile-with "${DTRACE_C}"
compat/linprocfs/linprocfs.c optional linprocfs
compat/linsysfs/linsysfs.c optional linsysfs
compat/linux/linux_event.c optional compat_linux