plugin/ndisasm: rollback

git-svn-id: svn://ultimatepp.org/upp/trunk@14996 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-09-07 12:56:54 +00:00
parent 83b9d635aa
commit d4417cbccf
39 changed files with 21761 additions and 31381 deletions

View file

@ -1,137 +1,137 @@
This is the AUTHORS file for the NASM project located at:
http://nasm.sourceforge.net/
Names should be inserted as follows:
N: Name Here
E: Email Here
D: Description Here
D: Additional Description Here.... and so on
C: Copyright information
Such is life.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
N: Julian Hall
E: Jules@acris.co.uk
D: Original author and co-conspirator
N: Simon Tatham
E: anakin@pobox.com
D: Original author and co-conspirator
N: Nelson Rush
E: palisade@users.sourceforge.net
D: Some guy.
N: Frank Kotler
E: fbkotler@users.sf.net
D: Bug smashing.
D: Documentation - "KATMAI" and "3DNow!" instructions supported by 0.98
D: General coordination and moral support.
N: Stephen Silver
E: nasm@argentum.freeserve.co.uk
D: Documentation - "3dNow!" instructions and misc.
D: insns.dat fixes and new instructions.
N: AMD Inc. (names of developers here?)
E:
D: 3DNow instructions
D: New Athlon instructions
D: Makefile.vc fix
N: John Coffman
E: johninsd@users.sourceforge.net
D: added Jcc optimizations; CPU level checks
D: bug fixes, compilation fixes
N: Yuri Zaporozhets
E: r_tty@yahoo.co.uk
D: RDOFF support
N: H. Peter Anvin
E: hpa@zytor.com
D: Primary maintainer for the 0.98, late 0.98.x and 2.x releases.
C: Contributions since 2008-12-15 are Copyright Intel Corporation.
N: John Fine
E: johnfine@earthlink.net
D: Preprocessor and OBJ (OMF) output format driver
D: Organized DOS versions of 0.98 release
N: Kendall Bennet
E: KendallB@scitechsoft.com
D: NASM enhancements
D: macros
D: Syntax modifications
N: Gary Clark
E:
D: AMD 3DNow! instructions
N: Andrew Crabtree
E:
D: Debugging support
N: Rafael R. Sevilla
E: dido@pacific.net.ph
D: RDF2HEX utility
N: Jaime Tejedor Gómez, aka Metalbrain
E: metalbrain_coder@gmx.net
D: jecxz bug fix
N: James Seter
E: pharos@zsnes.com
D: --POSTFIX, --PREFIX switches
D: ?
N: Edward J. Beroset
E: beroset@mindspring.com
D: added %substr and %strlen
N: Stanislav Karchebny, aka berkus, madfire, daemonhunter
E: madfire@users.sourceforge.net
D: multiple sections support for -fbin format
D: cvs maintenance
D: webpage at http://nasm.2y.net maintenance
N: Debbie Wiles, aka debs
E: debs@dwiles.demon.co.uk
D: Work on docs, added undocumented instructions (esp SSE2 and 3D-Now!)
D: Added other documentation and tidied up docs
D: Added a few instructions to insns.dat and tidied it up.
N: Trevor Woerner
E: FIXME
D: Quiet compiler warnings
N: Michael K. Ter Louw
E: mterlo1 "at" uic "dot" edu
D: Multisection support for "-f bin"
N: Martin Wawro
E: FIXME
D: stabs debug support for "-f elf"
N: Alexei Frounze
E: alexfru@users.sourceforge.net
D: "-I" paths searched for "incbined" files
D: bugswatting
N: Keith Kanios, aka SpooK
E: keith@kanios.net
D: c99 Compliance
D: General x64 Support
D: win64 (x86-64 COFF) output format
D: __BITS__ Standard Macro
D: Website Maintenance @ http://nasm.sourceforge.net/
N: Chuck Crayne
E: ccrayne@users.sourceforge.net
D: elf64 (x86_64) output format
N: Cyrill Gorcunov
E: gorcunov@gmail.com
D: AMD XOP/FMA4/CVT16 instructions
This is the AUTHORS file for the NASM project located at:
http://nasm.sourceforge.net/
Names should be inserted as follows:
N: Name Here
E: Email Here
D: Description Here
D: Additional Description Here.... and so on
C: Copyright information
Such is life.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
N: Julian Hall
E: Jules@acris.co.uk
D: Original author and co-conspirator
N: Simon Tatham
E: anakin@pobox.com
D: Original author and co-conspirator
N: Nelson Rush
E: palisade@users.sourceforge.net
D: Some guy.
N: Frank Kotler
E: fbkotler@users.sf.net
D: Bug smashing.
D: Documentation - "KATMAI" and "3DNow!" instructions supported by 0.98
D: General coordination and moral support.
N: Stephen Silver
E: nasm@argentum.freeserve.co.uk
D: Documentation - "3dNow!" instructions and misc.
D: insns.dat fixes and new instructions.
N: AMD Inc. (names of developers here?)
E:
D: 3DNow instructions
D: New Athlon instructions
D: Makefile.vc fix
N: John Coffman
E: johninsd@users.sourceforge.net
D: added Jcc optimizations; CPU level checks
D: bug fixes, compilation fixes
N: Yuri Zaporogets
E: yuriz@users.sourceforge.net
D: RDOFF support
N: H. Peter Anvin
E: hpa@zytor.com
D: Primary maintainer for the 0.98, late 0.98.x and 2.x releases.
C: Contributions since 2008-12-15 are Copyright Intel Corporation.
N: John Fine
E: johnfine@earthlink.net
D: Preprocessor and OBJ (OMF) output format driver
D: Organized DOS versions of 0.98 release
N: Kendall Bennet
E: KendallB@scitechsoft.com
D: NASM enhancements
D: macros
D: Syntax modifications
N: Gary Clark
E:
D: AMD 3DNow! instructions
N: Andrew Crabtree
E:
D: Debugging support
N: Rafael R. Sevilla
E: dido@pacific.net.ph
D: RDF2HEX utility
N: Jaime Tejedor Gómez, aka Metalbrain
E: metalbrain_coder@gmx.net
D: jecxz bug fix
N: James Seter
E: pharos@zsnes.com
D: --POSTFIX, --PREFIX switches
D: ?
N: Edward J. Beroset
E: beroset@mindspring.com
D: added %substr and %strlen
N: Stanislav Karchebny, aka berkus, madfire, daemonhunter
E: madfire@users.sourceforge.net
D: multiple sections support for -fbin format
D: cvs maintenance
D: webpage at http://nasm.2y.net maintenance
N: Debbie Wiles, aka debs
E: debs@dwiles.demon.co.uk
D: Work on docs, added undocumented instructions (esp SSE2 and 3D-Now!)
D: Added other documentation and tidied up docs
D: Added a few instructions to insns.dat and tidied it up.
N: Trevor Woerner
E: FIXME
D: Quiet compiler warnings
N: Michael K. Ter Louw
E: mterlo1 "at" uic "dot" edu
D: Multisection support for "-f bin"
N: Martin Wawro
E: FIXME
D: stabs debug support for "-f elf"
N: Alexei Frounze
E: alexfru@users.sourceforge.net
D: "-I" paths searched for "incbined" files
D: bugswatting
N: Keith Kanios, aka SpooK
E: keith@kanios.net
D: c99 Compliance
D: General x64 Support
D: win64 (x86-64 COFF) output format
D: __BITS__ Standard Macro
D: Website Maintenance @ http://nasm.sourceforge.net/
N: Chuck Crayne
E: ccrayne@users.sourceforge.net
D: elf64 (x86_64) output format
N: Cyrill Gorcunov
E: gorcunov@gmail.com
D: AMD XOP/FMA4/CVT16 instructions

View file

@ -1,29 +1,29 @@
NASM is now licensed under the 2-clause BSD license, also known as the
simplified BSD license.
Copyright 1996-2010 the NASM Authors - All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NASM is now licensed under the 2-clause BSD license, also known as the
simplified BSD license.
Copyright 1996-2009 the NASM Authors - All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -5,19 +5,17 @@ Many many developers all over the net respect NASM for what it is
flexible and mature assembler tool with support for many output
formats (thus netwide!!).
Now we have good news for you: NASM is licensed under the "simplified"
(2-clause) BSD license. This means its development is open to even
wider society of programmers wishing to improve their lovely
assembler.
Now we have good news for you: NASM is licensed under LGPL.
This means its development is open to even wider society of
programmers wishing to improve their lovely assembler.
The NASM project is now situated at SourceForge.net, the most
popular Open Source development site on the Internet.
famous Open Source development center on The Net.
Visit our website at http://nasm.sourceforge.net/ and our
SourceForge project at http://sourceforge.net/projects/nasm/
Visit our development page at http://nasm.2y.net/ and our
SF project at http://sf.net/projects/nasm/
See the file CHANGES for the description of changes between revisions,
and the file AUTHORS for a list of contributors.
See the file CHANGES for the description of changes between revisions.
With best regards,
NASM crew.

View file

@ -1,206 +1,195 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2016 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* compiler.h
*
* Compiler-specific macros for NASM. Feel free to add support for
* other compilers in here.
*
* This header file should be included before any other header.
*/
#ifndef NASM_COMPILER_H
#define NASM_COMPILER_H 1
#ifdef __DJGPP__
/* DJGPP has header file problems if __STRICT_ANSI__ is defined */
# undef __STRICT_ANSI__
#endif
#ifdef __APPLE__
#define _FORTIFY_SOURCE 0 //aris002 - in the future evaluate how unsafe are the safe funtions and vice versa
#endif
/* On Microsoft platforms we support multibyte character sets in filenames */
#define _MBCS 1
#ifdef HAVE_CONFIG_H
# include "config.h"
/* autoconf doesn't define these if they are redundant, but we want to
be able to #ifdef them... */
#else
/* Default these to unsupported unless we have config.h */
# ifndef restrict
# define restrict
# endif
#endif /* HAVE_CONFIG_H */
/* This is required to get the standard <inttypes.h> macros when compiling
with a C++ compiler. This must be defined *before* <inttypes.h> is
included, directly or indirectly. */
#define __STDC_CONSTANT_MACROS 1
#define __STDC_LIMIT_MACROS 1
#define __STDC_FORMAT_MACROS 1
#ifdef __GNUC__
# if __GNUC__ >= 4
# define HAVE_GNUC_4
# endif
# if __GNUC__ >= 3
# define HAVE_GNUC_3
# endif
#define HAVE_SNPRINTF
#define HAVE_VSNPRINTF
#endif
/* Some versions of MSVC have these only with underscores in front */
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#ifdef _MSC_VER
#define HAVE__SNPRINTF
#endif
#ifndef HAVE_SNPRINTF
# ifdef HAVE__SNPRINTF
# define snprintf _snprintf
# else
int snprintf(char *, size_t, const char *, ...);
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef HAVE__VSNPRINTF
# define vsnprintf _vsnprintf
# else
int vsnprintf(char *, size_t, const char *, va_list);
# endif
#endif
#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
#ifndef __cplusplus /* C++ has false, true, bool as keywords */
# if defined(HAVE_STDBOOL_H) && defined(HAVE_WORKING_BOOL)
# include <stdbool.h>
# else
/* This is sort of dangerous, since casts will behave different than
casting to the standard boolean type. Always use !!, not (bool). */
typedef enum bool { false, true } bool;
# endif
#endif
/* Provide a substitute for offsetof() if we don't have one. This
variant works on most (but not *all*) systems... */
#ifndef offsetof
# define offsetof(t,m) ((size_t)&(((t *)0)->m))
#endif
/* The container_of construct: if p is a pointer to member m of
container class c, then return a pointer to the container of which
*p is a member. */
#ifndef container_of
# define container_of(p, c, m) ((c *)((char *)(p) - offsetof(c,m)))
#endif
/* Some misguided platforms hide the defs for these */
#if defined(HAVE_STRCASECMP) && !HAVE_DECL_STRCASECMP
int strcasecmp(const char *, const char *);
#endif
#if defined(HAVE_STRICMP) && !HAVE_DECL_STRICMP
int stricmp(const char *, const char *);
#endif
#if defined(HAVE_STRNCASECMP) && !HAVE_DECL_STRNCASECMP
int strncasecmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRNICMP) && !HAVE_DECL_STRNICMP
int strnicmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRSEP) && !HAVE_DECL_STRSEP
char *strsep(char **, const char *);
#endif
/*
* Define this to 1 for faster performance if this is a littleendian
* platform which can do unaligned memory references. It is safe
* to leave it defined to 0 even if that is true.
*/
#if defined(__386__) || defined(__i386__) || defined(__x86_64__)
# define X86_MEMORY 1
# ifndef WORDS_LITTLEENDIAN
# define WORDS_LITTLEENDIAN 1
# endif
#else
# define X86_MEMORY 0
#endif
/*
* Hints to the compiler that a particular branch of code is more or
* less likely to be taken.
*/
#if defined(__GNUC__) && __GNUC__ >= 3
# define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0)
#else
# define likely(x) (!!(x))
# define unlikely(x) (!!(x))
#endif
/*
* How to tell the compiler that a function doesn't return
*/
#ifdef __GNUC__
# define no_return void __attribute__((noreturn))
#else
# define no_return void
#endif
/*
* How to tell the compiler that a function takes a printf-like string
*/
#ifdef __GNUC__
# define printf_func(fmt, list) __attribute__((format(printf, fmt, list)))
#else
# define printf_func(fmt, list)
#endif
#endif /* NASM_COMPILER_H */
/* ----------------------------------------------------------------------- *
*
* Copyright 2007-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* compiler.h
*
* Compiler-specific macros for NASM. Feel free to add support for
* other compilers in here.
*
* This header file should be included before any other header.
*/
#ifndef NASM_COMPILER_H
#define NASM_COMPILER_H 1
#ifdef __APPLE__
#define _FORTIFY_SOURCE 0 //aris002 - in the future evaluate how unsafe are the safe funtions and vice versa
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
/* autoconf doesn't define these if they are redundant, but we want to
be able to #ifdef them... */
#else
/* Default these to unsupported unless we have config.h */
# ifndef restrict
# define restrict
# endif
#endif /* HAVE_CONFIG_H */
/* This is required to get the standard <inttypes.h> macros when compiling
with a C++ compiler. This must be defined *before* <inttypes.h> is
included, directly or indirectly. */
#define __STDC_CONSTANT_MACROS 1
#define __STDC_LIMIT_MACROS 1
#define __STDC_FORMAT_MACROS 1
#ifdef __GNUC__
# if __GNUC__ >= 4
# define HAVE_GNUC_4
# endif
# if __GNUC__ >= 3
# define HAVE_GNUC_3
# endif
#define HAVE_SNPRINTF
#define HAVE_VSNPRINTF
#endif
#ifdef __GNUC__
# define _unused __attribute__((unused))
#else
# define _unused
#endif
/* Some versions of MSVC have these only with underscores in front */
#include <stddef.h>
#include <stdarg.h>
#include <stdio.h>
#ifdef _MSC_VER
#define HAVE__SNPRINTF
#endif
#ifndef HAVE_SNPRINTF
# ifdef HAVE__SNPRINTF
# define snprintf _snprintf
# else
int snprintf(char *, size_t, const char *, ...);
# endif
#endif
#ifndef HAVE_VSNPRINTF
# ifdef HAVE__VSNPRINT
# define vsnprintf _vsnprintf
# else
int vsnprintf(char *, size_t, const char *, va_list);
# endif
#endif
#if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY
size_t strlcpy(char *, const char *, size_t);
#endif
#ifndef __cplusplus /* C++ has false, true, bool as keywords */
# if defined(HAVE_STDBOOL_H) && defined(HAVE_WORKING_BOOL)
# include <stdbool.h>
# else
/* This is sort of dangerous, since casts will behave different than
casting to the standard boolean type. Always use !!, not (bool). */
typedef enum bool { false, true } bool;
# endif
#endif
/* Provide a substitute for offsetof() if we don't have one. This
variant works on most (but not *all*) systems... */
#ifndef offsetof
# define offsetof(t,m) ((size_t)&(((t *)0)->m))
#endif
/* The container_of construct: if p is a pointer to member m of
container class c, then return a pointer to the container of which
*p is a member. */
#ifndef container_of
# define container_of(p, c, m) ((c *)((char *)(p) - offsetof(c,m)))
#endif
/* Some misguided platforms hide the defs for these */
#if defined(HAVE_STRCASECMP) && !HAVE_DECL_STRCASECMP
int strcasecmp(const char *, const char *);
#endif
#if defined(HAVE_STRICMP) && !HAVE_DECL_STRICMP
int stricmp(const char *, const char *);
#endif
#if defined(HAVE_STRNCASECMP) && !HAVE_DECL_STRNCASECMP
int strncasecmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRNICMP) && !HAVE_DECL_STRNICMP
int strnicmp(const char *, const char *, size_t);
#endif
#if defined(HAVE_STRSEP) && !HAVE_DECL_STRSEP
char *strsep(char **, const char *);
#endif
/*
* Define this to 1 for faster performance if this is a littleendian
* platform which can do unaligned memory references. It is safe
* to leave it defined to 0 even if that is true.
*/
#if defined(__386__) || defined(__i386__) || defined(__x86_64__)
# define X86_MEMORY 1
# ifndef WORDS_LITTLEENDIAN
# define WORDS_LITTLEENDIAN 1
# endif
#else
# define X86_MEMORY 0
#endif
/*
* Hints to the compiler that a particular branch of code is more or
* less likely to be taken.
*/
#if defined(__GNUC__) && __GNUC__ >= 3
# define likely(x) __builtin_expect(!!(x), 1)
# define unlikely(x) __builtin_expect(!!(x), 0)
#else
# define likely(x) (!!(x))
# define unlikely(x) (!!(x))
#endif
/*
* How to tell the compiler that a function doesn't return
*/
#ifdef __GNUC__
# define no_return void __attribute__((noreturn))
#else
# define no_return void
#endif
#endif /* NASM_COMPILER_H */

View file

@ -1,41 +0,0 @@
/*
* This file is generated from directiv.dat
* by directiv.pl; do not edit.
*/
#ifndef NASM_DIRECTIVES_H
#define NASM_DIRECTIVES_H
enum directives {
D_none,
D_unknown,
D_ABSOLUTE,
D_BITS,
D_COMMON,
D_CPU,
D_DEBUG,
D_DEFAULT,
D_EXTERN,
D_FLOAT,
D_GLOBAL,
D_LIST,
D_SECTION,
D_SEGMENT,
D_WARNING,
D_SECTALIGN,
D_EXPORT,
D_GROUP,
D_IMPORT,
D_LIBRARY,
D_MAP,
D_MODULE,
D_ORG,
D_OSABI,
D_SAFESEH,
D_UPPERCASE
};
extern const char * const directives[26];
enum directives find_directive(const char *token);
#endif /* NASM_DIRECTIVES_H */

File diff suppressed because it is too large Load diff

View file

@ -38,12 +38,10 @@
#ifndef NASM_DISASM_H
#define NASM_DISASM_H
#include "iflag.h"
#define INSN_MAX 32 /* one instruction can't be longer than this */
int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize,
int32_t offset, int autosync, iflag_t *prefer);
uint64_t offset, int autosync, uint32_t prefer);
int32_t eatbyte(uint8_t *data, char *output, int outbufsize, int segsize);
#endif

View file

@ -1,131 +0,0 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* disp8.c : Contains a common logic for EVEX compressed displacement
*/
#include "disp8.h"
/*
* Find N value for compressed displacement (disp8 * N)
*/
uint8_t get_disp8N(insn *ins)
{
const uint8_t fv_n[2][2][VLMAX] = {{{16, 32, 64}, {4, 4, 4}},
{{16, 32, 64}, {8, 8, 8}}};
const uint8_t hv_n[2][VLMAX] = {{8, 16, 32}, {4, 4, 4}};
const uint8_t dup_n[VLMAX] = {8, 32, 64};
bool evex_b = (ins->evex_p[2] & EVEX_P2B) >> 4;
enum ttypes tuple = ins->evex_tuple;
enum vectlens vectlen = (ins->evex_p[2] & EVEX_P2LL) >> 5;
bool evex_w = (ins->evex_p[1] & EVEX_P1W) >> 7;
uint8_t n = 0;
switch(tuple) {
case FV:
n = fv_n[evex_w][evex_b][vectlen];
break;
case HV:
n = hv_n[evex_b][vectlen];
break;
case FVM:
/* 16, 32, 64 for VL 128, 256, 512 respectively*/
n = 1 << (vectlen + 4);
break;
case T1S8: /* N = 1 */
case T1S16: /* N = 2 */
n = tuple - T1S8 + 1;
break;
case T1S:
/* N = 4 for 32bit, 8 for 64bit */
n = evex_w ? 8 : 4;
break;
case T1F32:
case T1F64:
/* N = 4 for 32bit, 8 for 64bit */
n = (tuple == T1F32 ? 4 : 8);
break;
case T2:
case T4:
case T8:
if (vectlen + 7 <= (evex_w + 5) + (tuple - T2 + 1))
n = 0;
else
n = 1 << (tuple - T2 + evex_w + 3);
break;
case HVM:
case QVM:
case OVM:
n = 1 << (OVM - tuple + vectlen + 1);
break;
case M128:
n = 16;
break;
case DUP:
n = dup_n[vectlen];
break;
default:
break;
}
return n;
}
/*
* Check if offset is a multiple of N with corresponding tuple type
* if Disp8*N is available, compressed displacement is stored in compdisp
*/
bool is_disp8n(operand *input, insn *ins, int8_t *compdisp)
{
int32_t off = input->offset;
uint8_t n;
int32_t disp8;
n = get_disp8N(ins);
if (n && !(off & (n - 1))) {
disp8 = off / n;
/* if it fits in Disp8 */
if (disp8 >= -128 && disp8 <= 127) {
*compdisp = disp8;
return true;
}
}
*compdisp = 0;
return false;
}

View file

@ -1,45 +0,0 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* disp8.h header file for disp8.c
*/
#ifndef NASM_DISP8_H
#define NASM_DISP8_H
#include "nasm.h"
uint8_t get_disp8N(insn *ins);
bool is_disp8n(operand *input, insn *ins, int8_t *compdisp);
#endif /* NASM_DISP8_H */

View file

@ -1,186 +1,186 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* exprlib.c
*
* Library routines to manipulate expression data types.
*/
#include "nasm.h"
/*
* Return true if the argument is a simple scalar. (Or a far-
* absolute, which counts.)
*/
int is_simple(expr * vect)
{
while (vect->type && !vect->value)
vect++;
if (!vect->type)
return 1;
if (vect->type != EXPR_SIMPLE)
return 0;
do {
vect++;
} while (vect->type && !vect->value);
if (vect->type && vect->type < EXPR_SEGBASE + SEG_ABS)
return 0;
return 1;
}
/*
* Return true if the argument is a simple scalar, _NOT_ a far-
* absolute.
*/
int is_really_simple(expr * vect)
{
while (vect->type && !vect->value)
vect++;
if (!vect->type)
return 1;
if (vect->type != EXPR_SIMPLE)
return 0;
do {
vect++;
} while (vect->type && !vect->value);
if (vect->type)
return 0;
return 1;
}
/*
* Return true if the argument is relocatable (i.e. a simple
* scalar, plus at most one segment-base, plus possibly a WRT).
*/
int is_reloc(expr * vect)
{
while (vect->type && !vect->value) /* skip initial value-0 terms */
vect++;
if (!vect->type) /* trivially return true if nothing */
return 1; /* is present apart from value-0s */
if (vect->type < EXPR_SIMPLE) /* false if a register is present */
return 0;
if (vect->type == EXPR_SIMPLE) { /* skip over a pure number term... */
do {
vect++;
} while (vect->type && !vect->value);
if (!vect->type) /* ...returning true if that's all */
return 1;
}
if (vect->type == EXPR_WRT) { /* skip over a WRT term... */
do {
vect++;
} while (vect->type && !vect->value);
if (!vect->type) /* ...returning true if that's all */
return 1;
}
if (vect->value != 0 && vect->value != 1)
return 0; /* segment base multiplier non-unity */
do { /* skip over _one_ seg-base term... */
vect++;
} while (vect->type && !vect->value);
if (!vect->type) /* ...returning true if that's all */
return 1;
return 0; /* And return false if there's more */
}
/*
* Return true if the argument contains an `unknown' part.
*/
int is_unknown(expr * vect)
{
while (vect->type && vect->type < EXPR_UNKNOWN)
vect++;
return (vect->type == EXPR_UNKNOWN);
}
/*
* Return true if the argument contains nothing but an `unknown'
* part.
*/
int is_just_unknown(expr * vect)
{
while (vect->type && !vect->value)
vect++;
return (vect->type == EXPR_UNKNOWN);
}
/*
* Return the scalar part of a relocatable vector. (Including
* simple scalar vectors - those qualify as relocatable.)
*/
int64_t reloc_value(expr * vect)
{
while (vect->type && !vect->value)
vect++;
if (!vect->type)
return 0;
if (vect->type == EXPR_SIMPLE)
return vect->value;
else
return 0;
}
/*
* Return the segment number of a relocatable vector, or NO_SEG for
* simple scalars.
*/
int32_t reloc_seg(expr * vect)
{
while (vect->type && (vect->type == EXPR_WRT || !vect->value))
vect++;
if (vect->type == EXPR_SIMPLE) {
do {
vect++;
} while (vect->type && (vect->type == EXPR_WRT || !vect->value));
}
if (!vect->type)
return NO_SEG;
else
return vect->type - EXPR_SEGBASE;
}
/*
* Return the WRT segment number of a relocatable vector, or NO_SEG
* if no WRT part is present.
*/
int32_t reloc_wrt(expr * vect)
{
while (vect->type && vect->type < EXPR_WRT)
vect++;
if (vect->type == EXPR_WRT) {
return vect->value;
} else
return NO_SEG;
}
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* exprlib.c
*
* Library routines to manipulate expression data types.
*/
#include "nasm.h"
/*
* Return true if the argument is a simple scalar. (Or a far-
* absolute, which counts.)
*/
int is_simple(expr * vect)
{
while (vect->type && !vect->value)
vect++;
if (!vect->type)
return 1;
if (vect->type != EXPR_SIMPLE)
return 0;
do {
vect++;
} while (vect->type && !vect->value);
if (vect->type && vect->type < EXPR_SEGBASE + SEG_ABS)
return 0;
return 1;
}
/*
* Return true if the argument is a simple scalar, _NOT_ a far-
* absolute.
*/
int is_really_simple(expr * vect)
{
while (vect->type && !vect->value)
vect++;
if (!vect->type)
return 1;
if (vect->type != EXPR_SIMPLE)
return 0;
do {
vect++;
} while (vect->type && !vect->value);
if (vect->type)
return 0;
return 1;
}
/*
* Return true if the argument is relocatable (i.e. a simple
* scalar, plus at most one segment-base, plus possibly a WRT).
*/
int is_reloc(expr * vect)
{
while (vect->type && !vect->value) /* skip initial value-0 terms */
vect++;
if (!vect->type) /* trivially return true if nothing */
return 1; /* is present apart from value-0s */
if (vect->type < EXPR_SIMPLE) /* false if a register is present */
return 0;
if (vect->type == EXPR_SIMPLE) { /* skip over a pure number term... */
do {
vect++;
} while (vect->type && !vect->value);
if (!vect->type) /* ...returning true if that's all */
return 1;
}
if (vect->type == EXPR_WRT) { /* skip over a WRT term... */
do {
vect++;
} while (vect->type && !vect->value);
if (!vect->type) /* ...returning true if that's all */
return 1;
}
if (vect->value != 0 && vect->value != 1)
return 0; /* segment base multiplier non-unity */
do { /* skip over _one_ seg-base term... */
vect++;
} while (vect->type && !vect->value);
if (!vect->type) /* ...returning true if that's all */
return 1;
return 0; /* And return false if there's more */
}
/*
* Return true if the argument contains an `unknown' part.
*/
int is_unknown(expr * vect)
{
while (vect->type && vect->type < EXPR_UNKNOWN)
vect++;
return (vect->type == EXPR_UNKNOWN);
}
/*
* Return true if the argument contains nothing but an `unknown'
* part.
*/
int is_just_unknown(expr * vect)
{
while (vect->type && !vect->value)
vect++;
return (vect->type == EXPR_UNKNOWN);
}
/*
* Return the scalar part of a relocatable vector. (Including
* simple scalar vectors - those qualify as relocatable.)
*/
int64_t reloc_value(expr * vect)
{
while (vect->type && !vect->value)
vect++;
if (!vect->type)
return 0;
if (vect->type == EXPR_SIMPLE)
return vect->value;
else
return 0;
}
/*
* Return the segment number of a relocatable vector, or NO_SEG for
* simple scalars.
*/
int32_t reloc_seg(expr * vect)
{
while (vect->type && (vect->type == EXPR_WRT || !vect->value))
vect++;
if (vect->type == EXPR_SIMPLE) {
do {
vect++;
} while (vect->type && (vect->type == EXPR_WRT || !vect->value));
}
if (!vect->type)
return NO_SEG;
else
return vect->type - EXPR_SEGBASE;
}
/*
* Return the WRT segment number of a relocatable vector, or NO_SEG
* if no WRT part is present.
*/
int32_t reloc_wrt(expr * vect)
{
while (vect->type && vect->type < EXPR_WRT)
vect++;
if (vect->type == EXPR_WRT) {
return vect->value;
} else
return NO_SEG;
}

