Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/cddl/osnet add some new files missed by my script:



details:   https://anonhg.NetBSD.org/src/rev/7be40f0e61cf
branches:  trunk
changeset: 323033:7be40f0e61cf
user:      chs <chs%NetBSD.org@localhost>
date:      Mon May 28 23:47:39 2018 +0000

description:
add some new files missed by my script:
merge a new version of the CDDL dtrace and ZFS code.
this changes the upstream vendor from OpenSolaris to FreeBSD,
and this version is based on FreeBSD svn r315983.

in addition to the 10 years of improvements from upstream,
this version also has these NetBSD-specific enhancements:
 - dtrace FBT probes can now be placed in kernel modules.
 - ZFS now supports mmap().

diffstat:

 external/cddl/osnet/dev/dtrace/x86/dis_tables.c   |  5597 +++++++++++++++++++++
 external/cddl/osnet/dev/dtrace/x86/dis_tables.h   |   112 +
 external/cddl/osnet/dev/dtrace/x86/instr_size.c   |   149 +
 external/cddl/osnet/dev/dtrace/x86/regset.h       |   178 +
 external/cddl/osnet/dev/fbt/arm/fbt_isa.c         |   403 +
 external/cddl/osnet/dev/fbt/arm/fbt_isa.h         |    32 +
 external/cddl/osnet/dev/fbt/x86/fbt_isa.c         |   425 +
 external/cddl/osnet/dev/fbt/x86/fbt_isa.h         |    32 +
 external/cddl/osnet/lib/libzfs_core/Makefile      |    24 +
 external/cddl/osnet/lib/libzfs_core/shlib_version |     5 +
 10 files changed, 6957 insertions(+), 0 deletions(-)

diffs (truncated from 6997 to 300 lines):

