]> granicus.if.org Git - yasm/commitdiff
Fix build (hopefully) on Win64 by using uintptr_t more widely; Win64 is a
authorPeter Johnson <peter@tortall.net>
Sun, 18 Feb 2007 20:42:55 +0000 (20:42 -0000)
committerPeter Johnson <peter@tortall.net>
Sun, 18 Feb 2007 20:42:55 +0000 (20:42 -0000)
LLP64 platform so it's unsafe to cast pointers to unsigned long.

Reported by: Chris Tophe <cohika@gmail.com>

svn path=/trunk/yasm/; revision=1774

18 files changed:
Makefile.am
Mkfiles/dj/libyasm-stdint.h [moved from Mkfiles/dj/_stdint.h with 100% similarity]
Mkfiles/vc/libyasm-stdint.h [moved from Mkfiles/vc/_stdint.h with 100% similarity]
Mkfiles/vc8/libyasm-stdint.h [moved from Mkfiles/vc8/_stdint.h with 100% similarity]
configure.ac
libyasm.h
libyasm/arch.c
libyasm/arch.h
libyasm/bc-insn.c
libyasm/bytecode.h
libyasm/hamt.c
modules/arch/x86/x86arch.c
modules/arch/x86/x86arch.h
modules/arch/x86/x86bc.c
modules/arch/x86/x86id.c
modules/parsers/gas/gas-parser.h
modules/parsers/nasm/nasm-parser.h
util.h

index 40c833813e58a99baba966a9466013ddd8f5700d..21dbc393e85a64e82db8be8b928ba3f1ba4d12b7 100644 (file)
@@ -16,6 +16,7 @@ check_PROGRAMS = test_hd
 test_hd_SOURCES = test_hd.c
 
 include_HEADERS = libyasm.h
+include_HEADERS += libyasm-stdint.h
 
 noinst_HEADERS = util.h
 
@@ -25,8 +26,8 @@ BUILT_SOURCES =
 CLEANFILES = configure.lineno
 EXTRA_DIST = config/config.rpath
 
-# _stdint.h doesn't clean up after itself?
-CONFIG_CLEAN_FILES = _stdint.h
+# libyasm-stdint.h doesn't clean up after itself?
+CONFIG_CLEAN_FILES = libyasm-stdint.h
 
 # automake doesn't distribute mkinstalldirs?
 EXTRA_DIST += config/mkinstalldirs
@@ -56,11 +57,11 @@ EXTRA_DIST += splint.sh
 EXTRA_DIST += Mkfiles/Makefile.flat
 EXTRA_DIST += Mkfiles/Makefile.dj
 EXTRA_DIST += Mkfiles/dj/config.h
-EXTRA_DIST += Mkfiles/dj/_stdint.h
+EXTRA_DIST += Mkfiles/dj/libyasm-stdint.h
 EXTRA_DIST += Mkfiles/vc/yasm.sln
 EXTRA_DIST += Mkfiles/vc/yasm.vcproj
 EXTRA_DIST += Mkfiles/vc/config.h
-EXTRA_DIST += Mkfiles/vc/_stdint.h
+EXTRA_DIST += Mkfiles/vc/libyasm-stdint.h
 EXTRA_DIST += Mkfiles/vc/genmacro/genmacro.vcproj
 EXTRA_DIST += Mkfiles/vc/genmacro/run.bat
 EXTRA_DIST += Mkfiles/vc/genmodule/genmodule.vcproj
@@ -79,7 +80,7 @@ EXTRA_DIST += Mkfiles/vc8/crt_secure_no_deprecate.vsprops
 EXTRA_DIST += Mkfiles/vc8/yasm.sln
 EXTRA_DIST += Mkfiles/vc8/yasm.vcproj
 EXTRA_DIST += Mkfiles/vc8/config.h
-EXTRA_DIST += Mkfiles/vc8/_stdint.h
+EXTRA_DIST += Mkfiles/vc8/libyasm-stdint.h
 EXTRA_DIST += Mkfiles/vc8/readme.vc8.txt
 EXTRA_DIST += Mkfiles/vc8/yasm.rules
 EXTRA_DIST += Mkfiles/vc8/genmacro/genmacro.vcproj