View file

@ -1,235 +0,0 @@
/* This file is auto-generated. Don't edit. */
#include "iflag.h"
/* Global flags referenced from instruction templates */
const iflag_t insns_flags[228] = {
/* 0 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 1 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 2 */ {{ UINT32_C(0x00000004),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 3 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 4 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 5 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 6 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000028),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 7 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 8 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 9 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 10 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 11 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 12 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 13 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000028),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 14 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000018),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 15 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000014),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 16 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000014),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 17 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x40000020) }},
/* 18 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000002) }},
/* 19 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 20 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000010) }},
/* 21 */ {{ UINT32_C(0x00000004),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 22 */ {{ UINT32_C(0x00000004),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 23 */ {{ UINT32_C(0x00000004),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 24 */ {{ UINT32_C(0x00000004),UINT32_C(0x00000028),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 25 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000100),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 26 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000110),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 27 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000110),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 28 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000120),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 29 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 30 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 31 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 32 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 33 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000208),UINT32_C(0x00000000),UINT32_C(0x00000010) }},
/* 34 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000010) }},
/* 35 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 36 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x40000040) }},
/* 37 */ {{ UINT32_C(0x00000000),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 38 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000002) }},
/* 39 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000800),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 40 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000800),UINT32_C(0x00000000),UINT32_C(0x00000040) }},
/* 41 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000800),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 42 */ {{ UINT32_C(0x00000000),UINT32_C(0x00002000),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 43 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000a00),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 44 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000800),UINT32_C(0x00000000),UINT32_C(0x00000200) }},
/* 45 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000800),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 46 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000800),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 47 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 48 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 49 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 50 */ {{ UINT32_C(0x00000010),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 51 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000002) }},
/* 52 */ {{ UINT32_C(0x00000004),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 53 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000010) }},
/* 54 */ {{ UINT32_C(0x00000000),UINT32_C(0x40000011),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 55 */ {{ UINT32_C(0x00000000),UINT32_C(0x40000021),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 56 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x80000400) }},
/* 57 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000400) }},
/* 58 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x80000400) }},
/* 59 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00008000) }},
/* 60 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000004),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 61 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000004),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 62 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000004),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 63 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000024),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 64 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000004),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 65 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000024),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 66 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000005),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 67 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 68 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000200) }},
/* 69 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000200) }},
/* 70 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000000) }},
/* 71 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 72 */ {{ UINT32_C(0x00010000),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 73 */ {{ UINT32_C(0x00010000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 74 */ {{ UINT32_C(0x00010000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 75 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000040),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 76 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000040),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 77 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000060),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 78 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000011),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 79 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000021),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 80 */ {{ UINT32_C(0x00010001),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 81 */ {{ UINT32_C(0x00000010),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 82 */ {{ UINT32_C(0x00000400),UINT32_C(0x00001020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 83 */ {{ UINT32_C(0x00000020),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 84 */ {{ UINT32_C(0x00000000),UINT32_C(0x00001020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 85 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000040) }},
/* 86 */ {{ UINT32_C(0x00000020),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x40000020) }},
/* 87 */ {{ UINT32_C(0x00000020),UINT32_C(0x00002000),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 88 */ {{ UINT32_C(0x00000001),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x40000020) }},
/* 89 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 90 */ {{ UINT32_C(0x00000a00),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000002) }},
/* 91 */ {{ UINT32_C(0x00000a00),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 92 */ {{ UINT32_C(0x00000010),UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 93 */ {{ UINT32_C(0x00000a00),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 94 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000002),UINT32_C(0x00000000),UINT32_C(0x40000040) }},
/* 95 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 96 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 97 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000100),UINT32_C(0x00000000),UINT32_C(0x00000001) }},
/* 98 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000002),UINT32_C(0x00000000),UINT32_C(0x40000010) }},
/* 99 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000002),UINT32_C(0x00000000),UINT32_C(0x00000020) }},
/* 100 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000004) }},
/* 101 */ {{ UINT32_C(0x00002006),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 102 */ {{ UINT32_C(0x00002006),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 103 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x40000010) }},
/* 104 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000040) }},
/* 105 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000040) }},
/* 106 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x80000040) }},
/* 107 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000002) }},
/* 108 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 109 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000010) }},
/* 110 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000040) }},
/* 111 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000100),UINT32_C(0x00000000),UINT32_C(0x00000008) }},
/* 112 */ {{ UINT32_C(0x00000000),UINT32_C(0x00004000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 113 */ {{ UINT32_C(0x00002004),UINT32_C(0x00004000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 114 */ {{ UINT32_C(0x00000000),UINT32_C(0x00005000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 115 */ {{ UINT32_C(0x00001010),UINT32_C(0x00004000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 116 */ {{ UINT32_C(0x00001020),UINT32_C(0x00004020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 117 */ {{ UINT32_C(0x00001010),UINT32_C(0x00004020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 118 */ {{ UINT32_C(0x00000020),UINT32_C(0x00005000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 119 */ {{ UINT32_C(0x00000000),UINT32_C(0x00004020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 120 */ {{ UINT32_C(0x00000000),UINT32_C(0x00004800),UINT32_C(0x00000000),UINT32_C(0x00000040) }},
/* 121 */ {{ UINT32_C(0x00000000),UINT32_C(0x00004820),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 122 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000800) }},
/* 123 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000800) }},
/* 124 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000800) }},
/* 125 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 126 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 127 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 128 */ {{ UINT32_C(0x00000000),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 129 */ {{ UINT32_C(0x00000020),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 130 */ {{ UINT32_C(0x00002004),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 131 */ {{ UINT32_C(0x00002006),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000080) }},
/* 132 */ {{ UINT32_C(0x00000000),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 133 */ {{ UINT32_C(0x00000040),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 134 */ {{ UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 135 */ {{ UINT32_C(0x00000020),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 136 */ {{ UINT32_C(0x00000010),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 137 */ {{ UINT32_C(0x00000020),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 138 */ {{ UINT32_C(0x00000000),UINT32_C(0x00008020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 139 */ {{ UINT32_C(0x00000020),UINT32_C(0x00001000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 140 */ {{ UINT32_C(0x00002004),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 141 */ {{ UINT32_C(0x00002006),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 142 */ {{ UINT32_C(0x00001004),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 143 */ {{ UINT32_C(0x00001020),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 144 */ {{ UINT32_C(0x00001020),UINT32_C(0x00008020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 145 */ {{ UINT32_C(0x00001010),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 146 */ {{ UINT32_C(0x00002005),UINT32_C(0x00008000),UINT32_C(0x00000000),UINT32_C(0x00000100) }},
/* 147 */ {{ UINT32_C(0x00000040),UINT32_C(0x00010000),UINT32_C(0x00000000),UINT32_C(0x00000200) }},
/* 148 */ {{ UINT32_C(0x00000000),UINT32_C(0x00010000),UINT32_C(0x00000000),UINT32_C(0x00000200) }},
/* 149 */ {{ UINT32_C(0x00000000),UINT32_C(0x00020000),UINT32_C(0x00000000),UINT32_C(0x80000000) }},
/* 150 */ {{ UINT32_C(0x00000000),UINT32_C(0x00020000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 151 */ {{ UINT32_C(0x00000010),UINT32_C(0x00020010),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 152 */ {{ UINT32_C(0x00000020),UINT32_C(0x00020020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 153 */ {{ UINT32_C(0x00000040),UINT32_C(0x00020010),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 154 */ {{ UINT32_C(0x00000040),UINT32_C(0x00020020),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 155 */ {{ UINT32_C(0x00000020),UINT32_C(0x00041000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 156 */ {{ UINT32_C(0x00000000),UINT32_C(0x00040000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 157 */ {{ UINT32_C(0x00000000),UINT32_C(0x00080000),UINT32_C(0x00000000),UINT32_C(0x80000000) }},
/* 158 */ {{ UINT32_C(0x00000020),UINT32_C(0x00080000),UINT32_C(0x00000000),UINT32_C(0x80000000) }},
/* 159 */ {{ UINT32_C(0x00000010),UINT32_C(0x00080000),UINT32_C(0x00000000),UINT32_C(0x80000000) }},
/* 160 */ {{ UINT32_C(0x00000000),UINT32_C(0x00100000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 161 */ {{ UINT32_C(0x00000000),UINT32_C(0x00100020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 162 */ {{ UINT32_C(0x00000010),UINT32_C(0x00100000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 163 */ {{ UINT32_C(0x00002004),UINT32_C(0x00100000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 164 */ {{ UINT32_C(0x00002004),UINT32_C(0x00100020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 165 */ {{ UINT32_C(0x00000020),UINT32_C(0x00100000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 166 */ {{ UINT32_C(0x00000008),UINT32_C(0x00100000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 167 */ {{ UINT32_C(0x00000000),UINT32_C(0x00200000),UINT32_C(0x00000000),UINT32_C(0x00000000) }},
/* 168 */ {{ UINT32_C(0x00000000),UINT32_C(0x00200020),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
/* 169 */ {{ UINT32_C(0x00000008),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000800) }},
/* 170 */ {{ UINT32_C(0x00000010),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000800) }},
/* 171 */ {{ UINT32_C(0x00000020),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00000c00) }},
/* 172 */ {{ UINT32_C(0x00000020),UINT32_C(0x00002000),UINT32_C(0x00000000),UINT32_C(0x40000020) }},
/* 173 */ {{ UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000800) }},
/* 174 */ {{ UINT32_C(0x00000000),UINT32_C(0x00004000),UINT32_C(0x00000000),UINT32_C(0x00001000) }},
/* 175 */ {{ UINT32_C(0x00000000),UINT32_C(0x00800000),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 176 */ {{ UINT32_C(0x00000040),UINT32_C(0x00800000),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 177 */ {{ UINT32_C(0x00000080),UINT32_C(0x00800000),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 178 */ {{ UINT32_C(0x00000000),UINT32_C(0x00800020),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 179 */ {{ UINT32_C(0x00000010),UINT32_C(0x00800000),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 180 */ {{ UINT32_C(0x00000020),UINT32_C(0x00800020),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 181 */ {{ UINT32_C(0x00000020),UINT32_C(0x00800000),UINT32_C(0x40000000),UINT32_C(0x00002000) }},
/* 182 */ {{ UINT32_C(0x00000000),UINT32_C(0x02000000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 183 */ {{ UINT32_C(0x00000000),UINT32_C(0x00800000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 184 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000001),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 185 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x40000000),UINT32_C(0x80000008) }},
/* 186 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x40000000),UINT32_C(0x80000400) }},
/* 187 */ {{ UINT32_C(0x00000000),UINT32_C(0x00400000),UINT32_C(0x40000000),UINT32_C(0x80000000) }},
/* 188 */ {{ UINT32_C(0x00000000),UINT32_C(0x01000000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 189 */ {{ UINT32_C(0x00000000),UINT32_C(0x20000000),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 190 */ {{ UINT32_C(0x00000000),UINT32_C(0x20000010),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 191 */ {{ UINT32_C(0x00000000),UINT32_C(0x20000020),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 192 */ {{ UINT32_C(0x00000000),UINT32_C(0x20000400),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 193 */ {{ UINT32_C(0x00000000),UINT32_C(0x04000000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 194 */ {{ UINT32_C(0x00000000),UINT32_C(0x04000020),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 195 */ {{ UINT32_C(0x00000000),UINT32_C(0x10000000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 196 */ {{ UINT32_C(0x00000000),UINT32_C(0x10000020),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 197 */ {{ UINT32_C(0x00000000),UINT32_C(0x08000000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 198 */ {{ UINT32_C(0x00000000),UINT32_C(0x08000020),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 199 */ {{ UINT32_C(0x00000000),UINT32_C(0x04000000),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 200 */ {{ UINT32_C(0x00000000),UINT32_C(0x04000020),UINT32_C(0x00000000),UINT32_C(0x00004000) }},
/* 201 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000040),UINT32_C(0x00004000) }},
/* 202 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000080),UINT32_C(0x00000010),UINT32_C(0x00004000) }},
/* 203 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00004000) }},
/* 204 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000010),UINT32_C(0x00000010),UINT32_C(0x00004000) }},
/* 205 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00000010),UINT32_C(0x00004000) }},
/* 206 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000090),UINT32_C(0x00000010),UINT32_C(0x00004000) }},
/* 207 */ {{ UINT32_C(0x00000000),UINT32_C(0x000000a0),UINT32_C(0x00000010),UINT32_C(0x00004000) }},
/* 208 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x40000000),UINT32_C(0x00004000) }},
/* 209 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00004000) }},
/* 210 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000081),UINT32_C(0x00004000) }},
/* 211 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000001),UINT32_C(0x00004000) }},
/* 212 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000180),UINT32_C(0x00004000) }},
/* 213 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000100),UINT32_C(0x00004000) }},
/* 214 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000280),UINT32_C(0x00004000) }},
/* 215 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000200),UINT32_C(0x00004000) }},
/* 216 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000004),UINT32_C(0x00004000) }},
/* 217 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000008),UINT32_C(0x00004000) }},
/* 218 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000082),UINT32_C(0x00004000) }},
/* 219 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000002),UINT32_C(0x00004000) }},
/* 220 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000880),UINT32_C(0x00004000) }},
/* 221 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000800),UINT32_C(0x00004000) }},
/* 222 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000480),UINT32_C(0x00004000) }},
/* 223 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80000400),UINT32_C(0x00004000) }},
/* 224 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000020),UINT32_C(0x00000000),UINT32_C(0x00004400) }},
/* 225 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x00000000),UINT32_C(0x80004000) }},
/* 226 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000200),UINT32_C(0x00000000),UINT32_C(0x00000040) }},
/* 227 */ {{ UINT32_C(0x00000000),UINT32_C(0x00000220),UINT32_C(0x00000000),UINT32_C(0x00000400) }},
};

View file

@ -1,160 +0,0 @@
#ifndef NASM_IFLAG_H
#define NASM_IFLAG_H
#include <inttypes.h>
#include <string.h>
#include "compiler.h"
int ilog2_32(uint32_t v);
#include "iflaggen.h"
#define IF_GENBIT(bit) (UINT32_C(1) << (bit))
static inline unsigned int iflag_test(const iflag_t *f, unsigned int bit)
{
unsigned int index = bit / 32;
return f->field[index] & (UINT32_C(1) << (bit - (index * 32)));
}
static inline void iflag_set(iflag_t *f, unsigned int bit)
{
unsigned int index = bit / 32;
f->field[index] |= (UINT32_C(1) << (bit - (index * 32)));
}
static inline void iflag_clear(iflag_t *f, unsigned int bit)
{
unsigned int index = bit / 32;
f->field[index] &= ~(UINT32_C(1) << (bit - (index * 32)));
}
static inline void iflag_clear_all(iflag_t *f)
{
memset(f, 0, sizeof(*f));
}
static inline void iflag_set_all(iflag_t *f)
{
memset(f, 0xff, sizeof(*f));
}
static inline int iflag_cmp(const iflag_t *a, const iflag_t *b)
{
int i;
for (i = sizeof(a->field) / sizeof(a->field[0]) - 1; i >= 0; i--) {
if (a->field[i] == b->field[i])
continue;
return (a->field[i] > b->field[i]) ? 1 : -1;
}
return 0;
}
static inline int iflag_cmp_cpu(const iflag_t *a, const iflag_t *b)
{
if (a->field[3] < b->field[3])
return -1;
else if (a->field[3] > b->field[3])
return 1;
return 0;
}
static inline unsigned int iflag_ffs(const iflag_t *a)
{
unsigned int i;
for (i = 0; i < sizeof(a->field) / sizeof(a->field[0]); i++) {
if (a->field[i])
return ilog2_32(a->field[i]) + (i * 32);
}
return 0;
}
#define IF_GEN_HELPER(name, op) \
static inline iflag_t iflag_##name(const iflag_t *a, const iflag_t *b) \
{ \
unsigned int i; \
iflag_t res; \
\
for (i = 0; i < sizeof(a->field) / sizeof(a->field[0]); i++) \
res.field[i] = a->field[i] op b->field[i]; \
\
return res; \
}
IF_GEN_HELPER(xor, ^)
/* Use this helper to test instruction template flags */
#define itemp_has(itemp, bit) iflag_test(&insns_flags[(itemp)->iflag_idx], bit)
/* Maximum processor level at moment */
#define IF_PLEVEL IF_IA64
/* Some helpers which are to work with predefined masks */
#define IF_SMASK \
(IF_GENBIT(IF_SB) |\
IF_GENBIT(IF_SW) |\
IF_GENBIT(IF_SD) |\
IF_GENBIT(IF_SQ) |\
IF_GENBIT(IF_SO) |\
IF_GENBIT(IF_SY) |\
IF_GENBIT(IF_SZ) |\
IF_GENBIT(IF_SIZE))
#define IF_ARMASK \
(IF_GENBIT(IF_AR0) |\
IF_GENBIT(IF_AR1) |\
IF_GENBIT(IF_AR2) |\
IF_GENBIT(IF_AR3) |\
IF_GENBIT(IF_AR4))
#define _itemp_smask(idx) (insns_flags[(idx)].field[0] & IF_SMASK)
#define _itemp_armask(idx) (insns_flags[(idx)].field[0] & IF_ARMASK)
#define _itemp_arg(idx) ((_itemp_armask(idx) >> IF_AR0) - 1)
#define itemp_smask(itemp) _itemp_smask((itemp)->iflag_idx)
#define itemp_arg(itemp) _itemp_arg((itemp)->iflag_idx)
#define itemp_armask(itemp) _itemp_armask((itemp)->iflag_idx)
static inline int iflag_cmp_cpu_level(const iflag_t *a, const iflag_t *b)
{
iflag_t v1 = *a;
iflag_t v2 = *b;
iflag_clear(&v1, IF_CYRIX);
iflag_clear(&v1, IF_AMD);
iflag_clear(&v2, IF_CYRIX);
iflag_clear(&v2, IF_AMD);
if (v1.field[3] < v2.field[3])
return -1;
else if (v1.field[3] > v2.field[3])
return 1;
return 0;
}
static inline iflag_t _iflag_pfmask(const iflag_t *a)
{
iflag_t r;
iflag_clear_all(&r);
if (iflag_test(a, IF_CYRIX))
iflag_set(&r, IF_CYRIX);
if (iflag_test(a, IF_AMD))
iflag_set(&r, IF_AMD);
return r;
}
#define iflag_pfmask(itemp) _iflag_pfmask(&insns_flags[(itemp)->iflag_idx])
#endif /* NASM_IFLAG_H */

View file

@ -1,92 +0,0 @@
/* This file is auto-generated. Don't edit. */
#ifndef NASM_IFLAGGEN_H
#define NASM_IFLAGGEN_H 1
#define IF_SM 0 /* Size match */
#define IF_SM2 1 /* Size match first two operands */
#define IF_SB 2 /* Unsized operands can't be non-byte */
#define IF_SW 3 /* Unsized operands can't be non-word */
#define IF_SD 4 /* Unsized operands can't be non-dword */
#define IF_SQ 5 /* Unsized operands can't be non-qword */
#define IF_SO 6 /* Unsized operands can't be non-oword */
#define IF_SY 7 /* Unsized operands can't be non-yword */
#define IF_SZ 8 /* Unsized operands can't be non-zword */
#define IF_SIZE 9 /* Unsized operands must match the bitsize */
#define IF_SX 10 /* Unsized operands not allowed */
#define IF_AR0 11 /* SB, SW, SD applies to argument 0 */
#define IF_AR1 12 /* SB, SW, SD applies to argument 1 */
#define IF_AR2 13 /* SB, SW, SD applies to argument 2 */
#define IF_AR3 14 /* SB, SW, SD applies to argument 3 */
#define IF_AR4 15 /* SB, SW, SD applies to argument 4 */
#define IF_OPT 16 /* Optimizing assembly only */
#define IF_PRIV 32 /* Privileged instruction */
#define IF_SMM 33 /* Only valid in SMM */
#define IF_PROT 34 /* Protected mode only */
#define IF_LOCK 35 /* Lockable if operand 0 is memory */
#define IF_NOLONG 36 /* Not available in long mode */
#define IF_LONG 37 /* Long mode */
#define IF_NOHLE 38 /* HLE prefixes forbidden */
#define IF_MIB 39 /* disassemble with split EA */
#define IF_BND 40 /* BND (0xF2) prefix available */
#define IF_UNDOC 41 /* Undocumented */
#define IF_HLE 42 /* HLE prefixed */
#define IF_FPU 43 /* FPU */
#define IF_MMX 44 /* MMX */
#define IF_3DNOW 45 /* 3DNow! */
#define IF_SSE 46 /* SSE (KNI, MMX2) */
#define IF_SSE2 47 /* SSE2 */
#define IF_SSE3 48 /* SSE3 (PNI) */
#define IF_VMX 49 /* VMX */
#define IF_SSSE3 50 /* SSSE3 */
#define IF_SSE4A 51 /* AMD SSE4a */
#define IF_SSE41 52 /* SSE4.1 */
#define IF_SSE42 53 /* SSE4.2 */
#define IF_SSE5 54 /* SSE5 */
#define IF_AVX 55 /* AVX (128b) */
#define IF_AVX2 56 /* AVX2 (256b) */
#define IF_FMA 57 /* */
#define IF_BMI1 58 /* */
#define IF_BMI2 59 /* */
#define IF_TBM 60 /* */
#define IF_RTM 61 /* */
#define IF_INVPCID 62 /* */
#define IF_AVX512 64 /* AVX-512F (512b) */
#define IF_AVX512CD 65 /* AVX-512 Conflict Detection */
#define IF_AVX512ER 66 /* AVX-512 Exponential and Reciprocal */
#define IF_AVX512PF 67 /* AVX-512 Prefetch */
#define IF_MPX 68 /* MPX */
#define IF_SHA 69 /* SHA */
#define IF_PREFETCHWT1 70 /* PREFETCHWT1 */
#define IF_AVX512VL 71 /* AVX-512 Vector Length Orthogonality */
#define IF_AVX512DQ 72 /* AVX-512 Dword and Qword */
#define IF_AVX512BW 73 /* AVX-512 Byte and Word */
#define IF_AVX512IFMA 74 /* AVX-512 IFMA instructions */
#define IF_AVX512VBMI 75 /* AVX-512 VBMI instructions */
#define IF_VEX 94 /* VEX or XOP encoded instruction */
#define IF_EVEX 95 /* EVEX encoded instruction */
#define IF_8086 96 /* 8086 */
#define IF_186 97 /* 186+ */
#define IF_286 98 /* 286+ */
#define IF_386 99 /* 386+ */
#define IF_486 100 /* 486+ */
#define IF_PENT 101 /* Pentium */
#define IF_P6 102 /* P6 */
#define IF_KATMAI 103 /* Katmai */
#define IF_WILLAMETTE 104 /* Willamette */
#define IF_PRESCOTT 105 /* Prescott */
#define IF_X86_64 106 /* x86-64 (long or legacy mode) */
#define IF_NEHALEM 107 /* Nehalem */
#define IF_WESTMERE 108 /* Westmere */
#define IF_SANDYBRIDGE 109 /* Sandy Bridge */
#define IF_FUTURE 110 /* Future processor (not yet disclosed) */
#define IF_IA64 111 /* IA64 (in x86 mode) */
#define IF_CYRIX 126 /* Cyrix-specific */
#define IF_AMD 127 /* AMD-specific */
typedef struct {
uint32_t field[4];
} iflag_t;
extern const iflag_t insns_flags[228];
#endif /* NASM_IFLAGGEN_H */

View file

@ -1,160 +0,0 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2010 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
#include "compiler.h"
#include "nasmlib.h"
#define ROUND(v, a, w) \
do { \
if (v & (((1 << w) - 1) << w)) { \
a += w; \
v >>= w; \
} \
} while (0)
#if defined(__GNUC__) && defined(__x86_64__)
int ilog2_32(uint32_t v)
{
int n;
__asm__("bsrl %1,%0"
: "=r" (n)
: "rm" (v), "0" (0));
return n;
}
#elif defined(__GNUC__) && defined(__i386__)
int ilog2_32(uint32_t v)
{
int n;
__asm__("bsrl %1,%0 ; jnz 1f ; xorl %0,%0\n"
"1:"
: "=&r" (n)
: "rm" (v));
return n;
}
#elif defined(HAVE_GNUC_4)
int ilog2_32(uint32_t v)
{
if (!v)
return 0;
return __builtin_clz(v) ^ 31;
}
#else
int ilog2_32(uint32_t v)
{
int p = 0;
ROUND(v, p, 16);
ROUND(v, p, 8);
ROUND(v, p, 4);
ROUND(v, p, 2);
ROUND(v, p, 1);
return p;
}
#endif
#if defined(__GNUC__) && defined(__x86_64__)
int ilog2_64(uint64_t v)
{
uint64_t n;
__asm__("bsrq %1,%0"
: "=r" (n)
: "rm" (v), "0" (UINT64_C(0)));
return n;
}
#elif defined(HAVE_GNUC_4)
int ilog2_64(uint64_t v)
{
if (!v)
return 0;
return __builtin_clzll(v) ^ 63;
}
#else
int ilog2_64(uint64_t vv)
{
int p = 0;
uint32_t v;
v = vv >> 32;
if (v)
p += 32;
else
v = vv;
ROUND(v, p, 16);
ROUND(v, p, 8);
ROUND(v, p, 4);
ROUND(v, p, 2);
ROUND(v, p, 1);
return p;
}
#endif
/*
* v == 0 ? 0 : is_power2(x) ? ilog2_X(v) : -1
*/
int alignlog2_32(uint32_t v)
{
if (unlikely(v & (v-1)))
return -1; /* invalid alignment */
return ilog2_32(v);
}
int alignlog2_64(uint64_t v)
{
if (unlikely(v & (v-1)))
return -1; /* invalid alignment */
return ilog2_64(v);
}

View file

@ -11,25 +11,19 @@
#include "nasm.h"
#include "tokens.h"
#include "iflag.h"
/* if changed, ITEMPLATE_END should be also changed accordingly */
struct itemplate {
enum opcode opcode; /* the token, passed from "parser.c" */
int operands; /* number of operands */
opflags_t opd[MAX_OPERANDS]; /* bit flags for operand types */
decoflags_t deco[MAX_OPERANDS]; /* bit flags for operand decorators */
const uint8_t *code; /* the code it assembles to */
uint32_t iflag_idx; /* some flags referenced by index */
enum opcode opcode; /* the token, passed from "parser.c" */
int operands; /* number of operands */
opflags_t opd[MAX_OPERANDS]; /* bit flags for operand types */
const uint8_t *code; /* the code it assembles to */
uint32_t flags; /* some flags */
};
/* Disassembler table structure */
/*
* If n == -1, then p points to another table of 256
* struct disasm_index, otherwise p points to a list of n
* struct itemplates to consider.
*/
/* If n == -1, then p points to another table of 256
struct disasm_index, otherwise p points to a list of n
struct itemplates to consider. */
struct disasm_index {
const void *p;
int n;
@ -38,7 +32,7 @@ struct disasm_index {
/* Tables for the assembler and disassembler, respectively */
extern const struct itemplate * const nasm_instructions[];
extern const struct disasm_index itable[256];
extern const struct disasm_index * const itable_vex[NASM_VEX_CLASSES][32][4];
extern const struct disasm_index * const itable_vex[2][32][8];
/* Common table for the byte codes */
extern const uint8_t nasm_bytecodes[];
@ -46,6 +40,96 @@ extern const uint8_t nasm_bytecodes[];
/*
* this define is used to signify the end of an itemplate
*/
#define ITEMPLATE_END {-1,-1,{-1,-1,-1,-1,-1},{-1,-1,-1,-1,-1},NULL,0}
#define ITEMPLATE_END {-1,-1,{-1,-1,-1},NULL,0}
#endif /* NASM_INSNS_H */
/*
* Instruction template flags. These specify which processor
* targets the instruction is eligible for, whether it is
* privileged or undocumented, and also specify extra error
* checking on the matching of the instruction.
*
* IF_SM stands for Size Match: any operand whose size is not
* explicitly specified by the template is `really' intended to be
* the same size as the first size-specified operand.
* Non-specification is tolerated in the input instruction, but
* _wrong_ specification is not.
*
* IF_SM2 invokes Size Match on only the first _two_ operands, for
* three-operand instructions such as SHLD: it implies that the
* first two operands must match in size, but that the third is
* required to be _unspecified_.
*
* IF_SB invokes Size Byte: operands with unspecified size in the
* template are really bytes, and so no non-byte specification in
* the input instruction will be tolerated. IF_SW similarly invokes
* Size Word, and IF_SD invokes Size Doubleword.
*
* (The default state if neither IF_SM nor IF_SM2 is specified is
* that any operand with unspecified size in the template is
* required to have unspecified size in the instruction too...)
*/
#define IF_SM 0x00000001UL /* size match */
#define IF_SM2 0x00000002UL /* size match first two operands */
#define IF_SB 0x00000004UL /* unsized operands can't be non-byte */
#define IF_SW 0x00000008UL /* unsized operands can't be non-word */
#define IF_SD 0x0000000CUL /* unsized operands can't be non-dword */
#define IF_SQ 0x00000010UL /* unsized operands can't be non-qword */
#define IF_SO 0x00000014UL /* unsized operands can't be non-oword */
#define IF_SY 0x00000018UL /* unsized operands can't be non-yword */
#define IF_SZ 0x00000038UL /* unsized operands must match the bitsize */
#define IF_SX 0x0000003CUL /* unsized operands not allowed */
#define IF_SMASK 0x0000003CUL /* mask for unsized argument size */
#define IF_AR0 0x00000040UL /* SB, SW, SD applies to argument 0 */
#define IF_AR1 0x00000080UL /* SB, SW, SD applies to argument 1 */
#define IF_AR2 0x000000C0UL /* SB, SW, SD applies to argument 2 */
#define IF_AR3 0x00000100UL /* SB, SW, SD applies to argument 3 */
#define IF_AR4 0x00000140UL /* SB, SW, SD applies to argument 4 */
#define IF_ARMASK 0x000001C0UL /* mask for unsized argument spec */
#define IF_ARSHFT 6 /* LSB in IF_ARMASK */
/* The next 3 bits aren't actually used for anything */
#define IF_PRIV 0x00000000UL /* it's a privileged instruction */
#define IF_SMM 0x00000000UL /* it's only valid in SMM */
#define IF_PROT 0x00000000UL /* it's protected mode only */
#define IF_NOLONG 0x00000800UL /* it's not available in long mode */
#define IF_UNDOC 0x00001000UL /* it's an undocumented instruction */
#define IF_FPU 0x00002000UL /* it's an FPU instruction */
#define IF_MMX 0x00004000UL /* it's an MMX instruction */
#define IF_3DNOW 0x00008000UL /* it's a 3DNow! instruction */
#define IF_SSE 0x00010000UL /* it's a SSE (KNI, MMX2) instruction */
#define IF_SSE2 0x00020000UL /* it's a SSE2 instruction */
#define IF_SSE3 0x00040000UL /* it's a SSE3 (PNI) instruction */
#define IF_VMX 0x00080000UL /* it's a VMX instruction */
#define IF_LONG 0x00100000UL /* long mode instruction */
#define IF_SSSE3 0x00200000UL /* it's an SSSE3 instruction */
#define IF_SSE4A 0x00400000UL /* AMD SSE4a */
#define IF_SSE41 0x00800000UL /* it's an SSE4.1 instruction */
#define IF_SSE42 0x00800000UL /* HACK NEED TO REORGANIZE THESE BITS */
#define IF_SSE5 0x00800000UL /* HACK NEED TO REORGANIZE THESE BITS */
#define IF_AVX 0x00800000UL /* HACK NEED TO REORGANIZE THESE BITS */
#define IF_FMA 0x00800000UL /* HACK NEED TO REORGANIZE THESE BITS */
#define IF_PMASK 0xFF000000UL /* the mask for processor types */
#define IF_PLEVEL 0x0F000000UL /* the mask for processor instr. level */
/* also the highest possible processor */
#define IF_PFMASK 0xF01FFF00UL /* the mask for disassembly "prefer" */
#define IF_8086 0x00000000UL /* 8086 instruction */
#define IF_186 0x01000000UL /* 186+ instruction */
#define IF_286 0x02000000UL /* 286+ instruction */
#define IF_386 0x03000000UL /* 386+ instruction */
#define IF_486 0x04000000UL /* 486+ instruction */
#define IF_PENT 0x05000000UL /* Pentium instruction */
#define IF_P6 0x06000000UL /* P6 instruction */
#define IF_KATMAI 0x07000000UL /* Katmai instructions */
#define IF_WILLAMETTE 0x08000000UL /* Willamette instructions */
#define IF_PRESCOTT 0x09000000UL /* Prescott instructions */
#define IF_X86_64 0x0A000000UL /* x86-64 instruction (long or legacy mode) */
#define IF_NEHALEM 0x0B000000UL /* Nehalem instruction */
#define IF_WESTMERE 0x0C000000UL /* Westmere instruction */
#define IF_SANDYBRIDGE 0x0D000000UL /* Sandy Bridge instruction */
#define IF_FUTURE 0x0E000000UL /* Future processor (not yet disclosed) */
#define IF_X64 (IF_LONG|IF_X86_64)
#define IF_IA64 0x0F000000UL /* IA64 instructions (in x86 mode) */
#define IF_CYRIX 0x10000000UL /* Cyrix-specific instruction */
#define IF_AMD 0x20000000UL /* AMD-specific instruction */
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,6 @@ enum opcode {
I_AAM,
I_AAS,
I_ADC,
I_ADCX,
I_ADD,
I_ADDPD,
I_ADDPS,
@ -21,7 +20,6 @@ enum opcode {
I_ADDSS,
I_ADDSUBPD,
I_ADDSUBPS,
I_ADOX,
I_AESDEC,
I_AESDECLAST,
I_AESENC,
@ -29,7 +27,6 @@ enum opcode {
I_AESIMC,
I_AESKEYGENASSIST,
I_AND,
I_ANDN,
I_ANDNPD,
I_ANDNPS,
I_ANDPD,
@ -37,28 +34,10 @@ enum opcode {
I_ARPL,
I_BB0_RESET,
I_BB1_RESET,
I_BEXTR,
I_BLCFILL,
I_BLCI,
I_BLCIC,
I_BLCMSK,
I_BLCS,
I_BLENDPD,
I_BLENDPS,
I_BLENDVPD,
I_BLENDVPS,
I_BLSFILL,
I_BLSI,
I_BLSIC,
I_BLSMSK,
I_BLSR,
I_BNDCL,
I_BNDCN,
I_BNDCU,
I_BNDLDX,
I_BNDMK,
I_BNDMOV,
I_BNDSTX,
I_BOUND,
I_BSF,
I_BSR,
@ -67,20 +46,16 @@ enum opcode {
I_BTC,
I_BTR,
I_BTS,
I_BZHI,
I_CALL,
I_CBW,
I_CDQ,
I_CDQE,
I_CLAC,
I_CLC,
I_CLD,
I_CLFLUSH,
I_CLFLUSHOPT,
I_CLGI,
I_CLI,
I_CLTS,
I_CLZERO,
I_CMC,
I_CMP,
I_CMPEQPD,
@ -175,7 +150,6 @@ enum opcode {
I_DT,
I_DW,
I_DY,
I_DZ,
I_EMMS,
I_ENTER,
I_EQU,
@ -279,9 +253,7 @@ enum opcode {
I_FXAM,
I_FXCH,
I_FXRSTOR,
I_FXRSTOR64,
I_FXSAVE,
I_FXSAVE64,
I_FXTRACT,
I_FYL2X,
I_FYL2XP1,
@ -377,7 +349,6 @@ enum opcode {
I_INVEPT,
I_INVLPG,
I_INVLPGA,
I_INVPCID,
I_INVVPID,
I_IRET,
I_IRETD,
@ -388,57 +359,6 @@ enum opcode {
I_JMP,
I_JMPE,
I_JRCXZ,
I_KADDB,
I_KADDD,
I_KADDQ,
I_KADDW,
I_KANDB,
I_KANDD,
I_KANDNB,
I_KANDND,
I_KANDNQ,
I_KANDNW,
I_KANDQ,
I_KANDW,
I_KMOVB,
I_KMOVD,
I_KMOVQ,
I_KMOVW,
I_KNOTB,
I_KNOTD,
I_KNOTQ,
I_KNOTW,
I_KORB,
I_KORD,
I_KORQ,
I_KORTESTB,
I_KORTESTD,
I_KORTESTQ,
I_KORTESTW,
I_KORW,
I_KSHIFTLB,
I_KSHIFTLD,
I_KSHIFTLQ,
I_KSHIFTLW,
I_KSHIFTRB,
I_KSHIFTRD,
I_KSHIFTRQ,
I_KSHIFTRW,
I_KTESTB,
I_KTESTD,
I_KTESTQ,
I_KTESTW,
I_KUNPCKBW,
I_KUNPCKDQ,
I_KUNPCKWD,
I_KXNORB,
I_KXNORD,
I_KXNORQ,
I_KXNORW,
I_KXORB,
I_KXORD,
I_KXORQ,
I_KXORW,
I_LAHF,
I_LAR,
I_LDDQU,
@ -484,7 +404,6 @@ enum opcode {
I_MINSD,
I_MINSS,
I_MONITOR,
I_MONITORX,
I_MONTMUL,
I_MOV,
I_MOVAPD,
@ -531,9 +450,7 @@ enum opcode {
I_MULPS,
I_MULSD,
I_MULSS,
I_MULX,
I_MWAIT,
I_MWAITX,
I_NEG,
I_NOP,
I_NOT,
@ -587,9 +504,7 @@ enum opcode {
I_PCMPGTW,
I_PCMPISTRI,
I_PCMPISTRM,
I_PDEP,
I_PDISTIB,
I_PEXT,
I_PEXTRB,
I_PEXTRD,
I_PEXTRQ,
@ -687,7 +602,6 @@ enum opcode {
I_PREFETCHT1,
I_PREFETCHT2,
I_PREFETCHW,
I_PREFETCHWT1,
I_PSADBW,
I_PSHUFB,
I_PSHUFD,
@ -739,14 +653,9 @@ enum opcode {
I_RCPPS,
I_RCPSS,
I_RCR,
I_RDFSBASE,
I_RDGSBASE,
I_RDM,
I_RDMSR,
I_RDPKRU,
I_RDPMC,
I_RDRAND,
I_RDSEED,
I_RDSHR,
I_RDTSC,
I_RDTSCP,
@ -757,13 +666,11 @@ enum opcode {
I_REST,
I_RESW,
I_RESY,
I_RESZ,
I_RET,
I_RETF,
I_RETN,
I_ROL,
I_ROR,
I_RORX,
I_ROUNDPD,
I_ROUNDPS,
I_ROUNDSD,
@ -778,7 +685,6 @@ enum opcode {
I_SAL,
I_SALC,
I_SAR,
I_SARX,
I_SBB,
I_SCASB,
I_SCASD,
@ -786,19 +692,10 @@ enum opcode {
I_SCASW,
I_SFENCE,
I_SGDT,
I_SHA1MSG1,
I_SHA1MSG2,
I_SHA1NEXTE,
I_SHA1RNDS4,
I_SHA256MSG1,
I_SHA256MSG2,
I_SHA256RNDS2,
I_SHL,
I_SHLD,
I_SHLX,
I_SHR,
I_SHRD,
I_SHRX,
I_SHUFPD,
I_SHUFPS,
I_SIDT,
@ -813,7 +710,6 @@ enum opcode {
I_SQRTPS,
I_SQRTSD,
I_SQRTSS,
I_STAC,
I_STC,
I_STD,
I_STGI,
@ -837,10 +733,7 @@ enum opcode {
I_SYSENTER,
I_SYSEXIT,
I_SYSRET,
I_T1MSKC,
I_TEST,
I_TZCNT,
I_TZMSK,
I_UCOMISD,
I_UCOMISS,
I_UD0,
@ -865,30 +758,15 @@ enum opcode {
I_VAESENCLAST,
I_VAESIMC,
I_VAESKEYGENASSIST,
I_VALIGND,
I_VALIGNQ,
I_VANDNPD,
I_VANDNPS,
I_VANDPD,
I_VANDPS,
I_VBLENDMPD,
I_VBLENDMPS,
I_VBLENDPD,
I_VBLENDPS,
I_VBLENDVPD,
I_VBLENDVPS,
I_VBROADCASTF128,
I_VBROADCASTF32X2,
I_VBROADCASTF32X4,
I_VBROADCASTF32X8,
I_VBROADCASTF64X2,
I_VBROADCASTF64X4,
I_VBROADCASTI128,
I_VBROADCASTI32X2,
I_VBROADCASTI32X4,
I_VBROADCASTI32X8,
I_VBROADCASTI64X2,
I_VBROADCASTI64X4,
I_VBROADCASTSD,
I_VBROADCASTSS,
I_VCMPEQPD,
@ -911,10 +789,6 @@ enum opcode {
I_VCMPFALSEPS,
I_VCMPFALSESD,
I_VCMPFALSESS,
I_VCMPFALSE_OQPD,
I_VCMPFALSE_OQPS,
I_VCMPFALSE_OQSD,
I_VCMPFALSE_OQSS,
I_VCMPFALSE_OSPD,
I_VCMPFALSE_OSPS,
I_VCMPFALSE_OSSD,
@ -927,10 +801,6 @@ enum opcode {
I_VCMPGE_OQPS,
I_VCMPGE_OQSD,
I_VCMPGE_OQSS,
I_VCMPGE_OSPD,
I_VCMPGE_OSPS,
I_VCMPGE_OSSD,
I_VCMPGE_OSSS,
I_VCMPGTPD,
I_VCMPGTPS,
I_VCMPGTSD,
@ -939,10 +809,6 @@ enum opcode {
I_VCMPGT_OQPS,
I_VCMPGT_OQSD,
I_VCMPGT_OQSS,
I_VCMPGT_OSPD,
I_VCMPGT_OSPS,
I_VCMPGT_OSSD,
I_VCMPGT_OSSS,
I_VCMPLEPD,
I_VCMPLEPS,
I_VCMPLESD,
@ -951,10 +817,6 @@ enum opcode {
I_VCMPLE_OQPS,
I_VCMPLE_OQSD,
I_VCMPLE_OQSS,
I_VCMPLE_OSPD,
I_VCMPLE_OSPS,
I_VCMPLE_OSSD,
I_VCMPLE_OSSS,
I_VCMPLTPD,
I_VCMPLTPS,
I_VCMPLTSD,
@ -963,10 +825,6 @@ enum opcode {
I_VCMPLT_OQPS,
I_VCMPLT_OQSD,
I_VCMPLT_OQSS,
I_VCMPLT_OSPD,
I_VCMPLT_OSPS,
I_VCMPLT_OSSD,
I_VCMPLT_OSSS,
I_VCMPNEQPD,
I_VCMPNEQPS,
I_VCMPNEQSD,
@ -979,10 +837,6 @@ enum opcode {
I_VCMPNEQ_OSPS,
I_VCMPNEQ_OSSD,
I_VCMPNEQ_OSSS,
I_VCMPNEQ_UQPD,
I_VCMPNEQ_UQPS,
I_VCMPNEQ_UQSD,
I_VCMPNEQ_UQSS,
I_VCMPNEQ_USPD,
I_VCMPNEQ_USPS,
I_VCMPNEQ_USSD,
@ -995,10 +849,6 @@ enum opcode {
I_VCMPNGE_UQPS,
I_VCMPNGE_UQSD,
I_VCMPNGE_UQSS,
I_VCMPNGE_USPD,
I_VCMPNGE_USPS,
I_VCMPNGE_USSD,
I_VCMPNGE_USSS,
I_VCMPNGTPD,
I_VCMPNGTPS,
I_VCMPNGTSD,
@ -1007,10 +857,6 @@ enum opcode {
I_VCMPNGT_UQPS,
I_VCMPNGT_UQSD,
I_VCMPNGT_UQSS,
I_VCMPNGT_USPD,
I_VCMPNGT_USPS,
I_VCMPNGT_USSD,
I_VCMPNGT_USSS,
I_VCMPNLEPD,
I_VCMPNLEPS,
I_VCMPNLESD,
@ -1019,10 +865,6 @@ enum opcode {
I_VCMPNLE_UQPS,
I_VCMPNLE_UQSD,
I_VCMPNLE_UQSS,
I_VCMPNLE_USPD,
I_VCMPNLE_USPS,
I_VCMPNLE_USSD,
I_VCMPNLE_USSS,
I_VCMPNLTPD,
I_VCMPNLTPS,
I_VCMPNLTSD,
@ -1031,18 +873,10 @@ enum opcode {
I_VCMPNLT_UQPS,
I_VCMPNLT_UQSD,
I_VCMPNLT_UQSS,
I_VCMPNLT_USPD,
I_VCMPNLT_USPS,
I_VCMPNLT_USSD,
I_VCMPNLT_USSS,
I_VCMPORDPD,
I_VCMPORDPS,
I_VCMPORDSD,
I_VCMPORDSS,
I_VCMPORD_QPD,
I_VCMPORD_QPS,
I_VCMPORD_QSD,
I_VCMPORD_QSS,
I_VCMPORD_SPD,
I_VCMPORD_SPS,
I_VCMPORD_SSD,
@ -1055,10 +889,6 @@ enum opcode {
I_VCMPTRUEPS,
I_VCMPTRUESD,
I_VCMPTRUESS,
I_VCMPTRUE_UQPD,
I_VCMPTRUE_UQPS,
I_VCMPTRUE_UQSD,
I_VCMPTRUE_UQSS,
I_VCMPTRUE_USPD,
I_VCMPTRUE_USPS,
I_VCMPTRUE_USSD,
@ -1067,61 +897,30 @@ enum opcode {
I_VCMPUNORDPS,
I_VCMPUNORDSD,
I_VCMPUNORDSS,
I_VCMPUNORD_QPD,
I_VCMPUNORD_QPS,
I_VCMPUNORD_QSD,
I_VCMPUNORD_QSS,
I_VCMPUNORD_SPD,
I_VCMPUNORD_SPS,
I_VCMPUNORD_SSD,
I_VCMPUNORD_SSS,
I_VCOMISD,
I_VCOMISS,
I_VCOMPRESSPD,
I_VCOMPRESSPS,
I_VCVTDQ2PD,
I_VCVTDQ2PS,
I_VCVTPD2DQ,
I_VCVTPD2PS,
I_VCVTPD2QQ,
I_VCVTPD2UDQ,
I_VCVTPD2UQQ,
I_VCVTPH2PS,
I_VCVTPS2DQ,
I_VCVTPS2PD,
I_VCVTPS2PH,
I_VCVTPS2QQ,
I_VCVTPS2UDQ,
I_VCVTPS2UQQ,
I_VCVTQQ2PD,
I_VCVTQQ2PS,
I_VCVTSD2SI,
I_VCVTSD2SS,
I_VCVTSD2USI,
I_VCVTSI2SD,
I_VCVTSI2SS,
I_VCVTSS2SD,
I_VCVTSS2SI,
I_VCVTSS2USI,
I_VCVTTPD2DQ,
I_VCVTTPD2QQ,
I_VCVTTPD2UDQ,
I_VCVTTPD2UQQ,
I_VCVTTPS2DQ,
I_VCVTTPS2QQ,
I_VCVTTPS2UDQ,
I_VCVTTPS2UQQ,
I_VCVTTSD2SI,
I_VCVTTSD2USI,
I_VCVTTSS2SI,
I_VCVTTSS2USI,
I_VCVTUDQ2PD,
I_VCVTUDQ2PS,
I_VCVTUQQ2PD,
I_VCVTUQQ2PS,
I_VCVTUSI2SD,
I_VCVTUSI2SS,
I_VDBPSADBW,
I_VDIVPD,
I_VDIVPS,
I_VDIVSD,
@ -1130,25 +929,8 @@ enum opcode {
I_VDPPS,
I_VERR,
I_VERW,
I_VEXP2PD,
I_VEXP2PS,
I_VEXPANDPD,
I_VEXPANDPS,
I_VEXTRACTF128,
I_VEXTRACTF32X4,
I_VEXTRACTF32X8,
I_VEXTRACTF64X2,
I_VEXTRACTF64X4,
I_VEXTRACTI128,
I_VEXTRACTI32X4,
I_VEXTRACTI32X8,
I_VEXTRACTI64X2,
I_VEXTRACTI64X4,
I_VEXTRACTPS,
I_VFIXUPIMMPD,
I_VFIXUPIMMPS,
I_VFIXUPIMMSD,
I_VFIXUPIMMSS,
I_VFMADD123PD,
I_VFMADD123PS,
I_VFMADD123SD,
@ -1289,48 +1071,15 @@ enum opcode {
I_VFNMSUBPS,
I_VFNMSUBSD,
I_VFNMSUBSS,
I_VFPCLASSPD,
I_VFPCLASSPS,
I_VFPCLASSSD,
I_VFPCLASSSS,
I_VFRCZPD,
I_VFRCZPS,
I_VFRCZSD,
I_VFRCZSS,
I_VGATHERDPD,
I_VGATHERDPS,
I_VGATHERPF0DPD,
I_VGATHERPF0DPS,
I_VGATHERPF0QPD,
I_VGATHERPF0QPS,
I_VGATHERPF1DPD,
I_VGATHERPF1DPS,
I_VGATHERPF1QPD,
I_VGATHERPF1QPS,
I_VGATHERQPD,
I_VGATHERQPS,
I_VGETEXPPD,
I_VGETEXPPS,
I_VGETEXPSD,
I_VGETEXPSS,
I_VGETMANTPD,
I_VGETMANTPS,
I_VGETMANTSD,
I_VGETMANTSS,
I_VHADDPD,
I_VHADDPS,
I_VHSUBPD,
I_VHSUBPS,
I_VINSERTF128,
I_VINSERTF32X4,
I_VINSERTF32X8,
I_VINSERTF64X2,
I_VINSERTF64X4,
I_VINSERTI128,
I_VINSERTI32X4,
I_VINSERTI32X8,
I_VINSERTI64X2,
I_VINSERTI64X4,
I_VINSERTPS,
I_VLDDQU,
I_VLDMXCSR,
@ -1344,7 +1093,6 @@ enum opcode {
I_VMAXSS,
I_VMCALL,
I_VMCLEAR,
I_VMFUNC,
I_VMINPD,
I_VMINPS,
I_VMINSD,
@ -1357,13 +1105,7 @@ enum opcode {
I_VMOVD,
I_VMOVDDUP,
I_VMOVDQA,
I_VMOVDQA32,
I_VMOVDQA64,
I_VMOVDQU,
I_VMOVDQU16,
I_VMOVDQU32,
I_VMOVDQU64,
I_VMOVDQU8,
I_VMOVHLPS,
I_VMOVHPD,
I_VMOVHPS,
@ -1404,7 +1146,6 @@ enum opcode {
I_VORPS,
I_VPABSB,
I_VPABSD,
I_VPABSQ,
I_VPABSW,
I_VPACKSSDW,
I_VPACKSSWB,
@ -1420,34 +1161,17 @@ enum opcode {
I_VPADDW,
I_VPALIGNR,
I_VPAND,
I_VPANDD,
I_VPANDN,
I_VPANDND,
I_VPANDNQ,
I_VPANDQ,
I_VPAVGB,
I_VPAVGW,
I_VPBLENDD,
I_VPBLENDMB,
I_VPBLENDMD,
I_VPBLENDMQ,
I_VPBLENDMW,
I_VPBLENDVB,
I_VPBLENDW,
I_VPBROADCASTB,
I_VPBROADCASTD,
I_VPBROADCASTMB2Q,
I_VPBROADCASTMW2D,
I_VPBROADCASTQ,
I_VPBROADCASTW,
I_VPCLMULHQHQDQ,
I_VPCLMULHQLQDQ,
I_VPCLMULLQHQDQ,
I_VPCLMULLQLQDQ,
I_VPCLMULQDQ,
I_VPCMOV,
I_VPCMPB,
I_VPCMPD,
I_VPCMPEQB,
I_VPCMPEQD,
I_VPCMPEQQ,
@ -1460,56 +1184,29 @@ enum opcode {
I_VPCMPGTW,
I_VPCMPISTRI,
I_VPCMPISTRM,
I_VPCMPQ,
I_VPCMPUB,
I_VPCMPUD,
I_VPCMPUQ,
I_VPCMPUW,
I_VPCMPW,
I_VPCOMB,
I_VPCOMD,
I_VPCOMPRESSD,
I_VPCOMPRESSQ,
I_VPCOMQ,
I_VPCOMUB,
I_VPCOMUD,
I_VPCOMUQ,
I_VPCOMUW,
I_VPCOMW,
I_VPCONFLICTD,
I_VPCONFLICTQ,
I_VPERM2F128,
I_VPERM2I128,
I_VPERMB,
I_VPERMD,
I_VPERMI2B,
I_VPERMI2D,
I_VPERMI2PD,
I_VPERMI2PS,
I_VPERMI2Q,
I_VPERMI2W,
I_VPERMIL2PD,
I_VPERMIL2PS,
I_VPERMILMO2PD,
I_VPERMILMO2PS,
I_VPERMILMZ2PD,
I_VPERMILMZ2PS,
I_VPERMILPD,
I_VPERMILPS,
I_VPERMPD,
I_VPERMPS,
I_VPERMQ,
I_VPERMT2B,
I_VPERMT2D,
I_VPERMT2PD,
I_VPERMT2PS,
I_VPERMT2Q,
I_VPERMT2W,
I_VPERMW,
I_VPEXPANDD,
I_VPEXPANDQ,
I_VPERMILTD2PD,
I_VPERMILTD2PS,
I_VPEXTRB,
I_VPEXTRD,
I_VPEXTRQ,
I_VPEXTRW,
I_VPGATHERDD,
I_VPGATHERDQ,
I_VPGATHERQD,
I_VPGATHERQQ,
I_VPHADDBD,
I_VPHADDBQ,
I_VPHADDBW,
@ -1536,8 +1233,6 @@ enum opcode {
I_VPINSRD,
I_VPINSRQ,
I_VPINSRW,
I_VPLZCNTD,
I_VPLZCNTQ,
I_VPMACSDD,
I_VPMACSDQH,
I_VPMACSDQL,
@ -1550,61 +1245,27 @@ enum opcode {
I_VPMACSWW,
I_VPMADCSSWD,
I_VPMADCSWD,
I_VPMADD52HUQ,
I_VPMADD52LUQ,
I_VPMADDUBSW,
I_VPMADDWD,
I_VPMASKMOVD,
I_VPMASKMOVQ,
I_VPMAXSB,
I_VPMAXSD,
I_VPMAXSQ,
I_VPMAXSW,
I_VPMAXUB,
I_VPMAXUD,
I_VPMAXUQ,
I_VPMAXUW,
I_VPMINSB,
I_VPMINSD,
I_VPMINSQ,
I_VPMINSW,
I_VPMINUB,
I_VPMINUD,
I_VPMINUQ,
I_VPMINUW,
I_VPMOVB2M,
I_VPMOVD2M,
I_VPMOVDB,
I_VPMOVDW,
I_VPMOVM2B,
I_VPMOVM2D,
I_VPMOVM2Q,
I_VPMOVM2W,
I_VPMOVMSKB,
I_VPMOVQ2M,
I_VPMOVQB,
I_VPMOVQD,
I_VPMOVQW,
I_VPMOVSDB,
I_VPMOVSDW,
I_VPMOVSQB,
I_VPMOVSQD,
I_VPMOVSQW,
I_VPMOVSWB,
I_VPMOVSXBD,
I_VPMOVSXBQ,
I_VPMOVSXBW,
I_VPMOVSXDQ,
I_VPMOVSXWD,
I_VPMOVSXWQ,
I_VPMOVUSDB,
I_VPMOVUSDW,
I_VPMOVUSQB,
I_VPMOVUSQD,
I_VPMOVUSQW,
I_VPMOVUSWB,
I_VPMOVW2M,
I_VPMOVWB,
I_VPMOVZXBD,
I_VPMOVZXBQ,
I_VPMOVZXBW,
@ -1616,31 +1277,15 @@ enum opcode {
I_VPMULHUW,
I_VPMULHW,
I_VPMULLD,
I_VPMULLQ,
I_VPMULLW,
I_VPMULTISHIFTQB,
I_VPMULUDQ,
I_VPOR,
I_VPORD,
I_VPORQ,
I_VPPERM,
I_VPROLD,
I_VPROLQ,
I_VPROLVD,
I_VPROLVQ,
I_VPRORD,
I_VPRORQ,
I_VPRORVD,
I_VPRORVQ,
I_VPROTB,
I_VPROTD,
I_VPROTQ,
I_VPROTW,
I_VPSADBW,
I_VPSCATTERDD,
I_VPSCATTERDQ,
I_VPSCATTERQD,
I_VPSCATTERQQ,
I_VPSHAB,
I_VPSHAD,
I_VPSHAQ,
@ -1659,22 +1304,12 @@ enum opcode {
I_VPSLLD,
I_VPSLLDQ,
I_VPSLLQ,
I_VPSLLVD,
I_VPSLLVQ,
I_VPSLLVW,
I_VPSLLW,
I_VPSRAD,
I_VPSRAQ,
I_VPSRAVD,
I_VPSRAVQ,
I_VPSRAVW,
I_VPSRAW,
I_VPSRLD,
I_VPSRLDQ,
I_VPSRLQ,
I_VPSRLVD,
I_VPSRLVQ,
I_VPSRLVW,
I_VPSRLW,
I_VPSUBB,
I_VPSUBD,
@ -1684,17 +1319,7 @@ enum opcode {
I_VPSUBUSB,
I_VPSUBUSW,
I_VPSUBW,
I_VPTERNLOGD,
I_VPTERNLOGQ,
I_VPTEST,
I_VPTESTMB,
I_VPTESTMD,
I_VPTESTMQ,
I_VPTESTMW,
I_VPTESTNMB,
I_VPTESTNMD,
I_VPTESTNMQ,
I_VPTESTNMW,
I_VPUNPCKHBW,
I_VPUNPCKHDQ,
I_VPUNPCKHQDQ,
@ -1704,64 +1329,14 @@ enum opcode {
I_VPUNPCKLQDQ,
I_VPUNPCKLWD,
I_VPXOR,
I_VPXORD,
I_VPXORQ,
I_VRANGEPD,
I_VRANGEPS,
I_VRANGESD,
I_VRANGESS,
I_VRCP14PD,
I_VRCP14PS,
I_VRCP14SD,
I_VRCP14SS,
I_VRCP28PD,
I_VRCP28PS,
I_VRCP28SD,
I_VRCP28SS,
I_VRCPPS,
I_VRCPSS,
I_VREDUCEPD,
I_VREDUCEPS,
I_VREDUCESD,
I_VREDUCESS,
I_VRNDSCALEPD,
I_VRNDSCALEPS,
I_VRNDSCALESD,
I_VRNDSCALESS,
I_VROUNDPD,
I_VROUNDPS,
I_VROUNDSD,
I_VROUNDSS,
I_VRSQRT14PD,
I_VRSQRT14PS,
I_VRSQRT14SD,
I_VRSQRT14SS,
I_VRSQRT28PD,
I_VRSQRT28PS,
I_VRSQRT28SD,
I_VRSQRT28SS,
I_VRSQRTPS,
I_VRSQRTSS,
I_VSCALEFPD,
I_VSCALEFPS,
I_VSCALEFSD,
I_VSCALEFSS,
I_VSCATTERDPD,
I_VSCATTERDPS,
I_VSCATTERPF0DPD,
I_VSCATTERPF0DPS,
I_VSCATTERPF0QPD,
I_VSCATTERPF0QPS,
I_VSCATTERPF1DPD,
I_VSCATTERPF1DPS,
I_VSCATTERPF1QPD,
I_VSCATTERPF1QPS,
I_VSCATTERQPD,
I_VSCATTERQPS,
I_VSHUFF32X4,
I_VSHUFF64X2,
I_VSHUFI32X4,
I_VSHUFI64X2,
I_VSHUFPD,
I_VSHUFPS,
I_VSQRTPD,
@ -1786,14 +1361,9 @@ enum opcode {
I_VZEROALL,
I_VZEROUPPER,
I_WBINVD,
I_WRFSBASE,
I_WRGSBASE,
I_WRMSR,
I_WRPKRU,
I_WRSHR,
I_XABORT,
I_XADD,
I_XBEGIN,
I_XBTS,
I_XCHG,
I_XCRYPTCBC,
@ -1801,7 +1371,6 @@ enum opcode {
I_XCRYPTCTR,
I_XCRYPTECB,
I_XCRYPTOFB,
I_XEND,
I_XGETBV,
I_XLAT,
I_XLATB,
@ -1809,22 +1378,11 @@ enum opcode {
I_XORPD,
I_XORPS,
I_XRSTOR,
I_XRSTOR64,
I_XRSTORS,
I_XRSTORS64,
I_XSAVE,
I_XSAVE64,
I_XSAVEC,
I_XSAVEC64,
I_XSAVEOPT,
I_XSAVEOPT64,
I_XSAVES,
I_XSAVES64,
I_XSETBV,
I_XSHA1,
I_XSHA256,
I_XSTORE,
I_XTEST,
I_CMOVcc,
I_Jcc,
I_SETcc,
@ -1832,8 +1390,6 @@ enum opcode {
};
#define MAX_INSLEN 16
#define NASM_VEX_CLASSES 3
#define NO_DECORATOR {0,0,0,0,0}
#define FIRST_COND_OPCODE I_CMOVcc
#endif /* NASM_INSNSI_H */

View file

@ -8,7 +8,6 @@ const char * const nasm_insn_names[] = {
"aam",
"aas",
"adc",
"adcx",
"add",
"addpd",
"addps",
@ -16,7 +15,6 @@ const char * const nasm_insn_names[] = {
"addss",
"addsubpd",
"addsubps",
"adox",
"aesdec",
"aesdeclast",
"aesenc",
@ -24,7 +22,6 @@ const char * const nasm_insn_names[] = {
"aesimc",
"aeskeygenassist",
"and",
"andn",
"andnpd",
"andnps",
"andpd",
@ -32,28 +29,10 @@ const char * const nasm_insn_names[] = {
"arpl",
"bb0_reset",
"bb1_reset",
"bextr",
"blcfill",
"blci",
"blcic",
"blcmsk",
"blcs",
"blendpd",
"blendps",
"blendvpd",
"blendvps",
"blsfill",
"blsi",
"blsic",
"blsmsk",
"blsr",
"bndcl",
"bndcn",
"bndcu",
"bndldx",
"bndmk",
"bndmov",
"bndstx",
"bound",
"bsf",
"bsr",
@ -62,20 +41,16 @@ const char * const nasm_insn_names[] = {
"btc",
"btr",
"bts",
"bzhi",
"call",
"cbw",
"cdq",
"cdqe",
"clac",
"clc",
"cld",
"clflush",
"clflushopt",
"clgi",
"cli",
"clts",
"clzero",
"cmc",
"cmp",
"cmpeqpd",
@ -170,7 +145,6 @@ const char * const nasm_insn_names[] = {
"dt",
"dw",
"dy",
"dz",
"emms",
"enter",
"equ",
@ -274,9 +248,7 @@ const char * const nasm_insn_names[] = {
"fxam",
"fxch",
"fxrstor",
"fxrstor64",
"fxsave",
"fxsave64",
"fxtract",
"fyl2x",
"fyl2xp1",
@ -372,7 +344,6 @@ const char * const nasm_insn_names[] = {
"invept",
"invlpg",
"invlpga",
"invpcid",
"invvpid",
"iret",
"iretd",
@ -383,57 +354,6 @@ const char * const nasm_insn_names[] = {
"jmp",
"jmpe",
"jrcxz",
"kaddb",
"kaddd",
"kaddq",
"kaddw",
"kandb",
"kandd",
"kandnb",
"kandnd",
"kandnq",
"kandnw",
"kandq",
"kandw",
"kmovb",
"kmovd",
"kmovq",
"kmovw",
"knotb",
"knotd",
"knotq",
"knotw",
"korb",
"kord",
"korq",
"kortestb",
"kortestd",
"kortestq",
"kortestw",
"korw",
"kshiftlb",
"kshiftld",
"kshiftlq",
"kshiftlw",
"kshiftrb",
"kshiftrd",
"kshiftrq",
"kshiftrw",
"ktestb",
"ktestd",
"ktestq",
"ktestw",
"kunpckbw",
"kunpckdq",
"kunpckwd",
"kxnorb",
"kxnord",
"kxnorq",
"kxnorw",
"kxorb",
"kxord",
"kxorq",
"kxorw",
"lahf",
"lar",
"lddqu",
@ -479,7 +399,6 @@ const char * const nasm_insn_names[] = {
"minsd",
"minss",
"monitor",
"monitorx",
"montmul",
"mov",
"movapd",
@ -526,9 +445,7 @@ const char * const nasm_insn_names[] = {
"mulps",
"mulsd",
"mulss",
"mulx",
"mwait",
"mwaitx",
"neg",
"nop",
"not",
@ -582,9 +499,7 @@ const char * const nasm_insn_names[] = {
"pcmpgtw",
"pcmpistri",
"pcmpistrm",
"pdep",
"pdistib",
"pext",
"pextrb",
"pextrd",
"pextrq",
@ -682,7 +597,6 @@ const char * const nasm_insn_names[] = {
"prefetcht1",
"prefetcht2",
"prefetchw",
"prefetchwt1",
"psadbw",
"pshufb",
"pshufd",
@ -734,14 +648,9 @@ const char * const nasm_insn_names[] = {
"rcpps",
"rcpss",
"rcr",
"rdfsbase",
"rdgsbase",
"rdm",
"rdmsr",
"rdpkru",
"rdpmc",
"rdrand",
"rdseed",
"rdshr",
"rdtsc",
"rdtscp",
@ -752,13 +661,11 @@ const char * const nasm_insn_names[] = {
"rest",
"resw",
"resy",
"resz",
"ret",
"retf",
"retn",
"rol",
"ror",
"rorx",
"roundpd",
"roundps",
"roundsd",
@ -773,7 +680,6 @@ const char * const nasm_insn_names[] = {
"sal",
"salc",
"sar",
"sarx",
"sbb",
"scasb",
"scasd",
@ -781,19 +687,10 @@ const char * const nasm_insn_names[] = {
"scasw",
"sfence",
"sgdt",
"sha1msg1",
"sha1msg2",
"sha1nexte",
"sha1rnds4",
"sha256msg1",
"sha256msg2",
"sha256rnds2",
"shl",
"shld",
"shlx",
"shr",
"shrd",
"shrx",
"shufpd",
"shufps",
"sidt",
@ -808,7 +705,6 @@ const char * const nasm_insn_names[] = {
"sqrtps",
"sqrtsd",
"sqrtss",
"stac",
"stc",
"std",
"stgi",
@ -832,10 +728,7 @@ const char * const nasm_insn_names[] = {
"sysenter",
"sysexit",
"sysret",
"t1mskc",
"test",
"tzcnt",
"tzmsk",
"ucomisd",
"ucomiss",
"ud0",
@ -860,30 +753,15 @@ const char * const nasm_insn_names[] = {
"vaesenclast",
"vaesimc",
"vaeskeygenassist",
"valignd",
"valignq",
"vandnpd",
"vandnps",
"vandpd",
"vandps",
"vblendmpd",
"vblendmps",
"vblendpd",
"vblendps",
"vblendvpd",
"vblendvps",
"vbroadcastf128",
"vbroadcastf32x2",
"vbroadcastf32x4",
"vbroadcastf32x8",
"vbroadcastf64x2",
"vbroadcastf64x4",
"vbroadcasti128",
"vbroadcasti32x2",
"vbroadcasti32x4",
"vbroadcasti32x8",
"vbroadcasti64x2",
"vbroadcasti64x4",
"vbroadcastsd",
"vbroadcastss",
"vcmpeqpd",
@ -906,10 +784,6 @@ const char * const nasm_insn_names[] = {
"vcmpfalseps",
"vcmpfalsesd",
"vcmpfalsess",
"vcmpfalse_oqpd",
"vcmpfalse_oqps",
"vcmpfalse_oqsd",
"vcmpfalse_oqss",
"vcmpfalse_ospd",
"vcmpfalse_osps",
"vcmpfalse_ossd",
@ -922,10 +796,6 @@ const char * const nasm_insn_names[] = {
"vcmpge_oqps",
"vcmpge_oqsd",
"vcmpge_oqss",
"vcmpge_ospd",
"vcmpge_osps",
"vcmpge_ossd",
"vcmpge_osss",
"vcmpgtpd",
"vcmpgtps",
"vcmpgtsd",
@ -934,10 +804,6 @@ const char * const nasm_insn_names[] = {
"vcmpgt_oqps",
"vcmpgt_oqsd",
"vcmpgt_oqss",
"vcmpgt_ospd",
"vcmpgt_osps",
"vcmpgt_ossd",
"vcmpgt_osss",
"vcmplepd",
"vcmpleps",
"vcmplesd",
@ -946,10 +812,6 @@ const char * const nasm_insn_names[] = {
"vcmple_oqps",
"vcmple_oqsd",
"vcmple_oqss",
"vcmple_ospd",
"vcmple_osps",
"vcmple_ossd",
"vcmple_osss",
"vcmpltpd",
"vcmpltps",
"vcmpltsd",
@ -958,10 +820,6 @@ const char * const nasm_insn_names[] = {
"vcmplt_oqps",
"vcmplt_oqsd",
"vcmplt_oqss",
"vcmplt_ospd",
"vcmplt_osps",
"vcmplt_ossd",
"vcmplt_osss",
"vcmpneqpd",
"vcmpneqps",
"vcmpneqsd",
@ -974,10 +832,6 @@ const char * const nasm_insn_names[] = {
"vcmpneq_osps",
"vcmpneq_ossd",
"vcmpneq_osss",
"vcmpneq_uqpd",
"vcmpneq_uqps",
"vcmpneq_uqsd",
"vcmpneq_uqss",
"vcmpneq_uspd",
"vcmpneq_usps",
"vcmpneq_ussd",
@ -990,10 +844,6 @@ const char * const nasm_insn_names[] = {
"vcmpnge_uqps",
"vcmpnge_uqsd",
"vcmpnge_uqss",
"vcmpnge_uspd",
"vcmpnge_usps",
"vcmpnge_ussd",
"vcmpnge_usss",
"vcmpngtpd",
"vcmpngtps",
"vcmpngtsd",
@ -1002,10 +852,6 @@ const char * const nasm_insn_names[] = {
"vcmpngt_uqps",
"vcmpngt_uqsd",
"vcmpngt_uqss",
"vcmpngt_uspd",
"vcmpngt_usps",
"vcmpngt_ussd",
"vcmpngt_usss",
"vcmpnlepd",
"vcmpnleps",
"vcmpnlesd",
@ -1014,10 +860,6 @@ const char * const nasm_insn_names[] = {
"vcmpnle_uqps",
"vcmpnle_uqsd",
"vcmpnle_uqss",
"vcmpnle_uspd",
"vcmpnle_usps",
"vcmpnle_ussd",
"vcmpnle_usss",
"vcmpnltpd",
"vcmpnltps",
"vcmpnltsd",
@ -1026,18 +868,10 @@ const char * const nasm_insn_names[] = {
"vcmpnlt_uqps",
"vcmpnlt_uqsd",
"vcmpnlt_uqss",
"vcmpnlt_uspd",
"vcmpnlt_usps",
"vcmpnlt_ussd",
"vcmpnlt_usss",
"vcmpordpd",
"vcmpordps",
"vcmpordsd",
"vcmpordss",
"vcmpord_qpd",
"vcmpord_qps",
"vcmpord_qsd",
"vcmpord_qss",
"vcmpord_spd",
"vcmpord_sps",
"vcmpord_ssd",
@ -1050,10 +884,6 @@ const char * const nasm_insn_names[] = {
"vcmptrueps",
"vcmptruesd",
"vcmptruess",
"vcmptrue_uqpd",
"vcmptrue_uqps",
"vcmptrue_uqsd",
"vcmptrue_uqss",
"vcmptrue_uspd",
"vcmptrue_usps",
"vcmptrue_ussd",
@ -1062,61 +892,30 @@ const char * const nasm_insn_names[] = {
"vcmpunordps",
"vcmpunordsd",
"vcmpunordss",
"vcmpunord_qpd",
"vcmpunord_qps",
"vcmpunord_qsd",
"vcmpunord_qss",
"vcmpunord_spd",
"vcmpunord_sps",
"vcmpunord_ssd",
"vcmpunord_sss",
"vcomisd",
"vcomiss",
"vcompresspd",
"vcompressps",
"vcvtdq2pd",
"vcvtdq2ps",
"vcvtpd2dq",
"vcvtpd2ps",
"vcvtpd2qq",
"vcvtpd2udq",
"vcvtpd2uqq",
"vcvtph2ps",
"vcvtps2dq",
"vcvtps2pd",
"vcvtps2ph",
"vcvtps2qq",
"vcvtps2udq",
"vcvtps2uqq",
"vcvtqq2pd",
"vcvtqq2ps",
"vcvtsd2si",
"vcvtsd2ss",
"vcvtsd2usi",
"vcvtsi2sd",
"vcvtsi2ss",
"vcvtss2sd",
"vcvtss2si",
"vcvtss2usi",
"vcvttpd2dq",
"vcvttpd2qq",
"vcvttpd2udq",
"vcvttpd2uqq",
"vcvttps2dq",
"vcvttps2qq",
"vcvttps2udq",
"vcvttps2uqq",
"vcvttsd2si",
"vcvttsd2usi",
"vcvttss2si",
"vcvttss2usi",
"vcvtudq2pd",
"vcvtudq2ps",
"vcvtuqq2pd",
"vcvtuqq2ps",
"vcvtusi2sd",
"vcvtusi2ss",
"vdbpsadbw",
"vdivpd",
"vdivps",
"vdivsd",
@ -1125,25 +924,8 @@ const char * const nasm_insn_names[] = {
"vdpps",
"verr",
"verw",
"vexp2pd",
"vexp2ps",
"vexpandpd",
"vexpandps",
"vextractf128",
"vextractf32x4",
"vextractf32x8",
"vextractf64x2",
"vextractf64x4",
"vextracti128",
"vextracti32x4",
"vextracti32x8",
"vextracti64x2",
"vextracti64x4",
"vextractps",
"vfixupimmpd",
"vfixupimmps",
"vfixupimmsd",
"vfixupimmss",
"vfmadd123pd",
"vfmadd123ps",
"vfmadd123sd",
@ -1284,48 +1066,15 @@ const char * const nasm_insn_names[] = {
"vfnmsubps",
"vfnmsubsd",
"vfnmsubss",
"vfpclasspd",
"vfpclassps",
"vfpclasssd",
"vfpclassss",
"vfrczpd",
"vfrczps",
"vfrczsd",
"vfrczss",
"vgatherdpd",
"vgatherdps",
"vgatherpf0dpd",
"vgatherpf0dps",
"vgatherpf0qpd",
"vgatherpf0qps",
"vgatherpf1dpd",
"vgatherpf1dps",
"vgatherpf1qpd",
"vgatherpf1qps",
"vgatherqpd",
"vgatherqps",
"vgetexppd",
"vgetexpps",
"vgetexpsd",
"vgetexpss",
"vgetmantpd",
"vgetmantps",
"vgetmantsd",
"vgetmantss",
"vhaddpd",
"vhaddps",
"vhsubpd",
"vhsubps",
"vinsertf128",
"vinsertf32x4",
"vinsertf32x8",
"vinsertf64x2",
"vinsertf64x4",
"vinserti128",
"vinserti32x4",
"vinserti32x8",
"vinserti64x2",
"vinserti64x4",
"vinsertps",
"vlddqu",
"vldmxcsr",
@ -1339,7 +1088,6 @@ const char * const nasm_insn_names[] = {
"vmaxss",
"vmcall",
"vmclear",
"vmfunc",
"vminpd",
"vminps",
"vminsd",
@ -1352,13 +1100,7 @@ const char * const nasm_insn_names[] = {
"vmovd",
"vmovddup",
"vmovdqa",
"vmovdqa32",
"vmovdqa64",
"vmovdqu",
"vmovdqu16",
"vmovdqu32",
"vmovdqu64",
"vmovdqu8",
"vmovhlps",
"vmovhpd",
"vmovhps",
@ -1399,7 +1141,6 @@ const char * const nasm_insn_names[] = {
"vorps",
"vpabsb",
"vpabsd",
"vpabsq",
"vpabsw",
"vpackssdw",
"vpacksswb",
@ -1415,34 +1156,17 @@ const char * const nasm_insn_names[] = {
"vpaddw",
"vpalignr",
"vpand",
"vpandd",
"vpandn",
"vpandnd",
"vpandnq",
"vpandq",
"vpavgb",
"vpavgw",
"vpblendd",
"vpblendmb",
"vpblendmd",
"vpblendmq",
"vpblendmw",
"vpblendvb",
"vpblendw",
"vpbroadcastb",
"vpbroadcastd",
"vpbroadcastmb2q",
"vpbroadcastmw2d",
"vpbroadcastq",
"vpbroadcastw",
"vpclmulhqhqdq",
"vpclmulhqlqdq",
"vpclmullqhqdq",
"vpclmullqlqdq",
"vpclmulqdq",
"vpcmov",
"vpcmpb",
"vpcmpd",
"vpcmpeqb",
"vpcmpeqd",
"vpcmpeqq",
@ -1455,56 +1179,29 @@ const char * const nasm_insn_names[] = {
"vpcmpgtw",
"vpcmpistri",
"vpcmpistrm",
"vpcmpq",
"vpcmpub",
"vpcmpud",
"vpcmpuq",
"vpcmpuw",
"vpcmpw",
"vpcomb",
"vpcomd",
"vpcompressd",
"vpcompressq",
"vpcomq",
"vpcomub",
"vpcomud",
"vpcomuq",
"vpcomuw",
"vpcomw",
"vpconflictd",
"vpconflictq",
"vperm2f128",
"vperm2i128",
"vpermb",
"vpermd",
"vpermi2b",
"vpermi2d",
"vpermi2pd",
"vpermi2ps",
"vpermi2q",
"vpermi2w",
"vpermil2pd",
"vpermil2ps",
"vpermilmo2pd",
"vpermilmo2ps",
"vpermilmz2pd",
"vpermilmz2ps",
"vpermilpd",
"vpermilps",
"vpermpd",
"vpermps",
"vpermq",
"vpermt2b",
"vpermt2d",
"vpermt2pd",
"vpermt2ps",
"vpermt2q",
"vpermt2w",
"vpermw",
"vpexpandd",
"vpexpandq",
"vpermiltd2pd",
"vpermiltd2ps",
"vpextrb",
"vpextrd",
"vpextrq",
"vpextrw",
"vpgatherdd",
"vpgatherdq",
"vpgatherqd",
"vpgatherqq",
"vphaddbd",
"vphaddbq",
"vphaddbw",
@ -1531,8 +1228,6 @@ const char * const nasm_insn_names[] = {
"vpinsrd",
"vpinsrq",
"vpinsrw",
"vplzcntd",
"vplzcntq",
"vpmacsdd",
"vpmacsdqh",
"vpmacsdql",
@ -1545,61 +1240,27 @@ const char * const nasm_insn_names[] = {
"vpmacsww",
"vpmadcsswd",
"vpmadcswd",
"vpmadd52huq",
"vpmadd52luq",
"vpmaddubsw",
"vpmaddwd",
"vpmaskmovd",
"vpmaskmovq",
"vpmaxsb",
"vpmaxsd",
"vpmaxsq",
"vpmaxsw",
"vpmaxub",
"vpmaxud",
"vpmaxuq",
"vpmaxuw",
"vpminsb",
"vpminsd",
"vpminsq",
"vpminsw",
"vpminub",
"vpminud",
"vpminuq",
"vpminuw",
"vpmovb2m",
"vpmovd2m",
"vpmovdb",
"vpmovdw",
"vpmovm2b",
"vpmovm2d",
"vpmovm2q",
"vpmovm2w",
"vpmovmskb",
"vpmovq2m",
"vpmovqb",
"vpmovqd",
"vpmovqw",
"vpmovsdb",
"vpmovsdw",
"vpmovsqb",
"vpmovsqd",
"vpmovsqw",
"vpmovswb",
"vpmovsxbd",
"vpmovsxbq",
"vpmovsxbw",
"vpmovsxdq",
"vpmovsxwd",
"vpmovsxwq",
"vpmovusdb",
"vpmovusdw",
"vpmovusqb",
"vpmovusqd",
"vpmovusqw",
"vpmovuswb",
"vpmovw2m",
"vpmovwb",
"vpmovzxbd",
"vpmovzxbq",
"vpmovzxbw",
@ -1611,31 +1272,15 @@ const char * const nasm_insn_names[] = {
"vpmulhuw",
"vpmulhw",
"vpmulld",
"vpmullq",
"vpmullw",
"vpmultishiftqb",
"vpmuludq",
"vpor",
"vpord",
"vporq",
"vpperm",
"vprold",
"vprolq",
"vprolvd",
"vprolvq",
"vprord",
"vprorq",
"vprorvd",
"vprorvq",
"vprotb",
"vprotd",
"vprotq",
"vprotw",
"vpsadbw",
"vpscatterdd",
"vpscatterdq",
"vpscatterqd",
"vpscatterqq",
"vpshab",
"vpshad",
"vpshaq",
@ -1654,22 +1299,12 @@ const char * const nasm_insn_names[] = {
"vpslld",
"vpslldq",
"vpsllq",
"vpsllvd",
"vpsllvq",
"vpsllvw",
"vpsllw",
"vpsrad",
"vpsraq",
"vpsravd",
"vpsravq",
"vpsravw",
"vpsraw",
"vpsrld",
"vpsrldq",
"vpsrlq",
"vpsrlvd",
"vpsrlvq",
"vpsrlvw",
"vpsrlw",
"vpsubb",
"vpsubd",
@ -1679,17 +1314,7 @@ const char * const nasm_insn_names[] = {
"vpsubusb",
"vpsubusw",
"vpsubw",
"vpternlogd",
"vpternlogq",
"vptest",
"vptestmb",
"vptestmd",
"vptestmq",
"vptestmw",
"vptestnmb",
"vptestnmd",
"vptestnmq",
"vptestnmw",
"vpunpckhbw",
"vpunpckhdq",
"vpunpckhqdq",
@ -1699,64 +1324,14 @@ const char * const nasm_insn_names[] = {
"vpunpcklqdq",
"vpunpcklwd",
"vpxor",
"vpxord",
"vpxorq",
"vrangepd",
"vrangeps",
"vrangesd",
"vrangess",
"vrcp14pd",
"vrcp14ps",
"vrcp14sd",
"vrcp14ss",
"vrcp28pd",
"vrcp28ps",
"vrcp28sd",
"vrcp28ss",
"vrcpps",
"vrcpss",
"vreducepd",
"vreduceps",
"vreducesd",
"vreducess",
"vrndscalepd",
"vrndscaleps",
"vrndscalesd",
"vrndscaless",
"vroundpd",
"vroundps",
"vroundsd",
"vroundss",
"vrsqrt14pd",
"vrsqrt14ps",
"vrsqrt14sd",
"vrsqrt14ss",
"vrsqrt28pd",
"vrsqrt28ps",
"vrsqrt28sd",
"vrsqrt28ss",
"vrsqrtps",
"vrsqrtss",
"vscalefpd",
"vscalefps",
"vscalefsd",
"vscalefss",
"vscatterdpd",
"vscatterdps",
"vscatterpf0dpd",
"vscatterpf0dps",
"vscatterpf0qpd",
"vscatterpf0qps",
"vscatterpf1dpd",
"vscatterpf1dps",
"vscatterpf1qpd",
"vscatterpf1qps",
"vscatterqpd",
"vscatterqps",
"vshuff32x4",
"vshuff64x2",
"vshufi32x4",
"vshufi64x2",
"vshufpd",
"vshufps",
"vsqrtpd",
@ -1781,14 +1356,9 @@ const char * const nasm_insn_names[] = {
"vzeroall",
"vzeroupper",
"wbinvd",
"wrfsbase",
"wrgsbase",
"wrmsr",
"wrpkru",
"wrshr",
"xabort",
"xadd",
"xbegin",
"xbts",
"xchg",
"xcryptcbc",
@ -1796,7 +1366,6 @@ const char * const nasm_insn_names[] = {
"xcryptctr",
"xcryptecb",
"xcryptofb",
"xend",
"xgetbv",
"xlat",
"xlatb",
@ -1804,22 +1373,11 @@ const char * const nasm_insn_names[] = {
"xorpd",
"xorps",
"xrstor",
"xrstor64",
"xrstors",
"xrstors64",
"xsave",
"xsave64",
"xsavec",
"xsavec64",
"xsaveopt",
"xsaveopt64",
"xsaves",
"xsaves64",
"xsetbv",
"xsha1",
"xsha256",
"xstore",
"xtest",
"cmov",
"j",
"set"

View file

@ -0,0 +1,201 @@
/*
* inttypes.h
*
* Small ersatz subset of <inttypes.h>, deriving the types from
* <limits.h>.
*
* Important: the preprocessor may truncate numbers too large for it.
* Therefore, test the signed types only ... truncation won't generate
* a 01111111... bit pattern.
*/
#ifndef INTTYPES_H
#define INTTYPES_H
#include <limits.h>
/*** 64-bit type: long or long long ***/
/* Some old versions of gcc <limits.h> omit LLONG_MAX */
#ifndef LLONG_MAX
# ifdef __LONG_LONG_MAX__
# define LLONG_MAX __LONG_LONG_MAX__
# else
# define LLONG_MAX 0 /* Assume long long is unusable */
# endif
#endif
#if LONG_MAX == 9223372036854775807L
/* long is 64 bits */
typedef signed long int64_t;
typedef unsigned long uint64_t;
#define _scn64 "l"
#define _pri64 "l"
#define INT64_C(x) x ## L
#define UINT64_C(x) x ## UL
#elif LLONG_MAX == 9223372036854775807LL
/* long long is 64 bits */
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#define _scn64 "ll"
#define _pri64 "ll"
#define INT64_C(x) x ## LL
#define UINT64_C(x) x ## ULL
#else
#error "Neither long nor long long is 64 bits in size"
#endif
/*** 32-bit type: int or long ***/
#if INT_MAX == 2147483647
/* int is 32 bits */
typedef signed int int32_t;
typedef unsigned int uint32_t;
#define _scn32 ""
#define _pri32 ""
#define INT32_C(x) x
#define UINT32_C(x) x ## U
#elif LONG_MAX == 2147483647L
/* long is 32 bits */
typedef signed long int32_t;
typedef unsigned long uint32_t;
#define _scn32 "l"
#define _pri32 "l"
#define INT32_C(x) x ## L
#define UINT32_C(x) x ## UL
#else
#error "Neither int nor long is 32 bits in size"
#endif
/*** 16-bit size: int or short ***/
#if INT_MAX == 32767
/* int is 16 bits */
typedef signed int int16_t;
typedef unsigned int uint16_t;
#define _scn16 ""
#define _pri16 ""
#define INT16_C(x) x
#define UINT16_C(x) x ## U
#elif SHRT_MAX == 32767
/* short is 16 bits */
typedef signed short int16_t;
typedef unsigned short uint16_t;
#define _scn16 "h"
#define _pri16 ""
#define INT16_C(x) x
#define UINT16_C(x) x ## U
#else
#error "Neither short nor int is 16 bits in size"
#endif
/*** 8-bit size: char ***/
#if SCHAR_MAX == 127
/* char is 8 bits */
typedef signed char int8_t;
typedef unsigned char uint8_t;
#define _scn8 "hh"
#define _pri8 ""
#define INT8_C(x) x
#define UINT8_C(x) x ## U
#else
#error "char is not 8 bits in size"
#endif
/* The rest of this is common to all models */
#define PRId8 _pri8 "d"
#define PRId16 _pri16 "d"
#define PRId32 _pri32 "d"
#define PRId64 _pri64 "d"
#define PRIi8 _pri8 "i"
#define PRIi16 _pri16 "i"
#define PRIi32 _pri32 "i"
#define PRIi64 _pri64 "i"
#define PRIo8 _pri8 "o"
#define PRIo16 _pri16 "o"
#define PRIo32 _pri32 "o"
#define PRIo64 _pri64 "o"
#define PRIu8 _pri8 "u"
#define PRIu16 _pri16 "u"
#define PRIu32 _pri32 "u"
#define PRIu64 _pri64 "u"
#define PRIx8 _pri8 "x"
#define PRIx16 _pri16 "x"
#define PRIx32 _pri32 "x"
#define PRIx64 _pri64 "x"
#define PRIX8 _pri8 "X"
#define PRIX16 _pri16 "X"
#define PRIX32 _pri32 "X"
#define PRIX64 _pri64 "X"
#define SCNd8 _scn8 "d"
#define SCNd16 _scn16 "d"
#define SCNd32 _scn32 "d"
#define SCNd64 _scn64 "d"
#define SCNi8 _scn8 "i"
#define SCNi16 _scn16 "i"
#define SCNi32 _scn32 "i"
#define SCNi64 _scn64 "i"
#define SCNo8 _scn8 "o"
#define SCNo16 _scn16 "o"
#define SCNo32 _scn32 "o"
#define SCNo64 _scn64 "o"
#define SCNu8 _scn8 "u"
#define SCNu16 _scn16 "u"
#define SCNu32 _scn32 "u"
#define SCNu64 _scn64 "u"
#define SCNx8 _scn8 "x"
#define SCNx16 _scn16 "x"
#define SCNx32 _scn32 "x"
#define SCNx64 _scn64 "x"
#define INT8_MIN INT8_C(-128)
#define INT8_MAX INT8_C(127)
#define UINT8_MAX UINT8_C(255)
#define INT16_MIN INT16_C(-32768)
#define INT16_MAX INT16_C(32767)
#define UINT16_MAX UINT16_C(65535)
#define INT32_MIN INT32_C(-2147483648)
#define INT32_MAX INT32_C(2147483647)
#define UINT32_MAX UINT32_C(4294967295)
#define INT64_MIN INT64_C(-9223372036854775808)
#define INT64_MAX INT64_C(9223372036854775807)
#define UINT64_MAX UINT64_C(18446744073709551615)
#endif /* INTTYPES_H */

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@ -41,15 +41,18 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <inttypes.h>
#include "inttypes.h"
#include "nasm.h"
#include "nasmlib.h"
#include "insns.h"
int globalbits = 0; /* defined in nasm.h, works better here for ASM+DISASM */
vefunc nasm_verror; /* Global error handling function */
static vefunc nasm_verror; /* Global error handling function */
#ifdef LOGALLOC
static FILE *logfp;
#endif
/* Uninitialized -> all zero by C spec */
const uint8_t zero_buffer[ZERO_BUF_SIZE];
@ -69,6 +72,11 @@ void tolower_init(void)
nasm_tolower_tab[i] = tolower(i);
}
void nasm_set_verror(vefunc ve)
{
nasm_verror = ve;
}
void nasm_error(int severity, const char *fmt, ...)
{
va_list ap;
@ -78,79 +86,121 @@ void nasm_error(int severity, const char *fmt, ...)
va_end(ap);
}
no_return nasm_fatal(int flags, const char *fmt, ...)
void nasm_init_malloc_error(void)
{
va_list ap;
va_start(ap, fmt);
nasm_verror(flags | ERR_FATAL, fmt, ap);
abort(); /* We should never get here */
}
no_return nasm_panic(int flags, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
nasm_verror(flags | ERR_PANIC, fmt, ap);
abort(); /* We should never get here */
}
no_return nasm_panic_from_macro(const char *file, int line)
{
nasm_panic(ERR_NOFILE, "Internal error at %s:%d\n", file, line);
#ifdef LOGALLOC
logfp = fopen("malloc.log", "w");
setvbuf(logfp, NULL, _IOLBF, BUFSIZ);
fprintf(logfp, "null pointer is %p\n", NULL);
#endif
}
#ifdef LOGALLOC
void *nasm_malloc_log(const char *file, int line, size_t size)
#else
void *nasm_malloc(size_t size)
#endif
{
void *p = malloc(size);
if (!p)
nasm_fatal(ERR_NOFILE, "out of memory");
nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory");
#ifdef LOGALLOC
else
fprintf(logfp, "%s %d malloc(%ld) returns %p\n",
file, line, (long)size, p);
#endif
return p;
}
#ifdef LOGALLOC
void *nasm_zalloc_log(const char *file, int line, size_t size)
#else
void *nasm_zalloc(size_t size)
#endif
{
void *p = calloc(size, 1);
if (!p)
nasm_fatal(ERR_NOFILE, "out of memory");
nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory");
#ifdef LOGALLOC
else
fprintf(logfp, "%s %d calloc(%ld, 1) returns %p\n",
file, line, (long)size, p);
#endif
return p;
}
#ifdef LOGALLOC
void *nasm_realloc_log(const char *file, int line, void *q, size_t size)
#else
void *nasm_realloc(void *q, size_t size)
#endif
{
void *p = q ? realloc(q, size) : malloc(size);
if (!p)
nasm_fatal(ERR_NOFILE, "out of memory");
nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory");
#ifdef LOGALLOC
else if (q)
fprintf(logfp, "%s %d realloc(%p,%ld) returns %p\n",
file, line, q, (long)size, p);
else
fprintf(logfp, "%s %d malloc(%ld) returns %p\n",
file, line, (long)size, p);
#endif
return p;
}
#ifdef LOGALLOC
void nasm_free_log(const char *file, int line, void *q)
#else
void nasm_free(void *q)
#endif
{
if (q)
if (q) {
#ifdef LOGALLOC
fprintf(logfp, "%s %d free(%p)\n", file, line, q);
#endif
free(q);
}
}
#ifdef LOGALLOC
char *nasm_strdup_log(const char *file, int line, const char *s)
#else
char *nasm_strdup(const char *s)
#endif
{
char *p;
int size = strlen(s) + 1;
p = malloc(size);
if (!p)
nasm_fatal(ERR_NOFILE, "out of memory");
nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory");
#ifdef LOGALLOC
else
fprintf(logfp, "%s %d strdup(%ld) returns %p\n",
file, line, (long)size, p);
#endif
strcpy(p, s);
return p;
}
#ifdef LOGALLOC
char *nasm_strndup_log(const char *file, int line, const char *s, size_t len)
#else
char *nasm_strndup(const char *s, size_t len)
#endif
{
char *p;
int size = len + 1;
p = malloc(size);
if (!p)
nasm_fatal(ERR_NOFILE, "out of memory");
nasm_error(ERR_FATAL | ERR_NOFILE, "out of memory");
#ifdef LOGALLOC
else
fprintf(logfp, "%s %d strndup(%ld) returns %p\n",
file, line, (long)size, p);
#endif
strncpy(p, s, len);
p[len] = '\0';
return p;
@ -158,17 +208,10 @@ char *nasm_strndup(const char *s, size_t len)
no_return nasm_assert_failed(const char *file, int line, const char *msg)
{
nasm_fatal(0, "assertion %s failed at %s:%d", msg, file, line);
nasm_error(ERR_FATAL, "assertion %s failed at %s:%d", msg, file, line);
exit(1);
}
void nasm_write(const void *ptr, size_t size, FILE *f)
{
size_t n = fwrite(ptr, 1, size, f);
if (n != size)
nasm_fatal(0, "unable to write output: %s", strerror(errno));
}
#ifndef nasm_stricmp
int nasm_stricmp(const char *s1, const char *s2)
{
@ -243,7 +286,8 @@ char *nasm_strsep(char **stringp, const char *delim)
#endif
#define lib_isnumchar(c) (nasm_isalnum(c) || (c) == '$' || (c) == '_')
#define lib_isnumchar(c) (nasm_isalnum(c) || (c) == '$' || (c) == '_')
#define numvalue(c) ((c)>='a' ? (c)-'a'+10 : (c)>='A' ? (c)-'A'+10 : (c)-'0')
static int radix_letter(char c)
{
@ -395,36 +439,38 @@ int64_t readstrnum(char *str, int length, bool *warn)
return charconst;
}
static int32_t next_seg;
void seg_init(void)
{
next_seg = 0;
}
int32_t seg_alloc(void)
{
static int32_t next_seg = 0;
int32_t this_seg = next_seg;
next_seg += 2;
return this_seg;
return (next_seg += 2) - 2;
}
#ifdef WORDS_LITTLEENDIAN
void fwriteint16_t(uint16_t data, FILE * fp)
{
nasm_write(&data, 2, fp);
fwrite(&data, 1, 2, fp);
}
void fwriteint32_t(uint32_t data, FILE * fp)
{
nasm_write(&data, 4, fp);
fwrite(&data, 1, 4, fp);
}
void fwriteint64_t(uint64_t data, FILE * fp)
{
nasm_write(&data, 8, fp);
fwrite(&data, 1, 8, fp);
}
void fwriteaddr(uint64_t data, int size, FILE * fp)
{
nasm_write(&data, size, fp);
fwrite(&data, 1, size, fp);
}
#else /* not WORDS_LITTLEENDIAN */
@ -433,42 +479,50 @@ void fwriteint16_t(uint16_t data, FILE * fp)
{
char buffer[2], *p = buffer;
WRITESHORT(p, data);
nasm_write(buffer, 2, fp);
fwrite(buffer, 1, 2, fp);
}
void fwriteint32_t(uint32_t data, FILE * fp)
{
char buffer[4], *p = buffer;
WRITELONG(p, data);
nasm_write(buffer, 4, fp);
fwrite(buffer, 1, 4, fp);
}
void fwriteint64_t(uint64_t data, FILE * fp)
{
char buffer[8], *p = buffer;
WRITEDLONG(p, data);
nasm_write(buffer, 8, fp);
fwrite(buffer, 1, 8, fp);
}
void fwriteaddr(uint64_t data, int size, FILE * fp)
{
char buffer[8], *p = buffer;
WRITEADDR(p, data, size);
nasm_write(buffer, size, fp);
fwrite(buffer, 1, size, fp);
}
#endif
void fwritezero(size_t bytes, FILE *fp)
size_t fwritezero(size_t bytes, FILE *fp)
{
size_t count = 0;
size_t blksize;
size_t rv;
while (bytes) {
blksize = (bytes < ZERO_BUF_SIZE) ? bytes : ZERO_BUF_SIZE;
nasm_write(zero_buffer, blksize, fp);
bytes -= blksize;
rv = fwrite(zero_buffer, 1, blksize, fp);
if (!rv)
break;
count += rv;
bytes -= rv;
}
return count;
}
void standard_extension(char *inname, char *outname, char *extension)
@ -505,14 +559,13 @@ void standard_extension(char *inname, char *outname, char *extension)
*/
static const char *prefix_names[] = {
"a16", "a32", "a64", "asp", "lock", "o16", "o32", "o64", "osp",
"rep", "repe", "repne", "repnz", "repz", "times", "wait",
"xacquire", "xrelease", "bnd"
"rep", "repe", "repne", "repnz", "repz", "times", "wait"
};
const char *prefix_name(int token)
{
unsigned int prefix = token-PREFIX_ENUM_START;
if (prefix >= ARRAY_SIZE(prefix_names))
if (prefix > elements(prefix_names))
return NULL;
return prefix_names[prefix];
@ -553,6 +606,44 @@ int bsii(const char *string, const char **array, int size)
return -1; /* we haven't got it :( */
}
static char *file_name = NULL;
static int32_t line_number = 0;
char *src_set_fname(char *newname)
{
char *oldname = file_name;
file_name = newname;
return oldname;
}
int32_t src_set_linnum(int32_t newline)
{
int32_t oldline = line_number;
line_number = newline;
return oldline;
}
int32_t src_get_linnum(void)
{
return line_number;
}
int src_get(int32_t *xline, char **xname)
{
if (!file_name || !*xname || strcmp(*xname, file_name)) {
nasm_free(*xname);
*xname = file_name ? nasm_strdup(file_name) : NULL;
*xline = line_number;
return -2;
}
if (*xline != line_number) {
int32_t tmp = line_number - *xline;
*xline = line_number;
return tmp;
}
return 0;
}
char *nasm_strcat(const char *one, const char *two)
{
char *rslt;
@ -599,106 +690,40 @@ char *nasm_zap_spaces_rev(char *p)
return p;
}
/* zap leading and trailing spaces */
char *nasm_trim_spaces(char *p)
{
p = nasm_zap_spaces_fwd(p);
nasm_zap_spaces_fwd(nasm_skip_word(p));
return p;
}
/*
* return the word extracted from a stream
* or NULL if nothing left
*/
char *nasm_get_word(char *p, char **tail)
{
char *word = nasm_skip_spaces(p);
char *next = nasm_skip_word(word);
if (word && *word) {
if (*next)
*next++ = '\0';
} else
word = next = NULL;
/* NOTE: the tail may start with spaces */
*tail = next;
return word;
}
/*
* Extract "opt=val" values from the stream and
* returns "opt"
*
* Exceptions:
* 1) If "=val" passed the NULL returned though
* you may continue handling the tail via "next"
* 2) If "=" passed the NULL is returned and "val"
* is set to NULL as well
*/
char *nasm_opt_val(char *p, char **val, char **next)
{
char *q, *nxt;
*val = *next = NULL;
p = nasm_get_word(p, &nxt);
if (!p)
return NULL;
q = strchr(p, '=');
if (q) {
if (q == p)
p = NULL;
*q++='\0';
if (*q) {
*val = q;
} else {
q = nasm_get_word(q + 1, &nxt);
if (q)
*val = q;
}
} else {
q = nasm_skip_spaces(nxt);
if (q && *q == '=') {
q = nasm_get_word(q + 1, &nxt);
if (q)
*val = q;
}
}
*next = nxt;
return p;
}
/*
* initialized data bytes length from opcode
*/
int idata_bytes(int opcode)
{
int ret;
switch (opcode) {
case I_DB:
return 1;
ret = 1;
break;
case I_DW:
return 2;
ret = 2;
break;
case I_DD:
return 4;
ret = 4;
break;
case I_DQ:
return 8;
ret = 8;
break;
case I_DT:
return 10;
ret = 10;
break;
case I_DO:
return 16;
ret = 16;
break;
case I_DY:
return 32;
case I_DZ:
return 64;
ret = 32;
break;
case I_none:
return -1;
ret = -1;
break;
default:
return 0;
ret = 0;
break;
}
return ret;
}

View file

@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@ -39,8 +39,7 @@
#define NASM_NASMLIB_H
#include "compiler.h"
#include <inttypes.h>
#include "inttypes.h"
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
@ -64,6 +63,15 @@ extern unsigned char nasm_tolower_tab[256];
#define nasm_isalnum(x) isalnum((unsigned char)(x))
#define nasm_isxdigit(x) isxdigit((unsigned char)(x))
/*
* If this is defined, the wrappers around malloc et al will
* transform into logging variants, which will cause NASM to create
* a file called `malloc.log' when run, and spew details of all its
* memory management into that. That can then be analysed to detect
* memory leaks and potentially other problems too.
*/
/* #define LOGALLOC */
/*
* -------------------------
* Error reporting functions
@ -73,41 +81,32 @@ extern unsigned char nasm_tolower_tab[256];
/*
* An error reporting function should look like this.
*/
void printf_func(2, 3) nasm_error(int severity, const char *fmt, ...);
no_return printf_func(2, 3) nasm_fatal(int flags, const char *fmt, ...);
no_return printf_func(2, 3) nasm_panic(int flags, const char *fmt, ...);
no_return nasm_panic_from_macro(const char *file, int line);
#define panic() nasm_panic_from_macro(__FILE__, __LINE__);
typedef void (*efunc) (int severity, const char *fmt, ...);
typedef void (*vefunc) (int severity, const char *fmt, va_list ap);
extern vefunc nasm_verror;
static inline vefunc nasm_set_verror(vefunc ve)
{
vefunc old_verror = nasm_verror;
nasm_verror = ve;
return old_verror;
}
#ifdef __GNUC__
void nasm_error(int severity, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
#else
void nasm_error(int severity, const char *fmt, ...);
#endif
void nasm_set_verror(vefunc);
/*
* These are the error severity codes which get passed as the first
* argument to an efunc.
*/
#define ERR_DEBUG 0x00000000 /* put out debugging message */
#define ERR_WARNING 0x00000001 /* warn only: no further action */
#define ERR_NONFATAL 0x00000002 /* terminate assembly after phase */
#define ERR_FATAL 0x00000006 /* instantly fatal: exit with error */
#define ERR_PANIC 0x00000007 /* internal error: panic instantly
#define ERR_DEBUG 0x00000008 /* put out debugging message */
#define ERR_WARNING 0x00000000 /* warn only: no further action */
#define ERR_NONFATAL 0x00000001 /* terminate assembly after phase */
#define ERR_FATAL 0x00000002 /* instantly fatal: exit with error */
#define ERR_PANIC 0x00000003 /* internal error: panic instantly
* and dump core for reference */
#define ERR_MASK 0x00000007 /* mask off the above codes */
#define ERR_MASK 0x0000000F /* mask off the above codes */
#define ERR_NOFILE 0x00000010 /* don't give source file name/line */
#define ERR_USAGE 0x00000020 /* print a usage message */
#define ERR_PASS1 0x00000040 /* only print this error on pass one */
#define ERR_PASS2 0x00000080
#define ERR_NO_SEVERITY 0x00000100 /* suppress printing severity */
#define ERR_PP_PRECOND 0x00000200 /* for preprocessor use */
#define ERR_PP_LISTMACRO 0x00000400 /* from preproc->error_list_macros() */
/*
* These codes define specific types of suppressible warning.
@ -116,10 +115,8 @@ static inline vefunc nasm_set_verror(vefunc ve)
#define ERR_WARN_MASK 0xFFFFF000 /* the mask for this feature */
#define ERR_WARN_SHR 12 /* how far to shift right */
#define WARN(x) ((x) << ERR_WARN_SHR)
#define WARN_IDX(x) (((x) & ERR_WARN_MASK) >> ERR_WARN_SHR)
#define WARN(x) ((x) << ERR_WARN_SHR)
#define ERR_WARN_TERM WARN( 0) /* treat warnings as errors */
#define ERR_WARN_MNP WARN( 1) /* macro-num-parameters warning */
#define ERR_WARN_MSR WARN( 2) /* macro self-reference */
#define ERR_WARN_MDP WARN( 3) /* macro default parameters check */
@ -132,12 +129,7 @@ static inline vefunc nasm_set_verror(vefunc ve)
#define ERR_WARN_FL_UNDERFLOW WARN( 9) /* FP underflow */
#define ERR_WARN_FL_TOOLONG WARN(10) /* FP too many digits */
#define ERR_WARN_USER WARN(11) /* %warning directives */
#define ERR_WARN_LOCK WARN(12) /* bad LOCK prefixes */
#define ERR_WARN_HLE WARN(13) /* bad HLE prefixes */
#define ERR_WARN_BND WARN(14) /* bad BND prefixes */
#define ERR_WARN_ZEXTRELOC WARN(15) /* relocation zero-extended */
#define ERR_WARN_PTR WARN(16) /* not a NASM keyword */
#define ERR_WARN_MAX 16 /* the highest numbered one */
#define ERR_WARN_MAX 11 /* the highest numbered one */
/*
* Wrappers around malloc, realloc and free. nasm_malloc will
@ -146,17 +138,28 @@ static inline vefunc nasm_set_verror(vefunc ve)
* passed a NULL pointer; nasm_free will do nothing if it is passed
* a NULL pointer.
*/
void nasm_init_malloc_error(void);
#ifndef LOGALLOC
void *nasm_malloc(size_t);
void *nasm_zalloc(size_t);
void *nasm_realloc(void *, size_t);
void nasm_free(void *);
char *nasm_strdup(const char *);
char *nasm_strndup(const char *, size_t);
/*
* Wrapper around fwrite() which fatal-errors on output failure.
*/
void nasm_write(const void *, size_t, FILE *);
#else
void *nasm_malloc_log(const char *, int, size_t);
void *nasm_zalloc_log(const char *, int, size_t);
void *nasm_realloc_log(const char *, int, void *, size_t);
void nasm_free_log(const char *, int, void *);
char *nasm_strdup_log(const char *, int, const char *);
char *nasm_strndup_log(const char *, int, const char *, size_t);
#define nasm_malloc(x) nasm_malloc_log(__FILE__,__LINE__,x)
#define nasm_zalloc(x) nasm_zalloc_log(__FILE__,__LINE__,x)
#define nasm_realloc(x,y) nasm_realloc_log(__FILE__,__LINE__,x,y)
#define nasm_free(x) nasm_free_log(__FILE__,__LINE__,x)
#define nasm_strdup(x) nasm_strdup_log(__FILE__,__LINE__,x)
#define nasm_strndup(x,y) nasm_strndup_log(__FILE__,__LINE__,x,y)
#endif
/*
* NASM assert failure
@ -201,8 +204,6 @@ int nasm_memicmp(const char *, const char *, size_t);
char *nasm_strsep(char **stringp, const char *delim);
#endif
/* This returns the numeric value of a given 'digit'. */
#define numvalue(c) ((c) >= 'a' ? (c) - 'a' + 10 : (c) >= 'A' ? (c) - 'A' + 10 : (c) - '0')
/*
* Convert a string into a number, using NASM number rules. Sets
@ -237,42 +238,24 @@ void standard_extension(char *inname, char *outname, char *extension);
* This is a useful #define which I keep meaning to use more often:
* the number of elements of a statically defined array.
*/
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#define elements(x) ( sizeof(x) / sizeof(*(x)) )
/*
* List handling
*
* list_for_each - regular iterator over list
* list_for_each_safe - the same but safe against list items removal
* list_last - find the last element in a list
*/
#define list_for_each(pos, head) \
for (pos = head; pos; pos = pos->next)
#define list_for_each_safe(pos, n, head) \
for (pos = head, n = (pos ? pos->next : NULL); pos; \
pos = n, n = (n ? n->next : NULL))
#define list_last(pos, head) \
for (pos = head; pos && pos->next; pos = pos->next) \
;
#define list_reverse(head, prev, next) \
do { \
if (!head || !head->next) \
break; \
prev = NULL; \
while (head) { \
next = head->next; \
head->next = prev; \
prev = head; \
head = next; \
} \
head = prev; \
} while (0)
/*
* Power of 2 align helpers
*/
#undef ALIGN_MASK /* Some BSD flavors define these in system headers */
#undef ALIGN
#define ALIGN_MASK(v, mask) (((v) + (mask)) & ~(mask))
#define ALIGN(v, a) ALIGN_MASK(v, (a) - 1)
#define IS_ALIGNED(v, a) (((v) & ((a) - 1)) == 0)
@ -392,24 +375,16 @@ void fwriteaddr(uint64_t data, int size, FILE * fp);
int bsi(const char *string, const char **array, int size);
int bsii(const char *string, const char **array, int size);
/*
* These functions are used to keep track of the source code file and name.
*/
void src_init(void);
void src_free(void);
const char *src_set_fname(const char *newname);
const char *src_get_fname(void);
char *src_set_fname(char *newname);
int32_t src_set_linnum(int32_t newline);
int32_t src_get_linnum(void);
/* Can be used when there is no need for the old information */
void src_set(int32_t line, const char *filename);
/*
* src_get gets both the source file name and line.
* src_get may be used if you simply want to know the source file and line.
* It is also used if you maintain private status about the source location
* It return 0 if the information was the same as the last time you
* checked, -2 if the name changed and (new-old) if just the line changed.
* checked, -1 if the name changed and (new-old) if just the line changed.
*/
int32_t src_get(int32_t *xline, const char **xname);
int src_get(int32_t *xline, char **xname);
char *nasm_strcat(const char *one, const char *two);
@ -417,26 +392,12 @@ char *nasm_skip_spaces(const char *p);
char *nasm_skip_word(const char *p);
char *nasm_zap_spaces_fwd(char *p);
char *nasm_zap_spaces_rev(char *p);
char *nasm_trim_spaces(char *p);
char *nasm_get_word(char *p, char **tail);
char *nasm_opt_val(char *p, char **opt, char **val);
/*
* Converts a relative pathname rel_path into an absolute path name.
*
* The buffer returned must be freed by the caller
*/
char *nasm_realpath(const char *rel_path);
const char *prefix_name(int);
#define ZERO_BUF_SIZE 4096 /* Default value */
#if defined(BUFSIZ) && (BUFSIZ > ZERO_BUF_SIZE)
# undef ZERO_BUF_SIZE
# define ZERO_BUF_SIZE BUFSIZ
#endif
#define ZERO_BUF_SIZE 4096
extern const uint8_t zero_buffer[ZERO_BUF_SIZE];
void fwritezero(size_t bytes, FILE *fp);
size_t fwritezero(size_t bytes, FILE *fp);
static inline bool overflow_general(int64_t value, int bytes)
{
@ -483,31 +444,9 @@ static inline bool overflow_unsigned(int64_t value, int bytes)
return value < vmin || value > vmax;
}
static inline int64_t signed_bits(int64_t value, int bits)
{
if (bits < 64) {
value &= ((int64_t)1 << bits) - 1;
if (value & (int64_t)1 << (bits - 1))
value |= (int64_t)((uint64_t)-1 << bits);
}
return value;
}
int idata_bytes(int opcode);
/* check if value is power of 2 */
#define is_power2(v) ((v) && ((v) & ((v) - 1)) == 0)
/*
* floor(log2(v))
*/
int ilog2_32(uint32_t v);
int ilog2_64(uint64_t v);
/*
* v == 0 ? 0 : is_power2(x) ? ilog2_X(v) : -1
*/
int alignlog2_32(uint32_t v);
int alignlog2_64(uint64_t v);
#endif

View file

@ -1,271 +1,239 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* opflags.h - operand flags
*/
#ifndef NASM_OPFLAGS_H
#define NASM_OPFLAGS_H
#include "compiler.h"
#include "tables.h" /* for opflags_t and nasm_reg_flags[] */
/*
* Here we define the operand types. These are implemented as bit
* masks, since some are subsets of others; e.g. AX in a MOV
* instruction is a special operand type, whereas AX in other
* contexts is just another 16-bit register. (Also, consider CL in
* shift instructions, DX in OUT, etc.)
*
* The basic concept here is that
* (class & ~operand) == 0
*
* if and only if "operand" belongs to class type "class".
*/
#define OP_GENMASK(bits, shift) (((UINT64_C(1) << (bits)) - 1) << (shift))
#define OP_GENBIT(bit, shift) (UINT64_C(1) << ((shift) + (bit)))
/*
* Type of operand: memory reference, register, etc.
*
* Bits: 0 - 3
*/
#define OPTYPE_SHIFT (0)
#define OPTYPE_BITS (4)
#define OPTYPE_MASK OP_GENMASK(OPTYPE_BITS, OPTYPE_SHIFT)
#define GEN_OPTYPE(bit) OP_GENBIT(bit, OPTYPE_SHIFT)
/*
* Modifiers.
*
* Bits: 4 - 6
*/
#define MODIFIER_SHIFT (4)
#define MODIFIER_BITS (3)
#define MODIFIER_MASK OP_GENMASK(MODIFIER_BITS, MODIFIER_SHIFT)
#define GEN_MODIFIER(bit) OP_GENBIT(bit, MODIFIER_SHIFT)
/*
* Register classes.
*
* Bits: 7 - 16
*/
#define REG_CLASS_SHIFT (7)
#define REG_CLASS_BITS (10)
#define REG_CLASS_MASK OP_GENMASK(REG_CLASS_BITS, REG_CLASS_SHIFT)
#define GEN_REG_CLASS(bit) OP_GENBIT(bit, REG_CLASS_SHIFT)
/*
* Subclasses. Depends on type of operand.
*
* Bits: 17 - 24
*/
#define SUBCLASS_SHIFT (17)
#define SUBCLASS_BITS (8)
#define SUBCLASS_MASK OP_GENMASK(SUBCLASS_BITS, SUBCLASS_SHIFT)
#define GEN_SUBCLASS(bit) OP_GENBIT(bit, SUBCLASS_SHIFT)
/*
* Special flags. Context dependant.
*
* Bits: 25 - 31
*/
#define SPECIAL_SHIFT (25)
#define SPECIAL_BITS (7)
#define SPECIAL_MASK OP_GENMASK(SPECIAL_BITS, SPECIAL_SHIFT)
#define GEN_SPECIAL(bit) OP_GENBIT(bit, SPECIAL_SHIFT)
/*
* Sizes of the operands and attributes.
*
* Bits: 32 - 42
*/
#define SIZE_SHIFT (32)
#define SIZE_BITS (11)
#define SIZE_MASK OP_GENMASK(SIZE_BITS, SIZE_SHIFT)
#define GEN_SIZE(bit) OP_GENBIT(bit, SIZE_SHIFT)
/*
* Bits distribution (counted from 0)
*
* 6 5 4 3 2 1
* 3210987654321098765432109876543210987654321098765432109876543210
* |
* | dword bound
*
* ............................................................1111 optypes
* .........................................................111.... modifiers
* ...............................................1111111111....... register classes
* .......................................11111111................. subclasses
* ................................1111111......................... specials
* .....................11111111111................................ sizes
*/
#define REGISTER GEN_OPTYPE(0) /* register number in 'basereg' */
#define IMMEDIATE GEN_OPTYPE(1)
#define REGMEM GEN_OPTYPE(2) /* for r/m, ie EA, operands */
#define MEMORY (GEN_OPTYPE(3) | REGMEM)
#define BITS8 GEN_SIZE(0) /* 8 bits (BYTE) */
#define BITS16 GEN_SIZE(1) /* 16 bits (WORD) */
#define BITS32 GEN_SIZE(2) /* 32 bits (DWORD) */
#define BITS64 GEN_SIZE(3) /* 64 bits (QWORD), x64 and FPU only */
#define BITS80 GEN_SIZE(4) /* 80 bits (TWORD), FPU only */
#define BITS128 GEN_SIZE(5) /* 128 bits (OWORD) */
#define BITS256 GEN_SIZE(6) /* 256 bits (YWORD) */
#define BITS512 GEN_SIZE(7) /* 512 bits (ZWORD) */
#define FAR GEN_SIZE(8) /* grotty: this means 16:16 or 16:32, like in CALL/JMP */
#define NEAR GEN_SIZE(9)
#define SHORT GEN_SIZE(10) /* and this means what it says :) */
#define TO GEN_MODIFIER(0) /* reverse effect in FADD, FSUB &c */
#define COLON GEN_MODIFIER(1) /* operand is followed by a colon */
#define STRICT GEN_MODIFIER(2) /* do not optimize this operand */
#define REG_CLASS_CDT GEN_REG_CLASS(0)
#define REG_CLASS_GPR GEN_REG_CLASS(1)
#define REG_CLASS_SREG GEN_REG_CLASS(2)
#define REG_CLASS_FPUREG GEN_REG_CLASS(3)
#define REG_CLASS_RM_MMX GEN_REG_CLASS(4)
#define REG_CLASS_RM_XMM GEN_REG_CLASS(5)
#define REG_CLASS_RM_YMM GEN_REG_CLASS(6)
#define REG_CLASS_RM_ZMM GEN_REG_CLASS(7)
#define REG_CLASS_OPMASK GEN_REG_CLASS(8)
#define REG_CLASS_BND GEN_REG_CLASS(9)
#define is_class(class, op) (!((opflags_t)(class) & ~(opflags_t)(op)))
#define is_reg_class(class, reg) is_class((class), nasm_reg_flags[(reg)])
#define IS_SREG(reg) is_reg_class(REG_SREG, (reg))
#define IS_FSGS(reg) is_reg_class(REG_FSGS, (reg))
/* Register classes */
#define REG_EA ( REGMEM | REGISTER) /* 'normal' reg, qualifies as EA */
#define RM_GPR ( REG_CLASS_GPR | REGMEM) /* integer operand */
#define REG_GPR ( REG_CLASS_GPR | REGMEM | REGISTER) /* integer register */
#define REG8 ( REG_CLASS_GPR | BITS8 | REGMEM | REGISTER) /* 8-bit GPR */
#define REG16 ( REG_CLASS_GPR | BITS16 | REGMEM | REGISTER) /* 16-bit GPR */
#define REG32 ( REG_CLASS_GPR | BITS32 | REGMEM | REGISTER) /* 32-bit GPR */
#define REG64 ( REG_CLASS_GPR | BITS64 | REGMEM | REGISTER) /* 64-bit GPR */
#define FPUREG ( REG_CLASS_FPUREG | REGISTER) /* floating point stack registers */
#define FPU0 (GEN_SUBCLASS(1) | REG_CLASS_FPUREG | REGISTER) /* FPU stack register zero */
#define RM_MMX ( REG_CLASS_RM_MMX | REGMEM) /* MMX operand */
#define MMXREG ( REG_CLASS_RM_MMX | REGMEM | REGISTER) /* MMX register */
#define RM_XMM ( REG_CLASS_RM_XMM | REGMEM) /* XMM (SSE) operand */
#define XMMREG ( REG_CLASS_RM_XMM | REGMEM | REGISTER) /* XMM (SSE) register */
#define RM_YMM ( REG_CLASS_RM_YMM | REGMEM) /* YMM (AVX) operand */
#define YMMREG ( REG_CLASS_RM_YMM | REGMEM | REGISTER) /* YMM (AVX) register */
#define RM_ZMM ( REG_CLASS_RM_ZMM | REGMEM) /* ZMM (AVX512) operand */
#define ZMMREG ( REG_CLASS_RM_ZMM | REGMEM | REGISTER) /* ZMM (AVX512) register */
#define RM_OPMASK ( REG_CLASS_OPMASK | REGMEM) /* Opmask operand */
#define OPMASKREG ( REG_CLASS_OPMASK | REGMEM | REGISTER) /* Opmask register */
#define OPMASK0 (GEN_SUBCLASS(1) | REG_CLASS_OPMASK | REGMEM | REGISTER) /* Opmask register zero (k0) */
#define RM_K RM_OPMASK
#define KREG OPMASKREG
#define RM_BND ( REG_CLASS_BND | REGMEM) /* Bounds operand */
#define BNDREG ( REG_CLASS_BND | REGMEM | REGISTER) /* Bounds register */
#define REG_CDT ( REG_CLASS_CDT | BITS32 | REGISTER) /* CRn, DRn and TRn */
#define REG_CREG (GEN_SUBCLASS(1) | REG_CLASS_CDT | BITS32 | REGISTER) /* CRn */
#define REG_DREG (GEN_SUBCLASS(2) | REG_CLASS_CDT | BITS32 | REGISTER) /* DRn */
#define REG_TREG (GEN_SUBCLASS(3) | REG_CLASS_CDT | BITS32 | REGISTER) /* TRn */
#define REG_SREG ( REG_CLASS_SREG | BITS16 | REGISTER) /* any segment register */
/* Segment registers */
#define REG_ES (GEN_SUBCLASS(0) | GEN_SUBCLASS(2) | REG_CLASS_SREG | BITS16 | REGISTER) /* ES */
#define REG_CS (GEN_SUBCLASS(1) | GEN_SUBCLASS(2) | REG_CLASS_SREG | BITS16 | REGISTER) /* CS */
#define REG_SS (GEN_SUBCLASS(0) | GEN_SUBCLASS(3) | REG_CLASS_SREG | BITS16 | REGISTER) /* SS */
#define REG_DS (GEN_SUBCLASS(1) | GEN_SUBCLASS(3) | REG_CLASS_SREG | BITS16 | REGISTER) /* DS */
#define REG_FS (GEN_SUBCLASS(0) | GEN_SUBCLASS(4) | REG_CLASS_SREG | BITS16 | REGISTER) /* FS */
#define REG_GS (GEN_SUBCLASS(1) | GEN_SUBCLASS(4) | REG_CLASS_SREG | BITS16 | REGISTER) /* GS */
#define REG_FSGS ( GEN_SUBCLASS(4) | REG_CLASS_SREG | BITS16 | REGISTER) /* FS or GS */
#define REG_SEG67 ( GEN_SUBCLASS(5) | REG_CLASS_SREG | BITS16 | REGISTER) /* Unimplemented segment registers */
/* Special GPRs */
#define REG_SMASK SUBCLASS_MASK /* a mask for the following */
#define REG_ACCUM (GEN_SUBCLASS(1) | REG_CLASS_GPR | REGMEM | REGISTER) /* accumulator: AL, AX, EAX, RAX */
#define REG_AL (GEN_SUBCLASS(1) | REG_CLASS_GPR | BITS8 | REGMEM | REGISTER)
#define REG_AX (GEN_SUBCLASS(1) | REG_CLASS_GPR | BITS16 | REGMEM | REGISTER)
#define REG_EAX (GEN_SUBCLASS(1) | REG_CLASS_GPR | BITS32 | REGMEM | REGISTER)
#define REG_RAX (GEN_SUBCLASS(1) | REG_CLASS_GPR | BITS64 | REGMEM | REGISTER)
#define REG_COUNT (GEN_SUBCLASS(5) | GEN_SUBCLASS(2) | REG_CLASS_GPR | REGMEM | REGISTER) /* counter: CL, CX, ECX, RCX */
#define REG_CL (GEN_SUBCLASS(5) | GEN_SUBCLASS(2) | REG_CLASS_GPR | BITS8 | REGMEM | REGISTER)
#define REG_CX (GEN_SUBCLASS(5) | GEN_SUBCLASS(2) | REG_CLASS_GPR | BITS16 | REGMEM | REGISTER)
#define REG_ECX (GEN_SUBCLASS(5) | GEN_SUBCLASS(2) | REG_CLASS_GPR | BITS32 | REGMEM | REGISTER)
#define REG_RCX (GEN_SUBCLASS(5) | GEN_SUBCLASS(2) | REG_CLASS_GPR | BITS64 | REGMEM | REGISTER)
#define REG_DL (GEN_SUBCLASS(5) | GEN_SUBCLASS(3) | REG_CLASS_GPR | BITS8 | REGMEM | REGISTER) /* data: DL, DX, EDX, RDX */
#define REG_DX (GEN_SUBCLASS(5) | GEN_SUBCLASS(3) | REG_CLASS_GPR | BITS16 | REGMEM | REGISTER)
#define REG_EDX (GEN_SUBCLASS(5) | GEN_SUBCLASS(3) | REG_CLASS_GPR | BITS32 | REGMEM | REGISTER)
#define REG_RDX (GEN_SUBCLASS(5) | GEN_SUBCLASS(3) | REG_CLASS_GPR | BITS64 | REGMEM | REGISTER)
#define REG_HIGH (GEN_SUBCLASS(5) | GEN_SUBCLASS(4) | REG_CLASS_GPR | BITS8 | REGMEM | REGISTER) /* high regs: AH, CH, DH, BH */
#define REG_NOTACC GEN_SUBCLASS(5) /* non-accumulator register */
#define REG8NA (GEN_SUBCLASS(5) | REG_CLASS_GPR | BITS8 | REGMEM | REGISTER) /* 8-bit non-acc GPR */
#define REG16NA (GEN_SUBCLASS(5) | REG_CLASS_GPR | BITS16 | REGMEM | REGISTER) /* 16-bit non-acc GPR */
#define REG32NA (GEN_SUBCLASS(5) | REG_CLASS_GPR | BITS32 | REGMEM | REGISTER) /* 32-bit non-acc GPR */
#define REG64NA (GEN_SUBCLASS(5) | REG_CLASS_GPR | BITS64 | REGMEM | REGISTER) /* 64-bit non-acc GPR */
/* special types of EAs */
#define MEM_OFFS (GEN_SUBCLASS(1) | MEMORY) /* simple [address] offset - absolute! */
#define IP_REL (GEN_SUBCLASS(2) | MEMORY) /* IP-relative offset */
#define XMEM (GEN_SUBCLASS(3) | MEMORY) /* 128-bit vector SIB */
#define YMEM (GEN_SUBCLASS(4) | MEMORY) /* 256-bit vector SIB */
#define ZMEM (GEN_SUBCLASS(5) | MEMORY) /* 512-bit vector SIB */
/* memory which matches any type of r/m operand */
#define MEMORY_ANY (MEMORY | RM_GPR | RM_MMX | RM_XMM_L16 | RM_YMM_L16 | RM_ZMM_L16 | RM_OPMASK | RM_BND)
/* special immediate values */
#define UNITY (GEN_SUBCLASS(0) | IMMEDIATE) /* operand equals 1 */
#define SBYTEWORD (GEN_SUBCLASS(1) | IMMEDIATE) /* operand is in the range -128..127 mod 2^16 */
#define SBYTEDWORD (GEN_SUBCLASS(2) | IMMEDIATE) /* operand is in the range -128..127 mod 2^32 */
#define SDWORD (GEN_SUBCLASS(3) | IMMEDIATE) /* operand is in the range -0x80000000..0x7FFFFFFF */
#define UDWORD (GEN_SUBCLASS(4) | IMMEDIATE) /* operand is in the range 0..0xFFFFFFFF */
/*
* Subset of vector registers: register 0 only and registers 0-15.
* Avoid conflicts in subclass bitfield with any of special EA types!
*/
#define RM_XMM_L16 (GEN_SUBCLASS(6) | RM_XMM) /* XMM r/m operand 0 ~ 15 */
#define XMM0 (GEN_SUBCLASS(1) | GEN_SUBCLASS(6) | XMMREG) /* XMM register zero */
#define XMM_L16 ( GEN_SUBCLASS(6) | XMMREG) /* XMM register 0 ~ 15 */
#define RM_YMM_L16 (GEN_SUBCLASS(6) | RM_YMM) /* YMM r/m operand 0 ~ 15 */
#define YMM0 (GEN_SUBCLASS(1) | GEN_SUBCLASS(6) | YMMREG) /* YMM register zero */
#define YMM_L16 ( GEN_SUBCLASS(6) | YMMREG) /* YMM register 0 ~ 15 */
#define RM_ZMM_L16 (GEN_SUBCLASS(6) | RM_ZMM) /* ZMM r/m operand 0 ~ 15 */
#define ZMM0 (GEN_SUBCLASS(1) | GEN_SUBCLASS(6) | ZMMREG) /* ZMM register zero */
#define ZMM_L16 ( GEN_SUBCLASS(6) | ZMMREG) /* ZMM register 0 ~ 15 */
#endif /* NASM_OPFLAGS_H */
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* opflags.h - operand flags
*/
#ifndef NASM_OPFLAGS_H
#define NASM_OPFLAGS_H
#include "compiler.h"
/*
* Here we define the operand types. These are implemented as bit
* masks, since some are subsets of others; e.g. AX in a MOV
* instruction is a special operand type, whereas AX in other
* contexts is just another 16-bit register. (Also, consider CL in
* shift instructions, DX in OUT, etc.)
*
* The basic concept here is that
* (class & ~operand) == 0
*
* if and only if "operand" belongs to class type "class".
*
* The bits are assigned as follows:
*
* Bits 0-7, 23, 29: sizes
* 0: 8 bits (BYTE)
* 1: 16 bits (WORD)
* 2: 32 bits (DWORD)
* 3: 64 bits (QWORD)
* 4: 80 bits (TWORD)
* 5: FAR
* 6: NEAR
* 7: SHORT
* 23: 256 bits (YWORD)
* 29: 128 bits (OWORD)
*
* Bits 8-11 modifiers
* 8: TO
* 9: COLON
* 10: STRICT
* 11: (reserved)
*
* Bits 12-15: type of operand
* 12: REGISTER
* 13: IMMEDIATE
* 14: MEMORY (always has REGMEM attribute as well)
* 15: REGMEM (valid EA operand)
*
* Bits 16-19, 28: subclasses
* With REG_CDT:
* 16: REG_CREG (CRx)
* 17: REG_DREG (DRx)
* 18: REG_TREG (TRx)
* With REG_GPR:
* 16: REG_ACCUM (AL, AX, EAX, RAX)
* 17: REG_COUNT (CL, CX, ECX, RCX)
* 18: REG_DATA (DL, DX, EDX, RDX)
* 19: REG_HIGH (AH, CH, DH, BH)
* 28: REG_NOTACC (not REG_ACCUM)
*
* With REG_SREG:
* 16: REG_CS
* 17: REG_DESS (DS, ES, SS)
* 18: REG_FSGS
* 19: REG_SEG67
*
* With FPUREG:
* 16: FPU0
*
* With XMMREG:
* 16: XMM0
*
* With YMMREG:
* 16: YMM0
*
* With MEMORY:
* 16: MEM_OFFS (this is a simple offset)
* 17: IP_REL (IP-relative offset)
*
* With IMMEDIATE:
* 16: UNITY (1)
* 17: BYTENESS16 (-128..127)
* 18: BYTENESS32 (-128..127)
* 19: BYTENESS64 (-128..127)
*
* Bits 20-22, 24-27: register classes
* 20: REG_CDT (CRx, DRx, TRx)
* 21: RM_GPR (REG_GPR) (integer register)
* 22: REG_SREG
* 24: FPUREG
* 25: RM_MMX (MMXREG)
* 26: RM_XMM (XMMREG)
* 27: RM_YMM (YMMREG)
*
* Bit 31 is currently unallocated.
*
* 30: SAME_AS
* Special flag only used in instruction patterns; means this operand
* has to be identical to another operand. Currently only supported
* for registers.
*/
typedef uint32_t opflags_t;
/* Size, and other attributes, of the operand */
#define BITS8 0x00000001U
#define BITS16 0x00000002U
#define BITS32 0x00000004U
#define BITS64 0x00000008U /* x64 and FPU only */
#define BITS80 0x00000010U /* FPU only */
#define BITS128 0x20000000U
#define BITS256 0x00800000U
#define FAR 0x00000020U /* grotty: this means 16:16 or */
/* 16:32, like in CALL/JMP */
#define NEAR 0x00000040U
#define SHORT 0x00000080U /* and this means what it says :) */
#define SIZE_MASK 0x208000FFU /* all the size attributes */
/* Modifiers */
#define MODIFIER_MASK 0x00000f00U
#define TO 0x00000100U /* reverse effect in FADD, FSUB &c */
#define COLON 0x00000200U /* operand is followed by a colon */
#define STRICT 0x00000400U /* do not optimize this operand */
/* Type of operand: memory reference, register, etc. */
#define OPTYPE_MASK 0x0000f000U
#define REGISTER 0x00001000U /* register number in 'basereg' */
#define IMMEDIATE 0x00002000U
#define MEMORY 0x0000c000U
#define REGMEM 0x00008000U /* for r/m, ie EA, operands */
#define is_class(class, op) (!((opflags_t)(class) & ~(opflags_t)(op)))
/* Register classes */
#define REG_EA 0x00009000U /* 'normal' reg, qualifies as EA */
#define RM_GPR 0x00208000U /* integer operand */
#define REG_GPR 0x00209000U /* integer register */
#define REG8 0x00209001U /* 8-bit GPR */
#define REG16 0x00209002U /* 16-bit GPR */
#define REG32 0x00209004U /* 32-bit GPR */
#define REG64 0x00209008U /* 64-bit GPR */
#define FPUREG 0x01001000U /* floating point stack registers */
#define FPU0 0x01011000U /* FPU stack register zero */
#define RM_MMX 0x02008000U /* MMX operand */
#define MMXREG 0x02009000U /* MMX register */
#define RM_XMM 0x04008000U /* XMM (SSE) operand */
#define XMMREG 0x04009000U /* XMM (SSE) register */
#define XMM0 0x04019000U /* XMM register zero */
#define RM_YMM 0x08008000U /* YMM (AVX) operand */
#define YMMREG 0x08009000U /* YMM (AVX) register */
#define YMM0 0x08019000U /* YMM register zero */
#define REG_CDT 0x00101004U /* CRn, DRn and TRn */
#define REG_CREG 0x00111004U /* CRn */
#define REG_DREG 0x00121004U /* DRn */
#define REG_TREG 0x00141004U /* TRn */
#define REG_SREG 0x00401002U /* any segment register */
#define REG_CS 0x00411002U /* CS */
#define REG_DESS 0x00421002U /* DS, ES, SS */
#define REG_FSGS 0x00441002U /* FS, GS */
#define REG_SEG67 0x00481002U /* Unimplemented segment registers */
#define REG_RIP 0x00801008U /* RIP relative addressing */
#define REG_EIP 0x00801004U /* EIP relative addressing */
/* Special GPRs */
#define REG_SMASK 0x100f0000U /* a mask for the following */
#define REG_ACCUM 0x00219000U /* accumulator: AL, AX, EAX, RAX */
#define REG_AL 0x00219001U
#define REG_AX 0x00219002U
#define REG_EAX 0x00219004U
#define REG_RAX 0x00219008U
#define REG_COUNT 0x10229000U /* counter: CL, CX, ECX, RCX */
#define REG_CL 0x10229001U
#define REG_CX 0x10229002U
#define REG_ECX 0x10229004U
#define REG_RCX 0x10229008U
#define REG_DL 0x10249001U /* data: DL, DX, EDX, RDX */
#define REG_DX 0x10249002U
#define REG_EDX 0x10249004U
#define REG_RDX 0x10249008U
#define REG_HIGH 0x10289001U /* high regs: AH, CH, DH, BH */
#define REG_NOTACC 0x10000000U /* non-accumulator register */
#define REG8NA 0x10209001U /* 8-bit non-acc GPR */
#define REG16NA 0x10209002U /* 16-bit non-acc GPR */
#define REG32NA 0x10209004U /* 32-bit non-acc GPR */
#define REG64NA 0x10209008U /* 64-bit non-acc GPR */
/* special types of EAs */
#define MEM_OFFS 0x0001c000U /* simple [address] offset - absolute! */
#define IP_REL 0x0002c000U /* IP-relative offset */
/* memory which matches any type of r/m operand */
#define MEMORY_ANY (MEMORY|RM_GPR|RM_MMX|RM_XMM|RM_YMM)
/* special type of immediate operand */
#define UNITY 0x00012000U /* for shift/rotate instructions */
#define SBYTE16 0x00022000U /* for op r16,immediate instrs. */
#define SBYTE32 0x00042000U /* for op r32,immediate instrs. */
#define SBYTE64 0x00082000U /* for op r64,immediate instrs. */
#define BYTENESS 0x000e0000U /* for testing for byteness */
/* special flags */
#define SAME_AS 0x40000000U
#endif /* NASM_OPFLAGS_H */

View file

@ -1,157 +0,0 @@
/* Automatically generated from ./pptok.dat by ./pptok.pl */
/* Do not edit */
enum preproc_token {
PP_ELIF = 0,
PP_ELIFN = 1,
PP_ELIFCTX = 2,
PP_ELIFNCTX = 3,
PP_ELIFDEF = 4,
PP_ELIFNDEF = 5,
PP_ELIFEMPTY = 6,
PP_ELIFNEMPTY = 7,
PP_ELIFENV = 8,
PP_ELIFNENV = 9,
PP_ELIFID = 10,
PP_ELIFNID = 11,
PP_ELIFIDN = 12,
PP_ELIFNIDN = 13,
PP_ELIFIDNI = 14,
PP_ELIFNIDNI = 15,
PP_ELIFMACRO = 16,
PP_ELIFNMACRO = 17,
PP_ELIFNUM = 18,
PP_ELIFNNUM = 19,
PP_ELIFSTR = 20,
PP_ELIFNSTR = 21,
PP_ELIFTOKEN = 22,
PP_ELIFNTOKEN = 23,
PP_IF = 32,
PP_IFN = 33,
PP_IFCTX = 34,
PP_IFNCTX = 35,
PP_IFDEF = 36,
PP_IFNDEF = 37,
PP_IFEMPTY = 38,
PP_IFNEMPTY = 39,
PP_IFENV = 40,
PP_IFNENV = 41,
PP_IFID = 42,
PP_IFNID = 43,
PP_IFIDN = 44,
PP_IFNIDN = 45,
PP_IFIDNI = 46,
PP_IFNIDNI = 47,
PP_IFMACRO = 48,
PP_IFNMACRO = 49,
PP_IFNUM = 50,
PP_IFNNUM = 51,
PP_IFSTR = 52,
PP_IFNSTR = 53,
PP_IFTOKEN = 54,
PP_IFNTOKEN = 55,
PP_ARG = 64,
PP_ASSIGN = 65,
PP_CLEAR = 66,
PP_DEFINE = 67,
PP_DEFSTR = 68,
PP_DEFTOK = 69,
PP_DEPEND = 70,
PP_ELSE = 71,
PP_ENDIF = 72,
PP_ENDM = 73,
PP_ENDMACRO = 74,
PP_ENDREP = 75,
PP_ERROR = 76,
PP_EXITMACRO = 77,
PP_EXITREP = 78,
PP_FATAL = 79,
PP_IASSIGN = 80,
PP_IDEFINE = 81,
PP_IDEFSTR = 82,
PP_IDEFTOK = 83,
PP_IMACRO = 84,
PP_INCLUDE = 85,
PP_IRMACRO = 86,
PP_IXDEFINE = 87,
PP_LINE = 88,
PP_LOCAL = 89,
PP_MACRO = 90,
PP_PATHSEARCH = 91,
PP_POP = 92,
PP_PUSH = 93,
PP_REP = 94,
PP_REPL = 95,
PP_RMACRO = 96,
PP_ROTATE = 97,
PP_STACKSIZE = 98,
PP_STRCAT = 99,
PP_STRLEN = 100,
PP_SUBSTR = 101,
PP_UNDEF = 102,
PP_UNIMACRO = 103,
PP_UNMACRO = 104,
PP_USE = 105,
PP_WARNING = 106,
PP_XDEFINE = 107,
PP_INVALID = -1
};
enum pp_conditional {
PPC_IF = 0, PPC_IFCTX = 2, PPC_IFDEF = 4, PPC_IFEMPTY = 6, PPC_IFENV = 8, PPC_IFID = 10, PPC_IFIDN = 12, PPC_IFIDNI = 14, PPC_IFMACRO = 16, PPC_IFNUM = 18, PPC_IFSTR = 20, PPC_IFTOKEN = 22
};
#define PP_COND(x) ((enum pp_conditional)((x) & 0x1e))
#define PP_IS_COND(x) ((unsigned int)(x) < PP_ARG)
#define PP_NEGATIVE(x) ((x) & 1)
#define CASE_PP_ELIF \
case PP_ELIF: \
case PP_ELIFN:\
case PP_ELIFCTX: \
case PP_ELIFNCTX:\
case PP_ELIFDEF: \
case PP_ELIFNDEF:\
case PP_ELIFEMPTY: \
case PP_ELIFNEMPTY:\
case PP_ELIFENV: \
case PP_ELIFNENV:\
case PP_ELIFID: \
case PP_ELIFNID:\
case PP_ELIFIDN: \
case PP_ELIFNIDN:\
case PP_ELIFIDNI: \
case PP_ELIFNIDNI:\
case PP_ELIFMACRO: \
case PP_ELIFNMACRO:\
case PP_ELIFNUM: \
case PP_ELIFNNUM:\
case PP_ELIFSTR: \
case PP_ELIFNSTR:\
case PP_ELIFTOKEN: \
case PP_ELIFNTOKEN
#define CASE_PP_IF \
case PP_IF: \
case PP_IFN:\
case PP_IFCTX: \
case PP_IFNCTX:\
case PP_IFDEF: \
case PP_IFNDEF:\
case PP_IFEMPTY: \
case PP_IFNEMPTY:\
case PP_IFENV: \
case PP_IFNENV:\
case PP_IFID: \
case PP_IFNID:\
case PP_IFIDN: \
case PP_IFNIDN:\
case PP_IFIDNI: \
case PP_IFNIDNI:\
case PP_IFMACRO: \
case PP_IFNMACRO:\
case PP_IFNUM: \
case PP_IFNNUM:\
case PP_IFSTR: \
case PP_IFNSTR:\
case PP_IFTOKEN: \
case PP_IFNTOKEN

View file

@ -1,54 +0,0 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* preproc.h header file for preproc.c
*/
#ifndef NASM_PREPROC_H
#define NASM_PREPROC_H
#include "pptok.h"
extern const char * const pp_directives[];
extern const uint8_t pp_directives_len[];
/* Pointer to a macro chain */
typedef const unsigned char macros_t;
enum preproc_token pp_token_hash(const char *token);
/* Opens an include file or input file. This uses the include path. */
FILE *pp_input_fopen(const char *filename, const char *mode);
#endif

View file

@ -2,12 +2,10 @@
#include "regdis.h"
const enum reg_enum nasm_rd_bndreg [ 4] = {R_BND0,R_BND1,R_BND2,R_BND3};
const enum reg_enum nasm_rd_creg [16] = {R_CR0,R_CR1,R_CR2,R_CR3,R_CR4,R_CR5,R_CR6,R_CR7,R_CR8,R_CR9,R_CR10,R_CR11,R_CR12,R_CR13,R_CR14,R_CR15};
const enum reg_enum nasm_rd_dreg [16] = {R_DR0,R_DR1,R_DR2,R_DR3,R_DR4,R_DR5,R_DR6,R_DR7,R_DR8,R_DR9,R_DR10,R_DR11,R_DR12,R_DR13,R_DR14,R_DR15};
const enum reg_enum nasm_rd_fpureg [ 8] = {R_ST0,R_ST1,R_ST2,R_ST3,R_ST4,R_ST5,R_ST6,R_ST7};
const enum reg_enum nasm_rd_mmxreg [ 8] = {R_MM0,R_MM1,R_MM2,R_MM3,R_MM4,R_MM5,R_MM6,R_MM7};
const enum reg_enum nasm_rd_opmaskreg[ 8] = {R_K0,R_K1,R_K2,R_K3,R_K4,R_K5,R_K6,R_K7};
const enum reg_enum nasm_rd_reg16 [16] = {R_AX,R_CX,R_DX,R_BX,R_SP,R_BP,R_SI,R_DI,R_R8W,R_R9W,R_R10W,R_R11W,R_R12W,R_R13W,R_R14W,R_R15W};
const enum reg_enum nasm_rd_reg32 [16] = {R_EAX,R_ECX,R_EDX,R_EBX,R_ESP,R_EBP,R_ESI,R_EDI,R_R8D,R_R9D,R_R10D,R_R11D,R_R12D,R_R13D,R_R14D,R_R15D};
const enum reg_enum nasm_rd_reg64 [16] = {R_RAX,R_RCX,R_RDX,R_RBX,R_RSP,R_RBP,R_RSI,R_RDI,R_R8,R_R9,R_R10,R_R11,R_R12,R_R13,R_R14,R_R15};
@ -15,6 +13,5 @@ const enum reg_enum nasm_rd_reg8 [ 8] = {R_AL,R_CL,R_DL,R_BL,R_AH,R_CH,R_DH,R
const enum reg_enum nasm_rd_reg8_rex[16] = {R_AL,R_CL,R_DL,R_BL,R_SPL,R_BPL,R_SIL,R_DIL,R_R8B,R_R9B,R_R10B,R_R11B,R_R12B,R_R13B,R_R14B,R_R15B};
const enum reg_enum nasm_rd_sreg [ 8] = {R_ES,R_CS,R_SS,R_DS,R_FS,R_GS,R_SEGR6,R_SEGR7};
const enum reg_enum nasm_rd_treg [ 8] = {R_TR0,R_TR1,R_TR2,R_TR3,R_TR4,R_TR5,R_TR6,R_TR7};
const enum reg_enum nasm_rd_xmmreg [32] = {R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7,R_XMM8,R_XMM9,R_XMM10,R_XMM11,R_XMM12,R_XMM13,R_XMM14,R_XMM15,R_XMM16,R_XMM17,R_XMM18,R_XMM19,R_XMM20,R_XMM21,R_XMM22,R_XMM23,R_XMM24,R_XMM25,R_XMM26,R_XMM27,R_XMM28,R_XMM29,R_XMM30,R_XMM31};
const enum reg_enum nasm_rd_ymmreg [32] = {R_YMM0,R_YMM1,R_YMM2,R_YMM3,R_YMM4,R_YMM5,R_YMM6,R_YMM7,R_YMM8,R_YMM9,R_YMM10,R_YMM11,R_YMM12,R_YMM13,R_YMM14,R_YMM15,R_YMM16,R_YMM17,R_YMM18,R_YMM19,R_YMM20,R_YMM21,R_YMM22,R_YMM23,R_YMM24,R_YMM25,R_YMM26,R_YMM27,R_YMM28,R_YMM29,R_YMM30,R_YMM31};
const enum reg_enum nasm_rd_zmmreg [32] = {R_ZMM0,R_ZMM1,R_ZMM2,R_ZMM3,R_ZMM4,R_ZMM5,R_ZMM6,R_ZMM7,R_ZMM8,R_ZMM9,R_ZMM10,R_ZMM11,R_ZMM12,R_ZMM13,R_ZMM14,R_ZMM15,R_ZMM16,R_ZMM17,R_ZMM18,R_ZMM19,R_ZMM20,R_ZMM21,R_ZMM22,R_ZMM23,R_ZMM24,R_ZMM25,R_ZMM26,R_ZMM27,R_ZMM28,R_ZMM29,R_ZMM30,R_ZMM31};
const enum reg_enum nasm_rd_xmmreg [16] = {R_XMM0,R_XMM1,R_XMM2,R_XMM3,R_XMM4,R_XMM5,R_XMM6,R_XMM7,R_XMM8,R_XMM9,R_XMM10,R_XMM11,R_XMM12,R_XMM13,R_XMM14,R_XMM15};
const enum reg_enum nasm_rd_ymmreg [16] = {R_YMM0,R_YMM1,R_YMM2,R_YMM3,R_YMM4,R_YMM5,R_YMM6,R_YMM7,R_YMM8,R_YMM9,R_YMM10,R_YMM11,R_YMM12,R_YMM13,R_YMM14,R_YMM15};

View file

@ -1,25 +1,22 @@
/* automatically generated from ./regs.dat - do not edit */
#ifndef NASM_REGDIS_H
#define NASM_REGDIS_H
#include "regs.h"
extern const enum reg_enum nasm_rd_bndreg [ 4];
extern const enum reg_enum nasm_rd_creg [16];
extern const enum reg_enum nasm_rd_dreg [16];
extern const enum reg_enum nasm_rd_fpureg [ 8];
extern const enum reg_enum nasm_rd_mmxreg [ 8];
extern const enum reg_enum nasm_rd_opmaskreg[ 8];
extern const enum reg_enum nasm_rd_reg16 [16];
extern const enum reg_enum nasm_rd_reg32 [16];
extern const enum reg_enum nasm_rd_reg64 [16];
extern const enum reg_enum nasm_rd_reg8 [ 8];
extern const enum reg_enum nasm_rd_reg8_rex[16];
extern const enum reg_enum nasm_rd_sreg [ 8];
extern const enum reg_enum nasm_rd_treg [ 8];
extern const enum reg_enum nasm_rd_xmmreg [32];
extern const enum reg_enum nasm_rd_ymmreg [32];
extern const enum reg_enum nasm_rd_zmmreg [32];
#endif /* NASM_REGDIS_H */
/* automatically generated from ./regs.dat - do not edit */
#ifndef NASM_REGDIS_H
#define NASM_REGDIS_H
#include "regs.h"
extern const enum reg_enum nasm_rd_creg [16];
extern const enum reg_enum nasm_rd_dreg [16];
extern const enum reg_enum nasm_rd_fpureg [ 8];
extern const enum reg_enum nasm_rd_mmxreg [ 8];
extern const enum reg_enum nasm_rd_reg16 [16];
extern const enum reg_enum nasm_rd_reg32 [16];
extern const enum reg_enum nasm_rd_reg64 [16];
extern const enum reg_enum nasm_rd_reg8 [ 8];
extern const enum reg_enum nasm_rd_reg8_rex[16];
extern const enum reg_enum nasm_rd_sreg [ 8];
extern const enum reg_enum nasm_rd_treg [ 8];
extern const enum reg_enum nasm_rd_xmmreg [16];
extern const enum reg_enum nasm_rd_ymmreg [16];
#endif /* NASM_REGDIS_H */

View file

@ -8,10 +8,6 @@ const char * const nasm_reg_names[] = {
"ax",
"bh",
"bl",
"bnd0",
"bnd1",
"bnd2",
"bnd3",
"bp",
"bpl",
"bx",
@ -68,14 +64,6 @@ const char * const nasm_reg_names[] = {
"esp",
"fs",
"gs",
"k0",
"k1",
"k2",
"k3",
"k4",
"k5",
"k6",
"k7",
"mm0",
"mm1",
"mm2",
@ -155,24 +143,8 @@ const char * const nasm_reg_names[] = {
"xmm13",
"xmm14",
"xmm15",
"xmm16",
"xmm17",
"xmm18",
"xmm19",
"xmm2",
"xmm20",
"xmm21",
"xmm22",
"xmm23",
"xmm24",
"xmm25",
"xmm26",
"xmm27",
"xmm28",
"xmm29",
"xmm3",
"xmm30",
"xmm31",
"xmm4",
"xmm5",
"xmm6",
@ -187,60 +159,12 @@ const char * const nasm_reg_names[] = {
"ymm13",
"ymm14",
"ymm15",
"ymm16",
"ymm17",
"ymm18",
"ymm19",
"ymm2",
"ymm20",
"ymm21",
"ymm22",
"ymm23",
"ymm24",
"ymm25",
"ymm26",
"ymm27",
"ymm28",
"ymm29",
"ymm3",
"ymm30",
"ymm31",
"ymm4",
"ymm5",
"ymm6",
"ymm7",
"ymm8",
"ymm9",
"zmm0",
"zmm1",
"zmm10",
"zmm11",
"zmm12",
"zmm13",
"zmm14",
"zmm15",
"zmm16",
"zmm17",
"zmm18",
"zmm19",
"zmm2",
"zmm20",
"zmm21",
"zmm22",
"zmm23",
"zmm24",
"zmm25",
"zmm26",
"zmm27",
"zmm28",
"zmm29",
"zmm3",
"zmm30",
"zmm31",
"zmm4",
"zmm5",
"zmm6",
"zmm7",
"zmm8",
"zmm9"
"ymm9"
};

View file

@ -13,10 +13,6 @@ enum reg_enum {
R_AX,
R_BH,
R_BL,
R_BND0,
R_BND1,
R_BND2,
R_BND3,
R_BP,
R_BPL,
R_BX,
@ -73,14 +69,6 @@ enum reg_enum {
R_ESP,
R_FS,
R_GS,
R_K0,
R_K1,
R_K2,
R_K3,
R_K4,
R_K5,
R_K6,
R_K7,
R_MM0,
R_MM1,
R_MM2,
@ -160,24 +148,8 @@ enum reg_enum {
R_XMM13,
R_XMM14,
R_XMM15,
R_XMM16,
R_XMM17,
R_XMM18,
R_XMM19,
R_XMM2,
R_XMM20,
R_XMM21,
R_XMM22,
R_XMM23,
R_XMM24,
R_XMM25,
R_XMM26,
R_XMM27,
R_XMM28,
R_XMM29,
R_XMM3,
R_XMM30,
R_XMM31,
R_XMM4,
R_XMM5,
R_XMM6,
@ -192,76 +164,24 @@ enum reg_enum {
R_YMM13,
R_YMM14,
R_YMM15,
R_YMM16,
R_YMM17,
R_YMM18,
R_YMM19,
R_YMM2,
R_YMM20,
R_YMM21,
R_YMM22,
R_YMM23,
R_YMM24,
R_YMM25,
R_YMM26,
R_YMM27,
R_YMM28,
R_YMM29,
R_YMM3,
R_YMM30,
R_YMM31,
R_YMM4,
R_YMM5,
R_YMM6,
R_YMM7,
R_YMM8,
R_YMM9,
R_ZMM0,
R_ZMM1,
R_ZMM10,
R_ZMM11,
R_ZMM12,
R_ZMM13,
R_ZMM14,
R_ZMM15,
R_ZMM16,
R_ZMM17,
R_ZMM18,
R_ZMM19,
R_ZMM2,
R_ZMM20,
R_ZMM21,
R_ZMM22,
R_ZMM23,
R_ZMM24,
R_ZMM25,
R_ZMM26,
R_ZMM27,
R_ZMM28,
R_ZMM29,
R_ZMM3,
R_ZMM30,
R_ZMM31,
R_ZMM4,
R_ZMM5,
R_ZMM6,
R_ZMM7,
R_ZMM8,
R_ZMM9,
REG_ENUM_LIMIT
};
#define EXPR_REG_END 240
#define EXPR_REG_END 164
#define REG_NUM_AH 4
#define REG_NUM_AL 0
#define REG_NUM_AX 0
#define REG_NUM_BH 7
#define REG_NUM_BL 3
#define REG_NUM_BND0 0
#define REG_NUM_BND1 1
#define REG_NUM_BND2 2
#define REG_NUM_BND3 3
#define REG_NUM_BP 5
#define REG_NUM_BPL 5
#define REG_NUM_BX 3
@ -318,14 +238,6 @@ enum reg_enum {
#define REG_NUM_ESP 4
#define REG_NUM_FS 4
#define REG_NUM_GS 5
#define REG_NUM_K0 0
#define REG_NUM_K1 1
#define REG_NUM_K2 2
#define REG_NUM_K3 3
#define REG_NUM_K4 4
#define REG_NUM_K5 5
#define REG_NUM_K6 6
#define REG_NUM_K7 7
#define REG_NUM_MM0 0
#define REG_NUM_MM1 1
#define REG_NUM_MM2 2
@ -405,24 +317,8 @@ enum reg_enum {
#define REG_NUM_XMM13 13
#define REG_NUM_XMM14 14
#define REG_NUM_XMM15 15
#define REG_NUM_XMM16 16
#define REG_NUM_XMM17 17
#define REG_NUM_XMM18 18
#define REG_NUM_XMM19 19
#define REG_NUM_XMM2 2
#define REG_NUM_XMM20 20
#define REG_NUM_XMM21 21
#define REG_NUM_XMM22 22
#define REG_NUM_XMM23 23
#define REG_NUM_XMM24 24
#define REG_NUM_XMM25 25
#define REG_NUM_XMM26 26
#define REG_NUM_XMM27 27
#define REG_NUM_XMM28 28
#define REG_NUM_XMM29 29
#define REG_NUM_XMM3 3
#define REG_NUM_XMM30 30
#define REG_NUM_XMM31 31
#define REG_NUM_XMM4 4
#define REG_NUM_XMM5 5
#define REG_NUM_XMM6 6
@ -437,62 +333,14 @@ enum reg_enum {
#define REG_NUM_YMM13 13
#define REG_NUM_YMM14 14
#define REG_NUM_YMM15 15
#define REG_NUM_YMM16 16
#define REG_NUM_YMM17 17
#define REG_NUM_YMM18 18
#define REG_NUM_YMM19 19
#define REG_NUM_YMM2 2
#define REG_NUM_YMM20 20
#define REG_NUM_YMM21 21
#define REG_NUM_YMM22 22
#define REG_NUM_YMM23 23
#define REG_NUM_YMM24 24
#define REG_NUM_YMM25 25
#define REG_NUM_YMM26 26
#define REG_NUM_YMM27 27
#define REG_NUM_YMM28 28
#define REG_NUM_YMM29 29
#define REG_NUM_YMM3 3
#define REG_NUM_YMM30 30
#define REG_NUM_YMM31 31
#define REG_NUM_YMM4 4
#define REG_NUM_YMM5 5
#define REG_NUM_YMM6 6
#define REG_NUM_YMM7 7
#define REG_NUM_YMM8 8
#define REG_NUM_YMM9 9
#define REG_NUM_ZMM0 0
#define REG_NUM_ZMM1 1
#define REG_NUM_ZMM10 10
#define REG_NUM_ZMM11 11
#define REG_NUM_ZMM12 12
#define REG_NUM_ZMM13 13
#define REG_NUM_ZMM14 14
#define REG_NUM_ZMM15 15
#define REG_NUM_ZMM16 16
#define REG_NUM_ZMM17 17
#define REG_NUM_ZMM18 18
#define REG_NUM_ZMM19 19
#define REG_NUM_ZMM2 2
#define REG_NUM_ZMM20 20
#define REG_NUM_ZMM21 21
#define REG_NUM_ZMM22 22
#define REG_NUM_ZMM23 23
#define REG_NUM_ZMM24 24
#define REG_NUM_ZMM25 25
#define REG_NUM_ZMM26 26
#define REG_NUM_ZMM27 27
#define REG_NUM_ZMM28 28
#define REG_NUM_ZMM29 29
#define REG_NUM_ZMM3 3
#define REG_NUM_ZMM30 30
#define REG_NUM_ZMM31 31
#define REG_NUM_ZMM4 4
#define REG_NUM_ZMM5 5
#define REG_NUM_ZMM6 6
#define REG_NUM_ZMM7 7
#define REG_NUM_ZMM8 8
#define REG_NUM_ZMM9 9
#endif /* NASM_REGS_H */

View file

@ -0,0 +1,37 @@
/*
* snprintf()
*
* Implement snprintf() in terms of vsnprintf()
*/
#include "compiler.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include "nasmlib.h"
#ifndef HAVE_SNPRINTF
#ifndef HAVE__SNPRINTF
int snprintf(char *str, size_t size, const char *format, ...)
{
va_list ap;
int rv;
va_start(ap, format);
rv =
#ifdef flagMSC
_vsnprintf
#else
vsnprintf
#endif
(str, size, format, ap);
va_end(ap);
return rv;
}
#endif
#endif

View file

@ -1,359 +1,203 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* strfunc.c
*
* String transformation functions
*/
#include "nasmlib.h"
#include "nasm.h"
/*
* Convert a string in UTF-8 format to UTF-16LE
*/
static size_t utf8_to_16le(uint8_t *str, size_t len, char *op)
{
#define EMIT(x) do { if (op) { WRITESHORT(op,x); } outlen++; } while(0)
size_t outlen = 0;
int expect = 0;
uint8_t c;
uint32_t v = 0, vmin = 0;
while (len--) {
c = *str++;
if (expect) {
if ((c & 0xc0) != 0x80) {
expect = 0;
return -1;
} else {
v = (v << 6) | (c & 0x3f);
if (!--expect) {
if (v < vmin || v > 0x10ffff ||
(v >= 0xd800 && v <= 0xdfff)) {
return -1;
} else if (v > 0xffff) {
v -= 0x10000;
EMIT(0xd800 | (v >> 10));
EMIT(0xdc00 | (v & 0x3ff));
} else {
EMIT(v);
}
}
continue;
}
}
if (c < 0x80) {
EMIT(c);
} else if (c < 0xc0 || c >= 0xfe) {
/* Invalid UTF-8 */
return -1;
} else if (c < 0xe0) {
v = c & 0x1f;
expect = 1;
vmin = 0x80;
} else if (c < 0xf0) {
v = c & 0x0f;
expect = 2;
vmin = 0x800;
} else if (c < 0xf8) {
v = c & 0x07;
expect = 3;
vmin = 0x10000;
} else if (c < 0xfc) {
v = c & 0x03;
expect = 4;
vmin = 0x200000;
} else {
v = c & 0x01;
expect = 5;
vmin = 0x4000000;
}
}
return expect ? (size_t)-1 : outlen << 1;
#undef EMIT
}
/*
* Convert a string in UTF-8 format to UTF-16BE
*/
static size_t utf8_to_16be(uint8_t *str, size_t len, char *op)
{
#define EMIT(x) \
do { \
uint16_t _y = (x); \
if (op) { \
WRITECHAR(op, _y >> 8); \
WRITECHAR(op, _y); \
} \
outlen++; \
} while (0) \
size_t outlen = 0;
int expect = 0;
uint8_t c;
uint32_t v = 0, vmin = 0;
while (len--) {
c = *str++;
if (expect) {
if ((c & 0xc0) != 0x80) {
expect = 0;
return -1;
} else {
v = (v << 6) | (c & 0x3f);
if (!--expect) {
if (v < vmin || v > 0x10ffff ||
(v >= 0xd800 && v <= 0xdfff)) {
return -1;
} else if (v > 0xffff) {
v -= 0x10000;
EMIT(0xdc00 | (v & 0x3ff));
EMIT(0xd800 | (v >> 10));
} else {
EMIT(v);
}
}
continue;
}
}
if (c < 0x80) {
EMIT(c);
} else if (c < 0xc0 || c >= 0xfe) {
/* Invalid UTF-8 */
return -1;
} else if (c < 0xe0) {
v = c & 0x1f;
expect = 1;
vmin = 0x80;
} else if (c < 0xf0) {
v = c & 0x0f;
expect = 2;
vmin = 0x800;
} else if (c < 0xf8) {
v = c & 0x07;
expect = 3;
vmin = 0x10000;
} else if (c < 0xfc) {
v = c & 0x03;
expect = 4;
vmin = 0x200000;
} else {
v = c & 0x01;
expect = 5;
vmin = 0x4000000;
}
}
return expect ? (size_t)-1 : outlen << 1;
#undef EMIT
}
/*
* Convert a string in UTF-8 format to UTF-32LE
*/
static size_t utf8_to_32le(uint8_t *str, size_t len, char *op)
{
#define EMIT(x) do { if (op) { WRITELONG(op,x); } outlen++; } while(0)
size_t outlen = 0;
int expect = 0;
uint8_t c;
uint32_t v = 0, vmin = 0;
while (len--) {
c = *str++;
if (expect) {
if ((c & 0xc0) != 0x80) {
return -1;
} else {
v = (v << 6) | (c & 0x3f);
if (!--expect) {
if (v < vmin || (v >= 0xd800 && v <= 0xdfff)) {
return -1;
} else {
EMIT(v);
}
}
continue;
}
}
if (c < 0x80) {
EMIT(c);
} else if (c < 0xc0 || c >= 0xfe) {
/* Invalid UTF-8 */
return -1;
} else if (c < 0xe0) {
v = c & 0x1f;
expect = 1;
vmin = 0x80;
} else if (c < 0xf0) {
v = c & 0x0f;
expect = 2;
vmin = 0x800;
} else if (c < 0xf8) {
v = c & 0x07;
expect = 3;
vmin = 0x10000;
} else if (c < 0xfc) {
v = c & 0x03;
expect = 4;
vmin = 0x200000;
} else {
v = c & 0x01;
expect = 5;
vmin = 0x4000000;
}
}
return expect ? (size_t)-1 : outlen << 2;
#undef EMIT
}
/*
* Convert a string in UTF-8 format to UTF-32BE
*/
static size_t utf8_to_32be(uint8_t *str, size_t len, char *op)
{
#define EMIT(x) \
do { \
uint32_t _y = (x); \
if (op) { \
WRITECHAR(op,_y >> 24); \
WRITECHAR(op,_y >> 16); \
WRITECHAR(op,_y >> 8); \
WRITECHAR(op,_y); \
} \
outlen++; \
} while (0)
size_t outlen = 0;
int expect = 0;
uint8_t c;
uint32_t v = 0, vmin = 0;
while (len--) {
c = *str++;
if (expect) {
if ((c & 0xc0) != 0x80) {
return -1;
} else {
v = (v << 6) | (c & 0x3f);
if (!--expect) {
if (v < vmin || (v >= 0xd800 && v <= 0xdfff)) {
return -1;
} else {
EMIT(v);
}
}
continue;
}
}
if (c < 0x80) {
EMIT(c);
} else if (c < 0xc0 || c >= 0xfe) {
/* Invalid UTF-8 */
return -1;
} else if (c < 0xe0) {
v = c & 0x1f;
expect = 1;
vmin = 0x80;
} else if (c < 0xf0) {
v = c & 0x0f;
expect = 2;
vmin = 0x800;
} else if (c < 0xf8) {
v = c & 0x07;
expect = 3;
vmin = 0x10000;
} else if (c < 0xfc) {
v = c & 0x03;
expect = 4;
vmin = 0x200000;
} else {
v = c & 0x01;
expect = 5;
vmin = 0x4000000;
}
}
return expect ? (size_t)-1 : outlen << 2;
#undef EMIT
}
typedef size_t (*transform_func)(uint8_t *, size_t, char *);
/*
* Apply a specific string transform and return it in a nasm_malloc'd
* buffer, returning the length. On error, returns (size_t)-1 and no
* buffer is allocated.
*/
size_t string_transform(char *str, size_t len, char **out, enum strfunc func)
{
/* This should match enum strfunc in nasm.h */
static const transform_func str_transforms[] = {
utf8_to_16le,
utf8_to_16le,
utf8_to_16be,
utf8_to_32le,
utf8_to_32le,
utf8_to_32be,
};
transform_func transform = str_transforms[func];
size_t outlen;
uint8_t *s = (uint8_t *)str;
char *buf;
outlen = transform(s, len, NULL);
if (outlen == (size_t)-1)
return -1;
*out = buf = nasm_malloc(outlen+1);
buf[outlen] = '\0'; /* Forcibly null-terminate the buffer */
return transform(s, len, buf);
}
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* strfunc.c
*
* String transformation functions
*/
#include "nasmlib.h"
#include "nasm.h"
/*
* Convert a string in UTF-8 format to UTF-16LE
*/
static size_t utf8_to_16le(uint8_t *str, size_t len, char *op)
{
#define EMIT(x) do { if (op) { WRITESHORT(op,x); } outlen++; } while(0)
size_t outlen = 0;
int expect = 0;
uint8_t c;
uint32_t v = 0, vmin = 0;
while (len--) {
c = *str++;
if (expect) {
if ((c & 0xc0) != 0x80) {
expect = 0;
return -1;
} else {
v = (v << 6) | (c & 0x3f);
if (!--expect) {
if (v < vmin || v > 0x10ffff ||
(v >= 0xd800 && v <= 0xdfff)) {
return -1;
} else if (v > 0xffff) {
v -= 0x10000;
EMIT(0xd800 | (v >> 10));
EMIT(0xdc00 | (v & 0x3ff));
} else {
EMIT(v);
}
}
continue;
}
}
if (c < 0x80) {
EMIT(c);
} else if (c < 0xc0 || c >= 0xfe) {
/* Invalid UTF-8 */
return -1;
} else if (c < 0xe0) {
v = c & 0x1f;
expect = 1;
vmin = 0x80;
} else if (c < 0xf0) {
v = c & 0x0f;
expect = 2;
vmin = 0x800;
} else if (c < 0xf8) {
v = c & 0x07;
expect = 3;
vmin = 0x10000;
} else if (c < 0xfc) {
v = c & 0x03;
expect = 4;
vmin = 0x200000;
} else {
v = c & 0x01;
expect = 5;
vmin = 0x4000000;
}
}
return expect ? (size_t)-1 : outlen << 1;
#undef EMIT
}
/*
* Convert a string in UTF-8 format to UTF-32LE
*/
static size_t utf8_to_32le(uint8_t *str, size_t len, char *op)
{
#define EMIT(x) do { if (op) { WRITELONG(op,x); } outlen++; } while(0)
size_t outlen = 0;
int expect = 0;
uint8_t c;
uint32_t v = 0, vmin = 0;
while (len--) {
c = *str++;
if (expect) {
if ((c & 0xc0) != 0x80) {
return -1;
} else {
v = (v << 6) | (c & 0x3f);
if (!--expect) {
if (v < vmin || (v >= 0xd800 && v <= 0xdfff)) {
return -1;
} else {
EMIT(v);
}
}
continue;
}
}
if (c < 0x80) {
EMIT(c);
} else if (c < 0xc0 || c >= 0xfe) {
/* Invalid UTF-8 */
return -1;
} else if (c < 0xe0) {
v = c & 0x1f;
expect = 1;
vmin = 0x80;
} else if (c < 0xf0) {
v = c & 0x0f;
expect = 2;
vmin = 0x800;
} else if (c < 0xf8) {
v = c & 0x07;
expect = 3;
vmin = 0x10000;
} else if (c < 0xfc) {
v = c & 0x03;
expect = 4;
vmin = 0x200000;
} else {
v = c & 0x01;
expect = 5;
vmin = 0x4000000;
}
}
return expect ? (size_t)-1 : outlen << 2;
#undef EMIT
}
typedef size_t (*transform_func)(uint8_t *, size_t, char *);
/*
* Apply a specific string transform and return it in a nasm_malloc'd
* buffer, returning the length. On error, returns (size_t)-1 and no
* buffer is allocated.
*/
size_t string_transform(char *str, size_t len, char **out, enum strfunc func)
{
/* This should match enum strfunc in nasm.h */
static const transform_func str_transforms[] = {
utf8_to_16le,
utf8_to_32le,
};
transform_func transform = str_transforms[func];
size_t outlen;
uint8_t *s = (uint8_t *)str;
char *buf;
outlen = transform(s, len, NULL);
if (outlen == (size_t)-1)
return -1;
*out = buf = nasm_malloc(outlen+1);
buf[outlen] = '\0'; /* Forcibly null-terminate the buffer */
return transform(s, len, buf);
}

View file

@ -40,8 +40,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <inttypes.h>
#include "inttypes.h"
#include "nasmlib.h"
#include "sync.h"

View file

@ -1,70 +1,69 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* tables.h
*
* Declarations for auto-generated tables
*/
#ifndef NASM_TABLES_H
#define NASM_TABLES_H
#include "compiler.h"
#include <inttypes.h>
#include "insnsi.h" /* For enum opcode */
/* --- From standard.mac via macros.pl: --- */
/* macros.c */
extern const unsigned char nasm_stdmac[];
extern const unsigned char * const nasm_stdmac_after_tasm;
const unsigned char *nasm_stdmac_find_package(const char *);
/* --- From insns.dat via insns.pl: --- */
/* insnsn.c */
extern const char * const nasm_insn_names[];
/* --- From regs.dat via regs.pl: --- */
/* regs.c */
extern const char * const nasm_reg_names[];
/* regflags.c */
typedef uint64_t opflags_t;
typedef uint16_t decoflags_t;
extern const opflags_t nasm_reg_flags[];
/* regvals.c */
extern const int nasm_regvals[];
#endif /* NASM_TABLES_H */
/* ----------------------------------------------------------------------- *
*
* Copyright 1996-2009 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following
* conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ----------------------------------------------------------------------- */
/*
* tables.h
*
* Declarations for auto-generated tables
*/
#ifndef NASM_TABLES_H
#define NASM_TABLES_H
#include "compiler.h"
#include "inttypes.h"
#include "insnsi.h" /* For enum opcode */
#include "opflags.h" /* For opflags_t */
/* --- From standard.mac via macros.pl: --- */
/* macros.c */
extern const unsigned char nasm_stdmac[];
extern const unsigned char * const nasm_stdmac_after_tasm;
const unsigned char *nasm_stdmac_find_package(const char *);
/* --- From insns.dat via insns.pl: --- */
/* insnsn.c */
extern const char * const nasm_insn_names[];
/* --- From regs.dat via regs.pl: --- */
/* regs.c */
extern const char * const nasm_reg_names[];
/* regflags.c */
extern const opflags_t nasm_reg_flags[];
/* regvals.c */
extern const int nasm_regvals[];
#endif /* NASM_TABLES_H */

View file

@ -1,11 +1,11 @@
/*
* This file is generated from insns.dat, regs.dat and token.dat
* by tokhash.pl; do not edit.
*/
#ifndef NASM_TOKENS_H
#define NASM_TOKENS_H
#define MAX_KEYWORD 16 /* length of longest keyword */
#endif /* NASM_TOKENS_H */
/*
* This file is generated from insns.dat, regs.dat and token.dat
* by tokhash.pl; do not edit.
*/
#ifndef NASM_TOKENS_H
#define NASM_TOKENS_H
#define MAX_KEYWORD 16 /* length of longest keyword */
#endif /* NASM_TOKENS_H */

View file

@ -1 +1 @@
2.12.02
2.08.01

View file

@ -1,9 +1,9 @@
#ifndef NASM_VERSION_H
#define NASM_VERSION_H
#define NASM_MAJOR_VER 2
#define NASM_MINOR_VER 12
#define NASM_SUBMINOR_VER 2
#define NASM_MINOR_VER 8
#define NASM_SUBMINOR_VER 1
#define NASM_PATCHLEVEL_VER 0
#define NASM_VERSION_ID 0x020c0200
#define NASM_VER "2.12.02"
#define NASM_VERSION_ID 0x02080100
#define NASM_VER "2.08.01"
#endif /* NASM_VERSION_H */

View file

@ -5,36 +5,29 @@ options(BUILDER_OPTION) NOWARNINGS;
file
ndisasm.h,
ndisupp.cpp,
lib\ndisasm readonly separator,
lib\AUTHORS,
lib/ndisasm readonly separator,
lib\Authors,
lib\compiler.h,
lib\directiv.h,
lib\disasm.c,
lib\disasm.h,
lib\disp8.c,
lib\disp8.h,
lib\exprlib.c,
lib\iflag.c,
lib\iflag.h,
lib\iflaggen.h,
lib\ilog2.c,
lib\insns.h,
lib\insnsb.c,
lib\insnsd.c,
lib\insnsi.h,
lib\insnsn.c,
lib\inttypes.h,
lib\LICENSE,
lib\opflags.h,
lib\nasm.h,
lib\nasmlib.c,
lib\nasmlib.h,
lib\README,
lib\pptok.h,
lib\preproc.h,
lib\regdis.c,
lib\regdis.h,
lib\regs.c,
lib\regs.h,
lib\snprintf.c,
lib\strfunc.c,
lib\sync.c,
lib\sync.h,

View file

@ -8,6 +8,7 @@ extern "C" {
#undef UINT64_MAX
#include "lib/compiler.h"
#include "lib/inttypes.h"
#include "lib/disasm.h"
}