|
libyasm
|
YASM value interface. More...
Go to the source code of this file.
Functions | |
| YASM_LIB_DECL void | yasm_value_initialize (yasm_value *value, yasm_expr *e, unsigned int size) |
| Initialize a yasm_value with just an expression. More... | |
| YASM_LIB_DECL void | yasm_value_init_sym (yasm_value *value, yasm_symrec *sym, unsigned int size) |
| Initialize a yasm_value with just a symrec. More... | |
| YASM_LIB_DECL void | yasm_value_init_copy (yasm_value *value, const yasm_value *orig) |
| Initialize a yasm_value as a copy of another yasm_value. More... | |
| YASM_LIB_DECL void | yasm_value_delete (yasm_value *value) |
| Frees any memory inside value; does not free value itself. More... | |
| YASM_LIB_DECL void | yasm_value_set_curpos_rel (yasm_value *value, yasm_bytecode *bc, unsigned int ip_rel) |
| Set a value to be relative to the current assembly position rather than relative to the section start. More... | |
| YASM_LIB_DECL int | yasm_value_finalize (yasm_value *value, yasm_bytecode *precbc) |
| Perform yasm_value_finalize_expr() on a value that already exists from being initialized with yasm_value_initialize(). More... | |
| YASM_LIB_DECL int | yasm_value_finalize_expr (yasm_value *value, yasm_expr *e, yasm_bytecode *precbc, unsigned int size) |
| Break a yasm_expr into a yasm_value constituent parts. More... | |
| YASM_LIB_DECL yasm_intnum * | yasm_value_get_intnum (yasm_value *value, yasm_bytecode *bc, int calc_bc_dist) |
| Get value if absolute or PC-relative section-local relative. More... | |
| YASM_LIB_DECL int | yasm_value_output_basic (yasm_value *value, unsigned char *buf, size_t destsize, yasm_bytecode *bc, int warn, yasm_arch *arch) |
| Output value if constant or PC-relative section-local. More... | |
| YASM_LIB_DECL void | yasm_value_print (const yasm_value *value, FILE *f, int indent_level) |
| Print a value. More... | |
YASM value interface.
Definition in file value.h.
| YASM_LIB_DECL void yasm_value_delete | ( | yasm_value * | value | ) |
Frees any memory inside value; does not free value itself.
| value | value |
| YASM_LIB_DECL int yasm_value_finalize | ( | yasm_value * | value, |
| yasm_bytecode * | precbc | ||
| ) |
Perform yasm_value_finalize_expr() on a value that already exists from being initialized with yasm_value_initialize().
| value | value |
| precbc | previous bytecode to bytecode containing value |
| YASM_LIB_DECL int yasm_value_finalize_expr | ( | yasm_value * | value, |
| yasm_expr * | e, | ||
| yasm_bytecode * | precbc, | ||
| unsigned int | size | ||
| ) |
Break a yasm_expr into a yasm_value constituent parts.
Extracts the relative portion of the value, SEG and WRT portions, and top-level right shift, if any. Places the remaining expr into the absolute portion of the value. Essentially a combination of yasm_value_initialize() and yasm_value_finalize(). First expands references to symrecs in absolute sections by expanding with the absolute section start plus the symrec offset within the absolute section.
| value | value to store split portions into |
| e | expression input |
| precbc | previous bytecode to bytecode containing expression |
| size | value size (in bits) |
| YASM_LIB_DECL yasm_intnum* yasm_value_get_intnum | ( | yasm_value * | value, |
| yasm_bytecode * | bc, | ||
| int | calc_bc_dist | ||
| ) |
Get value if absolute or PC-relative section-local relative.
Returns NULL otherwise.
| value | value |
| bc | current bytecode (for PC-relative calculation); if NULL, NULL is returned for PC-relative values. |
| calc_bc_dist | if nonzero, calculates bytecode distances in absolute portion of value |
| YASM_LIB_DECL void yasm_value_init_copy | ( | yasm_value * | value, |
| const yasm_value * | orig | ||
| ) |
Initialize a yasm_value as a copy of another yasm_value.
Any expressions within orig are copied, so it's safe to delete the copy.
| value | value (copy to create) |
| orig | original value |
| YASM_LIB_DECL void yasm_value_init_sym | ( | yasm_value * | value, |
| yasm_symrec * | sym, | ||
| unsigned int | size | ||
| ) |
Initialize a yasm_value with just a symrec.
No processing is performed, the symrec is simply stuck into value.rel and the other fields are initialized.
| value | value to be initialized |
| sym | symrec |
| size | value size (in bits) |
| YASM_LIB_DECL void yasm_value_initialize | ( | yasm_value * | value, |
| yasm_expr * | e, | ||
| unsigned int | size | ||
| ) |
Initialize a yasm_value with just an expression.
No processing is performed, the expression is simply stuck into value.abs and the other fields are initialized. Use yasm_expr_extract_value() to perform "smart" processing into a yasm_value. This function is intended for use during parsing simply to ensure all fields of the value are initialized; after the parse is complete, yasm_value_extract() should be called to finalize the value. The value defaults to unsigned.
| value | value to be initialized |
| e | expression (kept) |
| size | value size (in bits) |
| YASM_LIB_DECL int yasm_value_output_basic | ( | yasm_value * | value, |
| unsigned char * | buf, | ||
| size_t | destsize, | ||
| yasm_bytecode * | bc, | ||
| int | warn, | ||
| yasm_arch * | arch | ||
| ) |
Output value if constant or PC-relative section-local.
This should be used from objfmt yasm_output_value_func() functions. functions.
| value | value |
| buf | buffer for byte representation |
| destsize | destination size (in bytes) |
| bc | current bytecode (usually passed into higher-level calling function) |
| warn | enables standard warnings: zero for none; nonzero for overflow/underflow floating point and integer warnings |
| arch | architecture |
| YASM_LIB_DECL void yasm_value_print | ( | const yasm_value * | value, |
| FILE * | f, | ||
| int | indent_level | ||
| ) |
Print a value.
For debugging purposes.
| value | value |
| indent_level | indentation level |
| f | file |
| YASM_LIB_DECL void yasm_value_set_curpos_rel | ( | yasm_value * | value, |
| yasm_bytecode * | bc, | ||
| unsigned int | ip_rel | ||
| ) |
Set a value to be relative to the current assembly position rather than relative to the section start.
| value | value |
| bc | bytecode containing value |
| ip_rel | if nonzero, indicates IP-relative data relocation, sometimes used to generate special relocations |
1.8.3.1