index b34ea2506b8f407b66e30262079d2982d03fdb6c..f2efc7135d1680946ea47d2d846778476fedb723 100644 (file)
@@ -109,7 +109,7 @@ AC_C_CONST
 AC_C_INLINE
 AC_C_PROTOTYPES
 AC_TYPE_SIZE_T
-AX_CREATE_STDINT_H
+AX_CREATE_STDINT_H([libyasm-stdint.h])
 
 #
 # Checks for library functions.
index a1e1c89c75f6e69ae116224a534cda37ab21b382..b13abc280cd47b2a1a831e46c500f9ece335a039 100644 (file)
--- a/libyasm.h
+++ b/libyasm.h
 typedef struct __FILE FILE;
 typedef struct __va_list va_list;
 typedef unsigned long size_t;
+typedef unsigned long uintptr_t;
 #else
 #include <stdio.h>
 #include <stdarg.h>
+#include <libyasm-stdint.h>
 #endif
 
 #ifdef YASM_LIB_INTERNAL
index 89872c5741acb30f6b8029236c3fd6bbd6aebdc4..9fc8aea43c936cc66908f6da1ca0890439a88256 100644 (file)
@@ -39,7 +39,7 @@
 
 
 yasm_insn_operand *
-yasm_operand_create_reg(unsigned long reg)
+yasm_operand_create_reg(uintptr_t reg)
 {
     yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand));
 
@@ -54,7 +54,7 @@ yasm_operand_create_reg(unsigned long reg)
 }
 
 yasm_insn_operand *
