From: Peter Johnson Date: Sun, 18 Feb 2007 20:42:55 +0000 (-0000) Subject: Fix build (hopefully) on Win64 by using uintptr_t more widely; Win64 is a X-Git-Tag: v0.6.0~13 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8aa68a2ee26af6f76551cb5be25bc5c9925abac2;p=yasm Fix build (hopefully) on Win64 by using uintptr_t more widely; Win64 is a LLP64 platform so it's unsafe to cast pointers to unsigned long. Reported by: Chris Tophe svn path=/trunk/yasm/; revision=1774 --- diff --git a/Makefile.am b/Makefile.am index 40c83381..21dbc393 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/Mkfiles/dj/_stdint.h b/Mkfiles/dj/libyasm-stdint.h similarity index 100% rename from Mkfiles/dj/_stdint.h rename to Mkfiles/dj/libyasm-stdint.h diff --git a/Mkfiles/vc/_stdint.h b/Mkfiles/vc/libyasm-stdint.h similarity index 100% rename from Mkfiles/vc/_stdint.h rename to Mkfiles/vc/libyasm-stdint.h diff --git a/Mkfiles/vc8/_stdint.h b/Mkfiles/vc8/libyasm-stdint.h similarity index 100% rename from Mkfiles/vc8/_stdint.h rename to Mkfiles/vc8/libyasm-stdint.h diff --git a/configure.ac b/configure.ac index b34ea250..f2efc713 100644 --- a/configure.ac +++ b/configure.ac @@ -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. diff --git a/libyasm.h b/libyasm.h index a1e1c89c..b13abc28 100644 --- a/libyasm.h +++ b/libyasm.h @@ -48,9 +48,11 @@ typedef struct __FILE FILE; typedef struct __va_list va_list; typedef unsigned long size_t; +typedef unsigned long uintptr_t; #else #include #include +#include #endif #ifdef YASM_LIB_INTERNAL diff --git a/libyasm/arch.c b/libyasm/arch.c index 89872c57..9fc8aea4 100644 --- a/libyasm/arch.c +++ b/libyasm/arch.c @@ -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) { diff --git a/libyasm/arch.h b/libyasm/arch.h index 0931b84f..7646dc71 100644 --- a/libyasm/arch.h +++ b/libyasm/arch.h @@ -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 diff --git a/libyasm/bc-insn.c b/libyasm/bc-insn.c index d32346b3..c7dd1891 100644 --- a/libyasm/bc-insn.c +++ b/libyasm/bc-insn.c @@ -42,18 +42,18 @@ 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++; } diff --git a/libyasm/bytecode.h b/libyasm/bytecode.h index 96a4760b..e856a631 100644 --- a/libyasm/bytecode.h +++ b/libyasm/bytecode.h @@ -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 diff --git a/libyasm/hamt.c b/libyasm/hamt.c index 129bae14..2243bc62 100644 --- a/libyasm/hamt.c +++ b/libyasm/hamt.c @@ -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 */ diff --git a/modules/arch/x86/x86arch.c b/modules/arch/x86/x86arch.c index c5b6ee04..645c0b98 100644 --- a/modules/arch/x86/x86arch.c +++ b/modules/arch/x86/x86arch.c @@ -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]); diff --git a/modules/arch/x86/x86arch.h b/modules/arch/x86/x86arch.h index d44ed76e..24b39bd6 100644 --- a/modules/arch/x86/x86arch.h +++ b/modules/arch/x86/x86arch.h @@ -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 diff --git a/modules/arch/x86/x86bc.c b/modules/arch/x86/x86bc.c index 63c63716..f6072787 100644 --- a/modules/arch/x86/x86bc.c +++ b/modules/arch/x86/x86bc.c @@ -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; diff --git a/modules/arch/x86/x86id.c b/modules/arch/x86/x86id.c index 39e4b6cc..46474b9b 100644 --- a/modules/arch/x86/x86id.c +++ b/modules/arch/x86/x86id.c @@ -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; diff --git a/modules/parsers/gas/gas-parser.h b/modules/parsers/gas/gas-parser.h index 23c51df3..80a92cd3 100644 --- a/modules/parsers/gas/gas-parser.h +++ b/modules/parsers/gas/gas-parser.h @@ -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; diff --git a/modules/parsers/nasm/nasm-parser.h b/modules/parsers/nasm/nasm-parser.h index 8d443e1c..3eff7b9d 100644 --- a/modules/parsers/nasm/nasm-parser.h +++ b/modules/parsers/nasm/nasm-parser.h @@ -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 842f0211..2b953197 100644 --- a/util.h +++ b/util.h @@ -60,6 +60,8 @@ #include #include +#include + #include #ifdef lint