diff -r 773fdcab2521 -r 7be40f0e61cf external/cddl/osnet/dev/dtrace/x86/dis_tables.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/cddl/osnet/dev/dtrace/x86/dis_tables.c   Mon May 28 23:47:39 2018 +0000
@@ -0,0 +1,5597 @@
+/*
+ *
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (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
+ */
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2016 Joyent, Inc.
+ */
+
+/*
+ * Copyright (c) 2010, Intel Corporation.
+ * All rights reserved.
+ */
+
+/*     Copyright (c) 1988 AT&T */
+/*       All Rights Reserved   */
+
+/*
+ * $FreeBSD: head/sys/cddl/dev/dtrace/x86/dis_tables.c 313133 2017-02-03 03:22:47Z markj $
+ */
+
+#include       "dis_tables.h"
+
+/* BEGIN CSTYLED */
+
+/*
+ * Disassembly begins in dis_distable, which is equivalent to the One-byte
+ * Opcode Map in the Intel IA32 ISA Reference (page A-6 in my copy).  The
+ * decoding loops then traverse out through the other tables as necessary to
+ * decode a given instruction.
+ *
+ * The behavior of this file can be controlled by one of the following flags:
+ *
+ *     DIS_TEXT        Include text for disassembly
+ *     DIS_MEM         Include memory-size calculations
+ *
+ * Either or both of these can be defined.
+ *
+ * This file is not, and will never be, cstyled.  If anything, the tables should
+ * be taken out another tab stop or two so nothing overlaps.
+ */
+
+/*
+ * These functions must be provided for the consumer to do disassembly.
+ */
+#ifdef DIS_TEXT
+extern char *strncpy(char *, const char *, size_t);
+extern size_t strlen(const char *);
+extern int strcmp(const char *, const char *);
+extern int strncmp(const char *, const char *, size_t);
+extern size_t strlcat(char *, const char *, size_t);
+#endif
+
+
+#define                TERM    0       /* used to indicate that the 'indirect' */
+                               /* field terminates - no pointer.       */
+
+/* Used to decode instructions. */
+typedef struct instable {
+       struct instable *it_indirect;   /* for decode op codes */
+       uchar_t         it_adrmode;
+#ifdef DIS_TEXT
+       char            it_name[NCPS];
+       uint_t          it_suffix:1;            /* mnem + "w", "l", or "d" */
+#endif
+#ifdef DIS_MEM
+       uint_t          it_size:16;
+#endif
+       uint_t          it_invalid64:1;         /* opcode invalid in amd64 */
+       uint_t          it_always64:1;          /* 64 bit when in 64 bit mode */
+       uint_t          it_invalid32:1;         /* invalid in IA32 */
+       uint_t          it_stackop:1;           /* push/pop stack operation */
+       uint_t          it_vexwoxmm:1;          /* VEX instructions that don't use XMM/YMM */
+       uint_t          it_avxsuf:1;            /* AVX suffix required */
+} instable_t;
+
+/*
+ * Instruction formats.
+ */
+enum {
+       UNKNOWN,
+       MRw,
+       IMlw,
+       IMw,
+       IR,
+       OA,
+       AO,
+       MS,
+       SM,
+       Mv,
+       Mw,
+       M,              /* register or memory */
+       MG9,            /* register or memory in group 9 (prefix optional) */
+       Mb,             /* register or memory, always byte sized */
+       MO,             /* memory only (no registers) */
+       PREF,
+       SWAPGS_RDTSCP,
+       MONITOR_MWAIT,
+       R,
+       RA,
+       SEG,
+       MR,
+       RM,
+       RM_66r,         /* RM, but with a required 0x66 prefix */ 
+       IA,
+       MA,
+       SD,
+       AD,
+       SA,
+       D,
+       INM,
+       SO,
+       BD,
+       I,
+       P,
+       V,
+       DSHIFT,         /* for double shift that has an 8-bit immediate */
+       U,
+       OVERRIDE,
+       NORM,           /* instructions w/o ModR/M byte, no memory access */
+       IMPLMEM,        /* instructions w/o ModR/M byte, implicit mem access */
+       O,              /* for call     */
+       JTAB,           /* jump table   */
+       IMUL,           /* for 186 iimul instr  */
+       CBW,            /* so data16 can be evaluated for cbw and variants */
+       MvI,            /* for 186 logicals */
+       ENTER,          /* for 186 enter instr  */
+       RMw,            /* for 286 arpl instr */
+       Ib,             /* for push immediate byte */
+       F,              /* for 287 instructions */
+       FF,             /* for 287 instructions */
+       FFC,            /* for 287 instructions */
+       DM,             /* 16-bit data */
+       AM,             /* 16-bit addr */
+       LSEG,           /* for 3-bit seg reg encoding */
+       MIb,            /* for 386 logicals */
+       SREG,           /* for 386 special registers */
+       PREFIX,         /* a REP instruction prefix */
+       LOCK,           /* a LOCK instruction prefix */
+       INT3,           /* The int 3 instruction, which has a fake operand */
+       INTx,           /* The normal int instruction, with explicit int num */
+       DSHIFTcl,       /* for double shift that implicitly uses %cl */
+       CWD,            /* so data16 can be evaluated for cwd and variants */
+       RET,            /* single immediate 16-bit operand */
+       MOVZ,           /* for movs and movz, with different size operands */
+       CRC32,          /* for crc32, with different size operands */
+       XADDB,          /* for xaddb */
+       MOVSXZ,         /* AMD64 mov sign extend 32 to 64 bit instruction */
+       MOVBE,          /* movbe instruction */
+
+/*
+ * MMX/SIMD addressing modes.
+ */
+
+       MMO,            /* Prefixable MMX/SIMD-Int      mm/mem  -> mm */
+       MMOIMPL,        /* Prefixable MMX/SIMD-Int      mm      -> mm (mem) */
+       MMO3P,          /* Prefixable MMX/SIMD-Int      mm      -> r32,imm8 */
+       MMOM3,          /* Prefixable MMX/SIMD-Int      mm      -> r32  */
+       MMOS,           /* Prefixable MMX/SIMD-Int      mm      -> mm/mem */
+       MMOMS,          /* Prefixable MMX/SIMD-Int      mm      -> mem */
+       MMOPM,          /* MMX/SIMD-Int                 mm/mem  -> mm,imm8 */
+       MMOPM_66o,      /* MMX/SIMD-Int 0x66 optional   mm/mem  -> mm,imm8 */
+       MMOPRM,         /* Prefixable MMX/SIMD-Int      r32/mem -> mm,imm8 */
+       MMOSH,          /* Prefixable MMX               mm,imm8 */
+       MM,             /* MMX/SIMD-Int                 mm/mem  -> mm   */
+       MMS,            /* MMX/SIMD-Int                 mm      -> mm/mem */
+       MMSH,           /* MMX                          mm,imm8 */
+       XMMO,           /* Prefixable SIMD              xmm/mem -> xmm */
+       XMMOS,          /* Prefixable SIMD              xmm     -> xmm/mem */
+       XMMOPM,         /* Prefixable SIMD              xmm/mem w/to xmm,imm8 */
+       XMMOMX,         /* Prefixable SIMD              mm/mem  -> xmm */
+       XMMOX3,         /* Prefixable SIMD              xmm     -> r32 */
+       XMMOXMM,        /* Prefixable SIMD              xmm/mem -> mm   */
+       XMMOM,          /* Prefixable SIMD              xmm     -> mem */
+       XMMOMS,         /* Prefixable SIMD              mem     -> xmm */
+       XMM,            /* SIMD                         xmm/mem -> xmm */
+       XMM_66r,        /* SIMD 0x66 prefix required    xmm/mem -> xmm */
+       XMM_66o,        /* SIMD 0x66 prefix optional    xmm/mem -> xmm */
+       XMMXIMPL,       /* SIMD                         xmm     -> xmm (mem) */
+       XMM3P,          /* SIMD                         xmm     -> r32,imm8 */
+       XMM3PM_66r,     /* SIMD 0x66 prefix required    xmm     -> r32/mem,imm8 */
+       XMMP,           /* SIMD                         xmm/mem w/to xmm,imm8 */
+       XMMP_66o,       /* SIMD 0x66 prefix optional    xmm/mem w/to xmm,imm8 */
+       XMMP_66r,       /* SIMD 0x66 prefix required    xmm/mem w/to xmm,imm8 */
+       XMMPRM,         /* SIMD                         r32/mem -> xmm,imm8 */
+       XMMPRM_66r,     /* SIMD 0x66 prefix required    r32/mem -> xmm,imm8 */
+       XMMS,           /* SIMD                         xmm     -> xmm/mem */
+       XMMM,           /* SIMD                         mem     -> xmm */
+       XMMM_66r,       /* SIMD 0x66 prefix required    mem     -> xmm */
+       XMMMS,          /* SIMD                         xmm     -> mem */
+       XMM3MX,         /* SIMD                         r32/mem -> xmm */
+       XMM3MXS,        /* SIMD                         xmm     -> r32/mem */
+       XMMSH,          /* SIMD                         xmm,imm8 */
+       XMMXM3,         /* SIMD                         xmm/mem -> r32 */
+       XMMX3,          /* SIMD                         xmm     -> r32 */
+       XMMXMM,         /* SIMD                         xmm/mem -> mm */
+       XMMMX,          /* SIMD                         mm      -> xmm */
+       XMMXM,          /* SIMD                         xmm     -> mm */
+        XMMX2I,                /* SIMD                         xmm -> xmm, imm, imm */
+        XMM2I,         /* SIMD                         xmm, imm, imm */
+       XMMFENCE,       /* SIMD lfence or mfence */
+       XMMSFNC,        /* SIMD sfence (none or mem) */
+       XGETBV_XSETBV,
+       VEX_NONE,       /* VEX  no operand */
+       VEX_MO,         /* VEX  mod_rm                         -> implicit reg */
+       VEX_RMrX,       /* VEX  VEX.vvvv, mod_rm               -> mod_reg */
+       VEX_VRMrX,      /* VEX  mod_rm, VEX.vvvv               -> mod_rm */
+       VEX_RRX,        /* VEX  VEX.vvvv, mod_reg              -> mod_rm */
+       VEX_RMRX,       /* VEX  VEX.vvvv, mod_rm, imm8[7:4]    -> mod_reg */
+       VEX_MX,         /* VEX  mod_rm                         -> mod_reg */
+       VEX_MXI,        /* VEX  mod_rm, imm8                   -> mod_reg */
+       VEX_XXI,        /* VEX  mod_rm, imm8                   -> VEX.vvvv */
+       VEX_MR,         /* VEX  mod_rm                         -> mod_reg */
+       VEX_RRI,        /* VEX  mod_reg, mod_rm                -> implicit(eflags/r32) */
+       VEX_RX,         /* VEX  mod_reg                        -> mod_rm */
+       VEX_RR,         /* VEX  mod_rm                         -> mod_reg */
+       VEX_RRi,        /* VEX  mod_rm, imm8                   -> mod_reg */
+       VEX_RM,         /* VEX  mod_reg                        -> mod_rm */
+       VEX_RIM,        /* VEX  mod_reg, imm8                  -> mod_rm */
+       VEX_RRM,        /* VEX  VEX.vvvv, mod_reg              -> mod_rm */
+       VEX_RMX,        /* VEX  VEX.vvvv, mod_rm               -> mod_reg */
+       VEX_SbVM,       /* VEX  SIB, VEX.vvvv                  -> mod_rm */
+       VMx,            /* vmcall/vmlaunch/vmresume/vmxoff */
+       VMxo,           /* VMx instruction with optional prefix */
+       SVM,            /* AMD SVM instructions */
+       BLS,            /* BLSR, BLSMSK, BLSI */
+       FMA,            /* FMA instructions, all VEX_RMrX */
+       ADX             /* ADX instructions, support REX.w, mod_rm->mod_reg */
+};
+
+/*
+ * VEX prefixes
+ */
+#define VEX_2bytes     0xC5    /* the first byte of two-byte form */
+#define VEX_3bytes     0xC4    /* the first byte of three-byte form */
+
+#define        FILL    0x90    /* Fill byte used for alignment (nop)   */
+
+/*
+** Register numbers for the i386
+*/
+#define        EAX_REGNO 0
+#define        ECX_REGNO 1
+#define        EDX_REGNO 2
+#define        EBX_REGNO 3
+#define        ESP_REGNO 4
+#define        EBP_REGNO 5
+#define        ESI_REGNO 6
+#define        EDI_REGNO 7
+
+/*
+ * modes for immediate values
+ */
+#define        MODE_NONE       0
+#define        MODE_IPREL      1       /* signed IP relative value */
+#define        MODE_SIGNED     2       /* sign extended immediate */
+#define        MODE_IMPLIED    3       /* constant value implied from opcode */
+#define        MODE_OFFSET     4       /* offset part of an address */
+#define        MODE_RIPREL     5       /* like IPREL, but from %rip (amd64) */
+
+/*
+ * The letters used in these macros are:
+ *   IND - indirect to another to another table
+ *   "T" - means to Terminate indirections (this is the final opcode)
+ *   "S" - means "operand length suffix required"
+ *   "Sa" - means AVX2 suffix (d/q) required
+ *   "NS" - means "no suffix" which is the operand length suffix of the opcode
+ *   "Z" - means instruction size arg required
+ *   "u" - means the opcode is invalid in IA32 but valid in amd64
+ *   "x" - means the opcode is invalid in amd64, but not IA32
+ *   "y" - means the operand size is always 64 bits in 64 bit mode
+ *   "p" - means push/pop stack operation
+ *   "vr" - means VEX instruction that operates on normal registers, not fpu
+ */
+
+#if defined(DIS_TEXT) && defined(DIS_MEM)
+#define        IND(table)              {(instable_t *)table, 0, "", 0, 0, 0, 0, 0, 0}
+#define        INDx(table)             {(instable_t *)table, 0, "", 0, 0, 1, 0, 0, 0}
+#define        TNS(name, amode)        {TERM, amode, name, 0, 0, 0, 0, 0, 0}



Home | Main Index | Thread Index | Old Index