-yasm_operand_create_segreg(unsigned long segreg)
+yasm_operand_create_segreg(uintptr_t segreg)
 {
     yasm_insn_operand *retval = yasm_xmalloc(sizeof(yasm_insn_operand));
 
@@ -87,7 +87,7 @@ yasm_insn_operand *
 yasm_operand_create_imm(/*@only@*/ yasm_expr *val)
 {
     yasm_insn_operand *retval;
-    const unsigned long *reg;
+    const uintptr_t *reg;
 
     reg = yasm_expr_get_reg(&val, 0);
     if (reg) {
index 0931b84fdf723852308d7551f113683d28839dce..7646dc715b6537b62f50121f0e1117c49bf36881 100644 (file)
@@ -142,14 +142,14 @@ typedef struct yasm_arch_module {
      * Call yasm_arch_parse_check_insnprefix() instead of calling this function.
      */
     yasm_arch_insnprefix (*parse_check_insnprefix)
-       (yasm_arch *arch, /*@out@*/ unsigned long data[4], const char *id,
+       (yasm_arch *arch, /*@out@*/ uintptr_t data[4], const char *id,
         size_t id_len);
 
     /** Module-level implementation of yasm_arch_parse_check_regtmod().
      * Call yasm_arch_parse_check_regtmod() instead of calling this function.
      */
     yasm_arch_regtmod (*parse_check_regtmod)
-       (yasm_arch *arch, /*@out@*/ unsigned long *data, const char *id,
+       (yasm_arch *arch, /*@out@*/ uintptr_t *data, const char *id,
         size_t id_len);
 
     /** Module-level implementation of yasm_arch_parse_directive().
@@ -170,10 +170,9 @@ typedef struct yasm_arch_module {
      */
     void (*finalize_insn)
        (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc,
-        const unsigned long data[4], int num_operands,
+        const uintptr_t data[4], int num_operands,
         /*@null@*/ yasm_insn_operands *operands, int num_prefixes,
-        unsigned long **prefixes, int num_segregs,
-        const unsigned long *segregs);
+        uintptr_t **prefixes, int num_segregs, const uintptr_t *segregs);
 
     /** Module-level implementation of yasm_arch_floatnum_tobytes().
      * Call yasm_arch_floatnum_tobytes() instead of calling this function.
@@ -193,23 +192,23 @@ typedef struct yasm_arch_module {
     /** Module-level implementation of yasm_arch_get_reg_size().
      * Call yasm_arch_get_reg_size() instead of calling this function.
      */
-    unsigned int (*get_reg_size) (yasm_arch *arch, unsigned long reg);
+    unsigned int (*get_reg_size) (yasm_arch *arch, uintptr_t reg);
 
     /** Module-level implementation of yasm_arch_reggroup_get_reg().
      * Call yasm_arch_reggroup_get_reg() instead of calling this function.
      */
-    unsigned long (*reggroup_get_reg) (yasm_arch *arch, unsigned long reggroup,
-                                      unsigned long regindex);
+    uintptr_t (*reggroup_get_reg) (yasm_arch *arch, uintptr_t reggroup,
+                                  unsigned long regindex);
 
     /** Module-level implementation of yasm_arch_reg_print().
      * Call yasm_arch_reg_print() instead of calling this function.
      */
-    void (*reg_print) (yasm_arch *arch, unsigned long reg, FILE *f);
+    void (*reg_print) (yasm_arch *arch, uintptr_t reg, FILE *f);
 
     /** Module-level implementation of yasm_arch_segreg_print().
      * Call yasm_arch_segreg_print() instead of calling this function.
      */
-    void (*segreg_print) (yasm_arch *arch, unsigned long segreg, FILE *f);
+    void (*segreg_print) (yasm_arch *arch, uintptr_t segreg, FILE *f);
 
     /** Module-level implementation of yasm_arch_ea_create().
      * Call yasm_arch_ea_create() instead of calling this function.
@@ -258,15 +257,15 @@ struct yasm_insn_operand {
 
     /** Operand data. */
     union {
-       unsigned long reg;  /**< Arch data for reg/segreg. */
+       uintptr_t reg;      /**< Arch data for reg/segreg. */
        yasm_effaddr *ea;   /**< Effective address for memory references. */
        yasm_expr *val;     /**< Value of immediate or jump target. */
     } data;
 
-    unsigned long targetmod;   /**< Arch target modifier, 0 if none. */
+    uintptr_t targetmod;       /**< Arch target modifier, 0 if none. */
 
     /** Specified size of the operand, in bytes.  0 if not user-specified. */
-    unsigned int size;
+    unsigned int size:8;
 
     /** Nonzero if dereference.  Used for "*foo" in GAS.
      * The reason for this is that by default in GAS, an unprefixed value
@@ -375,7 +374,7 @@ void yasm_arch_parse_cpu(yasm_arch *arch, const char *cpuid, size_t cpuid_len);
  * \return Identifier type (#YASM_ARCH_NOTINSNPREFIX if unrecognized)
  */
 yasm_arch_insnprefix yasm_arch_parse_check_insnprefix
-    (yasm_arch *arch, /*@out@*/ unsigned long data[4], const char *id,
+    (yasm_arch *arch, /*@out@*/ uintptr_t data[4], const char *id,
      size_t id_len);
 
 /** Check an generic identifier to see if it matches architecture specific
@@ -391,7 +390,7 @@ yasm_arch_insnprefix yasm_arch_parse_check_insnprefix
  * \return Identifier type (#YASM_ARCH_NOTREGTMOD if unrecognized)
  */
 yasm_arch_regtmod yasm_arch_parse_check_regtmod
-    (yasm_arch *arch, /*@out@*/ unsigned long *data, const char *id,
+    (yasm_arch *arch, /*@out@*/ uintptr_t *data, const char *id,
      size_t id_len);
 
 /** Handle architecture-specific directives.
@@ -436,10 +435,9 @@ const unsigned char **yasm_arch_get_fill(const yasm_arch *arch);
  */
 void yasm_arch_finalize_insn
     (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc,
-     const unsigned long data[4], int num_operands,
+     const uintptr_t data[4], int num_operands,
      /*@null@*/ yasm_insn_operands *operands, int num_prefixes,
-     const unsigned long **prefixes, int num_segregs,
-     const unsigned long *segregs);
+     const uintptr_t **prefixes, int num_segregs, const uintptr_t *segregs);
 
 /** Output #yasm_floatnum to buffer.  Puts the value into the least
  * significant bits of the destination, or may be shifted into more
@@ -485,7 +483,7 @@ int yasm_arch_intnum_tobytes(yasm_arch *arch, const yasm_intnum *intn,
  * \param reg  register
  * \return 0 if there is no suitable equivalent size, otherwise the size.
  */
-unsigned int yasm_arch_get_reg_size(yasm_arch *arch, unsigned long reg);
+unsigned int yasm_arch_get_reg_size(yasm_arch *arch, uintptr_t reg);
 
 /** Get a specific register of a register group, based on the register
  * group and the index within the group.
@@ -495,23 +493,22 @@ unsigned int yasm_arch_get_reg_size(yasm_arch *arch, unsigned long reg);
  * \return 0 if regindex is not valid for that register group, otherwise the
  *         specific register value.
  */
-unsigned long yasm_arch_reggroup_get_reg(yasm_arch *arch,
-                                        unsigned long reggroup,
-                                        unsigned long regindex);
+uintptr_t yasm_arch_reggroup_get_reg(yasm_arch *arch, uintptr_t reggroup,
+                                    unsigned long regindex);
 
 /** Print a register.  For debugging purposes.
  * \param arch         architecture
  * \param reg          register
  * \param f            file
  */
-void yasm_arch_reg_print(yasm_arch *arch, unsigned long reg, FILE *f);
+void yasm_arch_reg_print(yasm_arch *arch, uintptr_t reg, FILE *f);
 
 /** Print a segment register.  For debugging purposes.
  * \param arch         architecture
  * \param segreg       segment register
  * \param f            file
  */
-void yasm_arch_segreg_print(yasm_arch *arch, unsigned long segreg, FILE *f);
+void yasm_arch_segreg_print(yasm_arch *arch, uintptr_t segreg, FILE *f);
 
 /** Create an effective address from an expression.
  * \param arch architecture
@@ -590,13 +587,13 @@ yasm_effaddr *yasm_arch_ea_create(yasm_arch *arch, /*@keep@*/ yasm_expr *e);
  * \param reg  register
  * \return Newly allocated operand.
  */
-yasm_insn_operand *yasm_operand_create_reg(unsigned long reg);
+yasm_insn_operand *yasm_operand_create_reg(uintptr_t reg);
 
 /** Create an instruction operand from a segment register.
  * \param segreg       segment register
  * \return Newly allocated operand.
  */
-yasm_insn_operand *yasm_operand_create_segreg(unsigned long segreg);
+yasm_insn_operand *yasm_operand_create_segreg(uintptr_t segreg);
 
 /** Create an instruction operand from an effective address.
  * \param ea   effective address
index d32346b3cce0eb06541bac1e566052b5493f901f..c7dd18916e2b163b72dba9a678afb74543aeaff5 100644 (file)
 
 typedef struct bytecode_insn {
     /*@dependent@*/ yasm_arch *arch;
-    unsigned long insn_data[4];
+    uintptr_t insn_data[4];
 
     int num_operands;
     /*@null@*/ yasm_insn_operands operands;
 
     /* array of 4-element prefix_data arrays */
     int num_prefixes;
-    /*@null@*/ unsigned long **prefixes;
+    /*@null@*/ uintptr_t **prefixes;
 
     /* array of segment prefixes */
     int num_segregs;
-    /*@null@*/ unsigned long *segregs;
+    /*@null@*/ uintptr_t *segregs;
 } bytecode_insn;
 
 static void bc_insn_destroy(void *contents);
@@ -114,7 +114,7 @@ yasm_ea_set_strong(yasm_effaddr *ptr, unsigned int strong)
 }
 
 void
-yasm_ea_set_segreg(yasm_effaddr *ea, unsigned long segreg)
+yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg)
 {
     if (!ea)
        return;
@@ -257,7 +257,7 @@ bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
 }
 
 yasm_bytecode *
-yasm_bc_create_insn(yasm_arch *arch, const unsigned long insn_data[4],
+yasm_bc_create_insn(yasm_arch *arch, const uintptr_t insn_data[4],
                    int num_operands, /*@null@*/ yasm_insn_operands *operands,
                    unsigned long line)
 {
@@ -302,7 +302,7 @@ yasm_bc_create_empty_insn(yasm_arch *arch, unsigned long line)
 }
 
 void
-yasm_bc_insn_add_prefix(yasm_bytecode *bc, const unsigned long prefix_data[4])
+yasm_bc_insn_add_prefix(yasm_bytecode *bc, const uintptr_t prefix_data[4])
 {
     bytecode_insn *insn = (bytecode_insn *)bc->contents;
 
@@ -310,9 +310,8 @@ yasm_bc_insn_add_prefix(yasm_bytecode *bc, const unsigned long prefix_data[4])
 
     insn->prefixes =
        yasm_xrealloc(insn->prefixes,
-                     (insn->num_prefixes+1)*sizeof(unsigned long *));
-    insn->prefixes[insn->num_prefixes] =
-       yasm_xmalloc(4*sizeof(unsigned long));
+                     (insn->num_prefixes+1)*sizeof(uintptr_t *));
+    insn->prefixes[insn->num_prefixes] = yasm_xmalloc(4*sizeof(uintptr_t));
     insn->prefixes[insn->num_prefixes][0] = prefix_data[0];
     insn->prefixes[insn->num_prefixes][1] = prefix_data[1];
     insn->prefixes[insn->num_prefixes][2] = prefix_data[2];
@@ -321,15 +320,14 @@ yasm_bc_insn_add_prefix(yasm_bytecode *bc, const unsigned long prefix_data[4])
 }
 
 void
-yasm_bc_insn_add_seg_prefix(yasm_bytecode *bc, unsigned long segreg)
+yasm_bc_insn_add_seg_prefix(yasm_bytecode *bc, uintptr_t segreg)
 {
     bytecode_insn *insn = (bytecode_insn *)bc->contents;
 
     assert(bc->callback == bc_insn_callback);
 
     insn->segregs =
-       yasm_xrealloc(insn->segregs,
-                     (insn->num_segregs+1)*sizeof(unsigned long));
+       yasm_xrealloc(insn->segregs, (insn->num_segregs+1)*sizeof(uintptr_t));
     insn->segregs[insn->num_segregs] = segreg;
     insn->num_segregs++;
 }
index 96a4760bb68de4c9e32d91e4fd3a42fd9ef8f9b2..e856a6311a2b6f6e5671364dcaccb8f015b320d0 100644 (file)
@@ -58,7 +58,7 @@ struct yasm_effaddr {
 
     yasm_value disp;           /**< address displacement */
 
-    unsigned long segreg;      /**< segment register override (0 if none) */
+    uintptr_t segreg;          /**< segment register override (0 if none) */
 
     unsigned char need_nonzero_len; /**< 1 if length of disp must be >0. */
     unsigned char need_disp;   /**< 1 if a displacement should be present
@@ -121,7 +121,7 @@ void yasm_ea_set_strong(yasm_effaddr *ea, unsigned int strong);
  * \param ea           effective address
  * \param segreg       segment register (0 if none)
  */
-void yasm_ea_set_segreg(yasm_effaddr *ea, unsigned long segreg);
+void yasm_ea_set_segreg(yasm_effaddr *ea, uintptr_t segreg);
 
 /** Delete (free allocated memory for) an effective address.
  * \param ea   effective address (only pointer to it).
@@ -228,7 +228,7 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e);
  *       giving operands to this function.
  */
 /*@only@*/ yasm_bytecode *yasm_bc_create_insn
-    (yasm_arch *arch, const unsigned long insn_data[4], int num_operands,
+    (yasm_arch *arch, const uintptr_t insn_data[4], int num_operands,
      /*@null@*/ yasm_insn_operands *operands, unsigned long line);
 
 /** Create a bytecode that represents a single empty (0 length) instruction.
@@ -245,13 +245,13 @@ void yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e);
  * \param prefix_data  data the identifies the prefix
  */
 void yasm_bc_insn_add_prefix(yasm_bytecode *bc,
-                            const unsigned long prefix_data[4]);
+                            const uintptr_t prefix_data[4]);
 
 /** Associate a segment prefix with an instruction bytecode.
  * \param bc           instruction bytecode
  * \param segreg       data the identifies the segment register
  */
-void yasm_bc_insn_add_seg_prefix(yasm_bytecode *bc, unsigned long segreg);
+void yasm_bc_insn_add_seg_prefix(yasm_bytecode *bc, uintptr_t segreg);
 
 /** Get the section that contains a particular bytecode.
  * \param bc   bytecode
@@ -378,7 +378,7 @@ int yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val,
      /*@null@*/ yasm_output_reloc_func output_reloc)
     /*@sets *buf@*/;
 
-/** Get the bytecode multiple value as an unsigned long integer.
+/** Get the bytecode multiple value as an integer.
  * \param bc           bytecode
  * \param multiple     multiple value (output)
  * \param calc_bc_dist nonzero if distances between bytecodes should be
index 129bae1496e8262f807117a2bf2d9e5eed858400..2243bc62d49ee618d4c42f38a90c98228d0445d7 100644 (file)
@@ -35,7 +35,6 @@
 
 #include "coretype.h"
 #include "hamt.h"
-#include "_stdint.h"                   /* for uintptr_t */
 
 struct HAMTEntry {
     STAILQ_ENTRY(HAMTEntry) next;      /* next hash table entry */
index c5b6ee04577bc7b787d24fa570c7a46590d1756f..645c0b982de0cbe3cedaae94ec8fd5ae657e4ab3 100644 (file)
@@ -320,7 +320,7 @@ x86_get_fill(const yasm_arch *arch)
 }
 
 unsigned int
-yasm_x86__get_reg_size(yasm_arch *arch, unsigned long reg)
+yasm_x86__get_reg_size(yasm_arch *arch, uintptr_t reg)
 {
     switch ((x86_expritem_reg_size)(reg & ~0xFUL)) {
        case X86_REG8:
@@ -346,8 +346,8 @@ yasm_x86__get_reg_size(yasm_arch *arch, unsigned long reg)
     return 0;
 }
 
-static unsigned long
-x86_reggroup_get_reg(yasm_arch *arch, unsigned long reggroup,
+static uintptr_t
+x86_reggroup_get_reg(yasm_arch *arch, uintptr_t reggroup,
                     unsigned long regindex)
 {
     yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
@@ -371,7 +371,7 @@ x86_reggroup_get_reg(yasm_arch *arch, unsigned long reggroup,
 }
 
 static void
-x86_reg_print(yasm_arch *arch, unsigned long reg, FILE *f)
+x86_reg_print(yasm_arch *arch, uintptr_t reg, FILE *f)
 {
     static const char *name8[] = {"al","cl","dl","bl","ah","ch","dh","bh"};
     static const char *name8x[] = {
@@ -431,7 +431,7 @@ x86_reg_print(yasm_arch *arch, unsigned long reg, FILE *f)
 }
 
 static void
-x86_segreg_print(yasm_arch *arch, unsigned long segreg, FILE *f)
+x86_segreg_print(yasm_arch *arch, uintptr_t segreg, FILE *f)
 {
     static const char *name[] = {"es","cs","ss","ds","fs","gs"};
     fprintf(f, "%s", name[segreg&7]);
index d44ed76e368f802e8236155c4ade3a9e82947c2d..24b39bd6a5b4fb0a368397cc72d0784d904e50a0 100644 (file)
@@ -134,7 +134,7 @@ typedef enum {
  * in 64-bit mode or if it wasn't needed to express reg.
  */
 int yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3,
-                              unsigned long reg, unsigned int bits,
+                              uintptr_t reg, unsigned int bits,
                               x86_rex_bit_pos rexbit);
 
 /* Effective address type */
@@ -250,7 +250,7 @@ void yasm_x86__bc_transform_jmpfar(yasm_bytecode *bc, x86_jmpfar *jmpfar);
 
 void yasm_x86__bc_apply_prefixes
     (x86_common *common, unsigned char *rex, int num_prefixes,
-     unsigned long **prefixes);
+     uintptr_t **prefixes);
 
 /* Check an effective address.  Returns 0 if EA was successfully determined,
  * 1 if invalid EA, or 2 if indeterminate EA.
@@ -262,17 +262,17 @@ int yasm_x86__expr_checkea
 void yasm_x86__parse_cpu(yasm_arch *arch, const char *cpuid, size_t cpuid_len);
 
 yasm_arch_insnprefix yasm_x86__parse_check_insnprefix
-    (yasm_arch *arch, /*@out@*/ unsigned long data[4], const char *id,
+    (yasm_arch *arch, /*@out@*/ uintptr_t data[4], const char *id,
      size_t id_len);
 yasm_arch_regtmod yasm_x86__parse_check_regtmod
-    (yasm_arch *arch, /*@out@*/ unsigned long *data, const char *id,
+    (yasm_arch *arch, /*@out@*/ uintptr_t *data, const char *id,
      size_t id_len);
 
 void yasm_x86__finalize_insn
     (yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc,
-     const unsigned long data[4], int num_operands,
+     const uintptr_t data[4], int num_operands,
      /*@null@*/ yasm_insn_operands *operands, int num_prefixes,
-     unsigned long **prefixes, int num_segregs, const unsigned long *segregs);
+     uintptr_t **prefixes, int num_segregs, const uintptr_t *segregs);
 
 int yasm_x86__floatnum_tobytes
     (yasm_arch *arch, const yasm_floatnum *flt, unsigned char *buf,
@@ -282,5 +282,5 @@ int yasm_x86__intnum_tobytes
      size_t destsize, size_t valsize, int shift, const yasm_bytecode *bc,
      int warn);
 
-unsigned int yasm_x86__get_reg_size(yasm_arch *arch, unsigned long reg);
+unsigned int yasm_x86__get_reg_size(yasm_arch *arch, uintptr_t reg);
 #endif
index 63c63716ba91c58f14c8cd66a0dc53ba5b63dffc..f60727879dbfb57108e942e1fdaa2c76fec81c68 100644 (file)
@@ -119,7 +119,7 @@ static const yasm_bytecode_callback x86_bc_callback_jmpfar = {
 
 int
 yasm_x86__set_rex_from_reg(unsigned char *rex, unsigned char *low3,
-                          unsigned long reg, unsigned int bits,
+                          uintptr_t reg, unsigned int bits,
                           x86_rex_bit_pos rexbit)
 {
     *low3 = (unsigned char)(reg&7);
@@ -286,7 +286,7 @@ yasm_x86__ea_create_imm(yasm_expr *imm, unsigned int im_len)
 
 void
 yasm_x86__bc_apply_prefixes(x86_common *common, unsigned char *rex,
-                           int num_prefixes, unsigned long **prefixes)
+                           int num_prefixes, uintptr_t **prefixes)
 {
     int i;
     int first = 1;
index 39e4b6cc5cc9f8d67e00d9ba0e310e70f74883ad..46474b9b35c8dce3368c49834b1344d6eb776422 100644 (file)
@@ -2116,9 +2116,9 @@ x86_finalize_opcode(x86_opcode *opcode, const x86_insn_info *info)
 
 static void
 x86_finalize_jmpfar(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc,
-                   const unsigned long data[4], int num_operands,
+                   const uintptr_t data[4], int num_operands,
                    yasm_insn_operands *operands, int num_prefixes,
-                   unsigned long **prefixes, const x86_insn_info *info)
+                   uintptr_t **prefixes, const x86_insn_info *info)
 {
     x86_jmpfar *jmpfar;
     yasm_insn_operand *op;
@@ -2164,9 +2164,9 @@ x86_finalize_jmpfar(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc,
 
 static void
 x86_finalize_jmp(yasm_arch *arch, yasm_bytecode *bc, yasm_bytecode *prev_bc,
-                const unsigned long data[4], int num_operands,
+                const uintptr_t data[4], int num_operands,
                 yasm_insn_operands *operands, int num_prefixes,
-                unsigned long **prefixes, const x86_insn_info *jinfo)
+                uintptr_t **prefixes, const x86_insn_info *jinfo)
 {
     x86_jmp *jmp;
     int num_info = (int)(data[1]&0xFF);
@@ -2669,11 +2669,11 @@ x86_match_error(yasm_arch *arch, int num_info, const x86_insn_info *info,
 
 void
 yasm_x86__finalize_insn(yasm_arch *arch, yasm_bytecode *bc,
-                       yasm_bytecode *prev_bc, const unsigned long data[4],
+                       yasm_bytecode *prev_bc, const uintptr_t data[4],
                        int num_operands,
                        /*@null@*/ yasm_insn_operands *operands,
-                       int num_prefixes, unsigned long **prefixes,
-                       int num_segregs, const unsigned long *segregs)
+                       int num_prefixes, uintptr_t **prefixes,
+                       int num_segregs, const uintptr_t *segregs)
 {
     yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
     x86_insn *insn;
@@ -3208,7 +3208,7 @@ cpu_find_reverse(unsigned long cpu)
 }
 
 yasm_arch_insnprefix
-yasm_x86__parse_check_insnprefix(yasm_arch *arch, unsigned long data[4],
+yasm_x86__parse_check_insnprefix(yasm_arch *arch, uintptr_t data[4],
                                 const char *id, size_t id_len)
 {
     yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
@@ -3246,7 +3246,7 @@ yasm_x86__parse_check_insnprefix(yasm_arch *arch, unsigned long data[4],
        if ((cpu & CPU_Not64) && arch_x86->mode_bits == 64) {
            yasm_error_set(YASM_ERROR_GENERAL,
                           N_("`%s' invalid in 64-bit mode"), id);
-           data[0] = (unsigned long)not64_insn;
+           data[0] = (uintptr_t)not64_insn;
            data[1] = NELEMS(not64_insn);
            data[2] = CPU_Not64;
            data[3] = arch_x86->mode_bits;
@@ -3261,7 +3261,7 @@ yasm_x86__parse_check_insnprefix(yasm_arch *arch, unsigned long data[4],
            return YASM_ARCH_NOTINSNPREFIX;
        }
 
-       data[0] = (unsigned long)pdata->group;
+       data[0] = (uintptr_t)pdata->group;
        data[1] = pdata->data1;
        data[2] = arch_x86->cpu_enabled;
        data[3] = (((unsigned long)pdata->flags)<<8) | arch_x86->mode_bits;
@@ -3330,7 +3330,7 @@ yasm_x86__parse_cpu(yasm_arch *arch, const char *cpuid, size_t cpuid_len)
 }
 
 yasm_arch_regtmod
-yasm_x86__parse_check_regtmod(yasm_arch *arch, unsigned long *data,
+yasm_x86__parse_check_regtmod(yasm_arch *arch, uintptr_t *data,
                              const char *id, size_t id_len)
 {
     yasm_arch_x86 *arch_x86 = (yasm_arch_x86 *)arch;
index 23c51df3f49a0fd015540a99edf47da0a6211f91..80a92cd37867d1dcb2bfc785342aec4bba61e366 100644 (file)
@@ -82,7 +82,7 @@ typedef union {
     char *str_val;
     yasm_intnum *intn;
     yasm_floatnum *flt;
-    unsigned long arch_data[4];
+    uintptr_t arch_data[4];
     struct {
        char *contents;
        size_t len;
index 8d443e1c5251ad30f2de5c5898d78847886679bf..3eff7b9dea5b38591109ef986358ab431f3ccc22 100644 (file)
@@ -69,7 +69,7 @@ typedef union {
     char *str_val;
     yasm_intnum *intn;
     yasm_floatnum *flt;
-    unsigned long arch_data[4];
+    uintptr_t arch_data[4];
     struct {
        char *contents;
        size_t len;
diff --git a/util.h b/util.h
index 842f02118449947431a03b9ea38ac806d35520d0..2b95319765269ea22428c0407fda162e3ec04a4a 100644 (file)
--- a/util.h
+++ b/util.h
@@ -60,6 +60,8 @@
 #include <string.h>
 #include <assert.h>
 
+#include <libyasm-stdint.h>
+
 #include <libyasm/coretype.h>
 
 #ifdef lint