145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** 245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \file libyasm/bytecode.h 345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \brief YASM bytecode interface. 445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \license 645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Copyright (C) 2001-2007 Peter Johnson 745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Redistribution and use in source and binary forms, with or without 945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * modification, are permitted provided that the following conditions 1045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * are met: 1145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - Redistributions of source code must retain the above copyright 1245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * notice, this list of conditions and the following disclaimer. 1345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - Redistributions in binary form must reproduce the above copyright 1445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * notice, this list of conditions and the following disclaimer in the 1545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * documentation and/or other materials provided with the distribution. 1645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 1745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND OTHER CONTRIBUTORS ``AS IS'' 1845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR OTHER CONTRIBUTORS BE 2145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 2245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 2345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 2445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 2545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 2645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 2745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * POSSIBILITY OF SUCH DAMAGE. 2845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \endlicense 2945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 3045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef YASM_BYTECODE_H 3145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define YASM_BYTECODE_H 3245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef YASM_LIB_DECL 3445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define YASM_LIB_DECL 3545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif 3645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 3745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** A data value (opaque type). */ 3845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef struct yasm_dataval yasm_dataval; 3945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** A list of data values. */ 4045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef struct yasm_datavalhead yasm_datavalhead; 4145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Linked list of data values. */ 4345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@reldef@*/ STAILQ_HEAD(yasm_datavalhead, yasm_dataval); 4445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 4545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Add a dependent span for a bytecode. 4645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param add_span_data add_span_data passed into bc_calc_len() 4745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode containing span 4845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param id non-zero identifier for span; may be any non-zero value 4945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * if <0, expand is called for any change; 5045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * if >0, expand is only called when exceeds threshold 5145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param value dependent value for bytecode expansion 5245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param neg_thres negative threshold for long/short decision 5345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param pos_thres positive threshold for long/short decision 5445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 5545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef void (*yasm_bc_add_span_func) 5645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (void *add_span_data, yasm_bytecode *bc, int id, const yasm_value *value, 5745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org long neg_thres, long pos_thres); 5845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 5945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Bytecode callback structure. Any implementation of a specific bytecode 6045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * must implement these functions and this callback structure. The bytecode 6145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * implementation-specific data is stored in #yasm_bytecode.contents. 6245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 6345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtypedef struct yasm_bytecode_callback { 6445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Destroys the implementation-specific data. 6545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Called from yasm_bc_destroy(). 6645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param contents #yasm_bytecode.contents 6745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 6845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void (*destroy) (/*@only@*/ void *contents); 6945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 7045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Prints the implementation-specific data (for debugging purposes). 7145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Called from yasm_bc_print(). 7245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param contents #yasm_bytecode.contents 7345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param f file 7445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param indent_level indentation level 7545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 7645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void (*print) (const void *contents, FILE *f, int indent_level); 7745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 7845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Finalizes the bytecode after parsing. Called from yasm_bc_finalize(). 7945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * A generic fill-in for this is yasm_bc_finalize_common(). 8045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 8145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param prev_bc bytecode directly preceding bc 8245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 8345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void (*finalize) (yasm_bytecode *bc, yasm_bytecode *prev_bc); 8445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 8545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Return elements size of a data bytecode. 8645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * This function should return the size of each elements of a data 8745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * bytecode, for proper dereference of symbols attached to it. 8845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 8945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 0 if element size is unknown. 9045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 9145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int (*elem_size) (yasm_bytecode *bc); 9245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 9345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Calculates the minimum size of a bytecode. 9445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Called from yasm_bc_calc_len(). 9545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * A generic fill-in for this is yasm_bc_calc_len_common(), but as this 9645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * function internal errors when called, be very careful when using it! 9745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * This function should simply add to bc->len and not set it directly 9845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (it's initialized by yasm_bc_calc_len() prior to passing control to 9945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * this function). 10045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 10145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 10245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param add_span function to call to add a span 10345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param add_span_data extra data to be passed to add_span function 10445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 0 if no error occurred, nonzero if there was an error 10545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * recognized (and output) during execution. 10645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note May store to bytecode updated expressions. 10745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 10845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int (*calc_len) (yasm_bytecode *bc, yasm_bc_add_span_func add_span, 10945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *add_span_data); 11045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 11145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Recalculates the bytecode's length based on an expanded span length. 11245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Called from yasm_bc_expand(). 11345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * A generic fill-in for this is yasm_bc_expand_common(), but as this 11445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * function internal errors when called, if used, ensure that calc_len() 11545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * never adds a span. 11645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * This function should simply add to bc->len to increase the length by 11745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * a delta amount. 11845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 11945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param span span ID (as given to add_span in calc_len) 12045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param old_val previous span value 12145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param new_val new span value 12245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param neg_thres negative threshold for long/short decision 12345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (returned) 12445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param pos_thres positive threshold for long/short decision 12545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (returned) 12645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 0 if bc no longer dependent on this span's length, negative if 12745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * there was an error recognized (and output) during execution, 12845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * and positive if bc size may increase for this span further 12945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * based on the new negative and positive thresholds returned. 13045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note May store to bytecode updated expressions. 13145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 13245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int (*expand) (yasm_bytecode *bc, int span, long old_val, long new_val, 13345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); 13445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 13545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Convert a bytecode into its byte representation. 13645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Called from yasm_bc_tobytes(). 13745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * A generic fill-in for this is yasm_bc_tobytes_common(), but as this 13845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * function internal errors when called, be very careful when using it! 13945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 14045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bufp byte representation destination buffer; 14145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * should be incremented as it's written to, 14245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * so that on return its delta from the 14345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * passed-in buf matches the bytecode length 14445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (it's okay not to do this if an error 14545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * indication is returned) 146d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org * \param bufstart For calculating the correct offset parameter for 147d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org * the \a output_value calls: *bufp - bufstart. 14845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param d data to pass to each call to 14945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * output_value/output_reloc 15045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param output_value function to call to convert values into their byte 15145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * representation 15245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param output_reloc function to call to output relocation entries 15345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * for a single sym 15445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Nonzero on error, 0 on success. 15545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note May result in non-reversible changes to the bytecode, but it's 15645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * preferable if calling this function twice would result in the 15745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * same output. 15845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 159d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org int (*tobytes) (yasm_bytecode *bc, unsigned char **bufp, 160d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org unsigned char *bufstart, void *d, 16145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_output_value_func output_value, 16245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ yasm_output_reloc_func output_reloc); 16345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 16445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Special bytecode classifications. Most bytecode types should use 16545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * #YASM_BC_SPECIAL_NONE. Others cause special handling to kick in 16645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * in various parts of yasm. 16745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 16845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org enum yasm_bytecode_special_type { 16945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_BC_SPECIAL_NONE = 0, 17045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 17145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Bytecode reserves space instead of outputting data. */ 17245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_BC_SPECIAL_RESERVE, 17345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 17445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Adjusts offset instead of calculating len. */ 17545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_BC_SPECIAL_OFFSET, 17645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 17745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Instruction bytecode. */ 17845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org YASM_BC_SPECIAL_INSN 17945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org } special; 18045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} yasm_bytecode_callback; 18145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 18245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** A bytecode. */ 18345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstruct yasm_bytecode { 18445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Bytecodes are stored as a singly linked list, with tail insertion. 18545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \see section.h (#yasm_section). 18645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 18745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@reldef@*/ STAILQ_ENTRY(yasm_bytecode) link; 18845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 18945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** The bytecode callback structure for this bytecode. May be NULL 19045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * during partial initialization. 19145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 19245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ const yasm_bytecode_callback *callback; 19345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 19445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Pointer to section containing bytecode; NULL if not part of a 19545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * section. 19645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 19745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@dependent@*/ /*@null@*/ yasm_section *section; 19845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 19945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Number of times bytecode is repeated. 20045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * NULL=1 (to save space in the common case). 20145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 20245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@only@*/ /*@null@*/ yasm_expr *multiple; 20345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 20445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Total length of entire bytecode (not including multiple copies). */ 20545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long len; 20645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 20745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Number of copies, integer version. */ 20845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org long mult_int; 20945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 21045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Line number where bytecode was defined. */ 21145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long line; 21245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 21345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Offset of bytecode from beginning of its section. 21445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * 0-based, ~0UL (e.g. all 1 bits) if unknown. 21545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 21645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long offset; 21745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 21845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Unique integer index of bytecode. Used during optimization. */ 21945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long bc_index; 22045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 22145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** NULL-terminated array of labels that point to this bytecode (as the 22245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * bytecode previous to the label). NULL if no labels point here. 22345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 22445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ yasm_symrec **symrecs; 22545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 22645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /** Implementation-specific data (type identified by callback). */ 22745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *contents; 22845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}; 22945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 23045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode of any specified type. 23145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param callback bytecode callback functions, if NULL, creates empty 23245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * bytecode (may not be resolved or output) 23345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param contents type-specific data 23445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) 23545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode of the specified type. 23645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 23745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 23845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_common 23945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@null@*/ const yasm_bytecode_callback *callback, 24045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@only@*/ /*@null@*/ void *contents, unsigned long line); 24145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 24245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Transform a bytecode of any type into a different type. 24345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode to transform 24445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param callback new bytecode callback function 24545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param contents new type-specific data 24645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 24745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 24845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc_transform(yasm_bytecode *bc, 24945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org const yasm_bytecode_callback *callback, 25045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *contents); 25145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 25245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Common bytecode callback finalize function, for where no finalization 25345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * is ever required for this type of bytecode. 25445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 25545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 25645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc_finalize_common(yasm_bytecode *bc, yasm_bytecode *prev_bc); 25745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 25845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Common bytecode callback calc_len function, for where the bytecode has 25945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * no calculatable length. Causes an internal error if called. 26045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 26145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 26245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_calc_len_common(yasm_bytecode *bc, yasm_bc_add_span_func add_span, 26345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *add_span_data); 26445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 26545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Common bytecode callback expand function, for where the bytecode is 26645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * always short (calc_len never calls add_span). Causes an internal 26745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * error if called. 26845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 26945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 27045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_expand_common 27145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_bytecode *bc, int span, long old_val, long new_val, 27245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); 27345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 27445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Common bytecode callback tobytes function, for where the bytecode 27545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * cannot be converted to bytes. Causes an internal error if called. 27645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 27745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 27845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_tobytes_common 279d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d, 28045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org yasm_output_value_func output_value, 28145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ yasm_output_reloc_func output_reloc); 28245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 28345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the next bytecode in a linked list of bytecodes. 28445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 28545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Next bytecode. 28645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 28745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define yasm_bc__next(bc) STAILQ_NEXT(bc, link) 28845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 28945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Set multiple field of a bytecode. 29045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * A bytecode can be repeated a number of times when output. This function 29145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * sets that multiple. 29245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 29345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param e multiple (kept, do not free) 29445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 29545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 29645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc_set_multiple(yasm_bytecode *bc, /*@keep@*/ yasm_expr *e); 29745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 29845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode containing data value(s). 29945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param datahead list of data values (kept, do not free) 30045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param size storage size (in bytes) for each data value 30145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param append_zero append a single zero byte after each data value 30245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (if non-zero) 30345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param arch architecture (optional); if provided, data items 30445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * are directly simplified to bytes if possible 30545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) 30645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode. 30745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 30845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 30945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_data 31045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_datavalhead *datahead, unsigned int size, int append_zero, 31145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ yasm_arch *arch, unsigned long line); 31245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 31345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode containing LEB128-encoded data value(s). 31445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param datahead list of data values (kept, do not free) 31545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param sign signedness (1=signed, 0=unsigned) of each data value 31645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) 31745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode. 31845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 31945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 32045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_leb128 32145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_datavalhead *datahead, int sign, unsigned long line); 32245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 32345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode reserving space. 32445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param numitems number of reserve "items" (kept, do not free) 32545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param itemsize reserved size (in bytes) for each item 32645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) 32745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode. 32845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 32945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 33045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_reserve 33145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@only@*/ yasm_expr *numitems, unsigned int itemsize, 33245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long line); 33345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 33445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the number of items and itemsize for a reserve bytecode. If bc 33545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * is not a reserve bytecode, returns NULL. 33645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 33745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param itemsize reserved size (in bytes) for each item (returned) 33845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return NULL if bc is not a reserve bytecode, otherwise an expression 33945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * for the number of items to reserve. 34045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 34145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 34245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@null@*/ const yasm_expr *yasm_bc_reserve_numitems 34345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_bytecode *bc, /*@out@*/ unsigned int *itemsize); 34445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 34545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode that includes a binary file verbatim. 34645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param filename path to binary file (kept, do not free) 34745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param start starting location in file (in bytes) to read data from 34845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (kept, do not free); may be NULL to indicate 0 34945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param maxlen maximum number of bytes to read from the file (kept, do 35045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * do not free); may be NULL to indicate no maximum 35145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param linemap line mapping repository 35245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) for the bytecode 35345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode. 35445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 35545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 35645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_incbin 35745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@only@*/ char *filename, /*@only@*/ /*@null@*/ yasm_expr *start, 35845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@only@*/ /*@null@*/ yasm_expr *maxlen, yasm_linemap *linemap, 35945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long line); 36045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 36145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode that aligns the following bytecode to a boundary. 36245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param boundary byte alignment (must be a power of two) 36345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param fill fill data (if NULL, code_fill or 0 is used) 36445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param maxskip maximum number of bytes to skip 36545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param code_fill code fill data (if NULL, 0 is used) 36645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) 36745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode. 36845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note The precedence on generated fill is as follows: 36945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - from fill parameter (if not NULL) 37045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - from code_fill parameter (if not NULL) 37145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * - 0 37245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 37345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 37445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_align 37545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (/*@keep@*/ yasm_expr *boundary, /*@keep@*/ /*@null@*/ yasm_expr *fill, 37645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@keep@*/ /*@null@*/ yasm_expr *maxskip, 37745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ const unsigned char **code_fill, unsigned long line); 37845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 37945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a bytecode that puts the following bytecode at a fixed section 38045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * offset. 38145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param start section offset of following bytecode 38245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param fill fill value 38345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param line virtual line (from yasm_linemap) 38445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated bytecode. 38545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 38645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 38745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@only@*/ yasm_bytecode *yasm_bc_create_org 38845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (unsigned long start, unsigned long fill, unsigned long line); 38945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 39045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the section that contains a particular bytecode. 39145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 39245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Section containing bc (can be NULL if bytecode is not part of a 39345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * section). 39445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 39545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 39645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@dependent@*/ /*@null@*/ yasm_section *yasm_bc_get_section 39745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_bytecode *bc); 39845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 39945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Add to the list of symrecs that reference a bytecode. For symrec use 40045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * only. 40145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 40245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param sym symbol 40345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 40445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 40545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc__add_symrec(yasm_bytecode *bc, /*@dependent@*/ yasm_symrec *sym); 40645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 40745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Delete (free allocated memory for) a bytecode. 40845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode (only pointer to it); may be NULL 40945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 41045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 41145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc_destroy(/*@only@*/ /*@null@*/ yasm_bytecode *bc); 41245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 41345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Print a bytecode. For debugging purposes. 41445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param f file 41545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param indent_level indentation level 41645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 41745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 41845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 41945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc_print(const yasm_bytecode *bc, FILE *f, int indent_level); 42045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 42145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Finalize a bytecode after parsing. 42245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 42345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param prev_bc bytecode directly preceding bc in a list of bytecodes 42445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 42545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 42645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_bc_finalize(yasm_bytecode *bc, yasm_bytecode *prev_bc); 42745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 42845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Determine the distance between the starting offsets of two bytecodes. 42945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param precbc1 preceding bytecode to the first bytecode 43045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param precbc2 preceding bytecode to the second bytecode 43145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Distance in bytes between the two bytecodes (bc2-bc1), or NULL if 43245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * the distance was indeterminate. 43345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \warning Only valid /after/ optimization. 43445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 43545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 43645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@null@*/ /*@only@*/ yasm_intnum *yasm_calc_bc_dist 43745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_bytecode *precbc1, yasm_bytecode *precbc2); 43845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 43945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the offset of the next bytecode (the next bytecode doesn't have to 44045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * actually exist). 44145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param precbc preceding bytecode 44245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Offset of the next bytecode in bytes. 44345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \warning Only valid /after/ optimization. 44445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 44545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 44645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgunsigned long yasm_bc_next_offset(yasm_bytecode *precbc); 44745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 44845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Return elemens size of a data bytecode. 44945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Returns the size of each elements of a data bytecode, for proper dereference 45045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * of symbols attached to it. 45145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 45245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 0 if element size is unknown 45345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 45445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 45545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_elem_size(yasm_bytecode *bc); 45645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 45745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Resolve EQUs in a bytecode and calculate its minimum size. 45845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Generates dependent bytecode spans for cases where, if the length spanned 45945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * increases, it could cause the bytecode size to increase. 46045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * Any bytecode multiple is NOT included in the length or spans generation; 46145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * this must be handled at a higher level. 46245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 46345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param add_span function to call to add a span 46445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param add_span_data extra data to be passed to add_span function 46545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 0 if no error occurred, nonzero if there was an error recognized 46645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * (and output) during execution. 46745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note May store to bytecode updated expressions and the short length. 46845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 46945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 47045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_calc_len(yasm_bytecode *bc, yasm_bc_add_span_func add_span, 47145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org void *add_span_data); 47245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 47345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Recalculate a bytecode's length based on an expanded span length. 47445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 47545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param span span ID (as given to yasm_bc_add_span_func in 47645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * yasm_bc_calc_len) 47745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param old_val previous span value 47845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param new_val new span value 47945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param neg_thres negative threshold for long/short decision (returned) 48045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param pos_thres positive threshold for long/short decision (returned) 48145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 0 if bc no longer dependent on this span's length, negative if 48245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * there was an error recognized (and output) during execution, and 48345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * positive if bc size may increase for this span further based on the 48445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * new negative and positive thresholds returned. 48545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note May store to bytecode updated expressions and the updated length. 48645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 48745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 48845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_expand(yasm_bytecode *bc, int span, long old_val, long new_val, 48945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@out@*/ long *neg_thres, /*@out@*/ long *pos_thres); 49045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 49145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Convert a bytecode into its byte representation. 49245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 49345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param buf byte representation destination buffer 49445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bufsize size of buf (in bytes) prior to call; size of the 49545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * generated data after call 49645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param gap if nonzero, indicates the data does not really need to 49745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * exist in the object file; if nonzero, contents of buf 49845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * are undefined [output] 49945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param d data to pass to each call to output_value/output_reloc 50045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param output_value function to call to convert values into their byte 50145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * representation 50245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param output_reloc function to call to output relocation entries 50345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * for a single sym 50445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated buffer that should be used instead of buf for 50545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * reading the byte representation, or NULL if buf was big enough to 50645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * hold the entire byte representation. 50745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note Calling twice on the same bytecode may \em not produce the same 50845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * results on the second call, as calling this function may result in 50945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * non-reversible changes to the bytecode. 51045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 51145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 51245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@null@*/ /*@only@*/ unsigned char *yasm_bc_tobytes 51345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_bytecode *bc, unsigned char *buf, unsigned long *bufsize, 51445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@out@*/ int *gap, void *d, yasm_output_value_func output_value, 51545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@null@*/ yasm_output_reloc_func output_reloc) 51645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org /*@sets *buf@*/; 51745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 51845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the bytecode multiple value as an integer. 51945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 52045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param multiple multiple value (output) 52145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param calc_bc_dist nonzero if distances between bytecodes should be 52245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * calculated, 0 if error should be returned in this case 52345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 1 on error (set with yasm_error_set), 0 on success. 52445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 52545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 52645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_bc_get_multiple(yasm_bytecode *bc, /*@out@*/ long *multiple, 52745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org int calc_bc_dist); 52845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 52945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the bytecode multiple value as an expression. 53045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 53145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Bytecode multiple, NULL if =1. 53245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 53345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 53445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgconst yasm_expr *yasm_bc_get_multiple_expr(const yasm_bytecode *bc); 53545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 53645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get a #yasm_insn structure from an instruction bytecode (if possible). 53745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param bc bytecode 53845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Instruction details if bytecode is an instruction bytecode, 53945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * otherwise NULL. 54045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 54145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 54245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@dependent@*/ /*@null@*/ yasm_insn *yasm_bc_get_insn(yasm_bytecode *bc); 54345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 54445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a new data value from an expression. 54545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param expn expression 54645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated data value. 54745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 54845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 54945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyasm_dataval *yasm_dv_create_expr(/*@keep@*/ yasm_expr *expn); 55045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 55145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a new data value from a string. 55245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param contents string (may contain NULs) 55345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param len length of string 55445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated data value. 55545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 55645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyasm_dataval *yasm_dv_create_string(/*@keep@*/ char *contents, size_t len); 55745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 55845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a new data value from raw bytes data. 55945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param contents raw data (may contain NULs) 56045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param len length 56145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated data value. 56245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 56345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 56445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyasm_dataval *yasm_dv_create_raw(/*@keep@*/ unsigned char *contents, 56545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org unsigned long len); 56645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 56745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Create a new uninitialized data value. 56845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return Newly allocated data value. 56945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 57045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyasm_dataval *yasm_dv_create_reserve(void); 57145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 57245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef YASM_DOXYGEN 57345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define yasm_dv_create_string(s, l) yasm_dv_create_raw((unsigned char *)(s), \ 57445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (unsigned long)(l)) 57545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif 57645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 577d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org/** Get the underlying value of a data value. 578d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org * \param dv data value 579d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org * \return Value, or null if non-value (e.g. string or raw). 580d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org */ 581d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.orgyasm_value *yasm_dv_get_value(yasm_dataval *dv); 582d65182f1818d1c19e6f3866ab6e68a262fad5185hbono@chromium.org 58345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Set multiple field of a data value. 58445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * A data value can be repeated a number of times when output. This function 58545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * sets that multiple. 58645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param dv data value 58745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param e multiple (kept, do not free) 58845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 58945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_dv_set_multiple(yasm_dataval *dv, /*@keep@*/ yasm_expr *e); 59045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 59145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Get the data value multiple value as an unsigned long integer. 59245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param dv data value 59345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param multiple multiple value (output) 59445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return 1 on error (set with yasm_error_set), 0 on success. 59545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 59645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint yasm_dv_get_multiple(yasm_dataval *dv, /*@out@*/ unsigned long *multiple); 59745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 59845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Initialize a list of data values. 59945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param headp list of data values 60045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 60145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_dvs_initialize(yasm_datavalhead *headp); 60245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef YASM_DOXYGEN 60345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define yasm_dvs_initialize(headp) STAILQ_INIT(headp) 60445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif 60545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 60645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Delete (free allocated memory for) a list of data values. 60745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param headp list of data values 60845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 60945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 61045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_dvs_delete(yasm_datavalhead *headp); 61145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 61245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Add data value to the end of a list of data values. 61345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \note Does not make a copy of the data value; so don't pass this function 61445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * static or local variables, and discard the dv pointer after calling 61545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * this function. 61645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param headp data value list 61745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param dv data value (may be NULL) 61845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \return If data value was actually appended (it wasn't NULL), the data 61945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * value; otherwise NULL. 62045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 62145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 62245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/*@null@*/ yasm_dataval *yasm_dvs_append 62345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org (yasm_datavalhead *headp, /*@returned@*/ /*@null@*/ yasm_dataval *dv); 62445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 62545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/** Print a data value list. For debugging purposes. 62645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param f file 62745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param indent_level indentation level 62845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org * \param headp data value list 62945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org */ 63045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgYASM_LIB_DECL 63145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid yasm_dvs_print(const yasm_datavalhead *headp, FILE *f, int indent_level); 63245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 63345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif 634