| Index: third_party/yasm/patched-yasm/modules/arch/x86/x86bc.c
|
| ===================================================================
|
| --- third_party/yasm/patched-yasm/modules/arch/x86/x86bc.c (revision 165590)
|
| +++ third_party/yasm/patched-yasm/modules/arch/x86/x86bc.c (working copy)
|
| @@ -25,7 +25,6 @@
|
| * POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| #include <util.h>
|
| -/*@unused@*/ RCSID("$Id: x86bc.c 2279 2010-01-19 07:57:43Z peter $");
|
|
|
| #include <libyasm.h>
|
|
|
| @@ -44,6 +43,7 @@
|
| long new_val, /*@out@*/ long *neg_thres,
|
| /*@out@*/ long *pos_thres);
|
| static int x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp,
|
| + unsigned char *bufstart,
|
| void *d, yasm_output_value_func output_value,
|
| /*@null@*/ yasm_output_reloc_func output_reloc);
|
|
|
| @@ -56,6 +56,7 @@
|
| long new_val, /*@out@*/ long *neg_thres,
|
| /*@out@*/ long *pos_thres);
|
| static int x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp,
|
| + unsigned char *bufstart,
|
| void *d, yasm_output_value_func output_value,
|
| /*@null@*/ yasm_output_reloc_func output_reloc);
|
|
|
| @@ -66,7 +67,7 @@
|
| yasm_bc_add_span_func add_span,
|
| void *add_span_data);
|
| static int x86_bc_jmpfar_tobytes
|
| - (yasm_bytecode *bc, unsigned char **bufp, void *d,
|
| + (yasm_bytecode *bc, unsigned char **bufp, unsigned char *bufstart, void *d,
|
| yasm_output_value_func output_value,
|
| /*@null@*/ yasm_output_reloc_func output_reloc);
|
|
|
| @@ -189,6 +190,7 @@
|
| x86_ea->ea.pc_rel = 0;
|
| x86_ea->ea.not_pc_rel = 0;
|
| x86_ea->ea.data_len = 0;
|
| + x86_ea->vsib_mode = 0;
|
| x86_ea->modrm = 0;
|
| x86_ea->valid_modrm = 0;
|
| x86_ea->need_modrm = 0;
|
| @@ -380,6 +382,8 @@
|
| fprintf(f, "%*sNoSplit=%u\n", indent_level, "", (unsigned int)ea->nosplit);
|
| fprintf(f, "%*sSegmentOv=%02x\n", indent_level, "",
|
| (unsigned int)x86_ea->ea.segreg);
|
| + fprintf(f, "%*sVSIBMode=%u\n", indent_level, "",
|
| + (unsigned int)x86_ea->vsib_mode);
|
| fprintf(f, "%*sModRM=%03o ValidRM=%u NeedRM=%u\n", indent_level, "",
|
| (unsigned int)x86_ea->modrm, (unsigned int)x86_ea->valid_modrm,
|
| (unsigned int)x86_ea->need_modrm);
|
| @@ -800,14 +804,14 @@
|
| }
|
|
|
| static int
|
| -x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
|
| +x86_bc_insn_tobytes(yasm_bytecode *bc, unsigned char **bufp,
|
| + unsigned char *bufstart, void *d,
|
| yasm_output_value_func output_value,
|
| /*@unused@*/ yasm_output_reloc_func output_reloc)
|
| {
|
| x86_insn *insn = (x86_insn *)bc->contents;
|
| /*@null@*/ x86_effaddr *x86_ea = (x86_effaddr *)insn->x86_ea;
|
| yasm_value *imm = insn->imm;
|
| - unsigned char *bufp_orig = *bufp;
|
|
|
| /* Prefixes */
|
| x86_common_tobytes(&insn->common, bufp,
|
| @@ -874,7 +878,7 @@
|
| yasm_expr_int(delta), bc->line);
|
| }
|
| if (output_value(&x86_ea->ea.disp, *bufp, disp_len,
|
| - (unsigned long)(*bufp-bufp_orig), bc, 1, d))
|
| + (unsigned long)(*bufp-bufstart), bc, 1, d))
|
| return 1;
|
| *bufp += disp_len;
|
| }
|
| @@ -892,7 +896,7 @@
|
| imm_len = 1;
|
| } else
|
| imm_len = imm->size/8;
|
| - if (output_value(imm, *bufp, imm_len, (unsigned long)(*bufp-bufp_orig),
|
| + if (output_value(imm, *bufp, imm_len, (unsigned long)(*bufp-bufstart),
|
| bc, 1, d))
|
| return 1;
|
| *bufp += imm_len;
|
| @@ -902,14 +906,14 @@
|
| }
|
|
|
| static int
|
| -x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
|
| +x86_bc_jmp_tobytes(yasm_bytecode *bc, unsigned char **bufp,
|
| + unsigned char *bufstart, void *d,
|
| yasm_output_value_func output_value,
|
| /*@unused@*/ yasm_output_reloc_func output_reloc)
|
| {
|
| x86_jmp *jmp = (x86_jmp *)bc->contents;
|
| unsigned char opersize;
|
| unsigned int i;
|
| - unsigned char *bufp_orig = *bufp;
|
| /*@only@*/ yasm_intnum *delta;
|
|
|
| /* Prefixes */
|
| @@ -944,7 +948,7 @@
|
| jmp->target.size = 8;
|
| jmp->target.sign = 1;
|
| if (output_value(&jmp->target, *bufp, 1,
|
| - (unsigned long)(*bufp-bufp_orig), bc, 1, d))
|
| + (unsigned long)(*bufp-bufstart), bc, 1, d))
|
| return 1;
|
| *bufp += 1;
|
| break;
|
| @@ -976,7 +980,7 @@
|
| jmp->target.size = i*8;
|
| jmp->target.sign = 1;
|
| if (output_value(&jmp->target, *bufp, i,
|
| - (unsigned long)(*bufp-bufp_orig), bc, 1, d))
|
| + (unsigned long)(*bufp-bufstart), bc, 1, d))
|
| return 1;
|
| *bufp += i;
|
| break;
|
| @@ -989,13 +993,13 @@
|
| }
|
|
|
| static int
|
| -x86_bc_jmpfar_tobytes(yasm_bytecode *bc, unsigned char **bufp, void *d,
|
| +x86_bc_jmpfar_tobytes(yasm_bytecode *bc, unsigned char **bufp,
|
| + unsigned char *bufstart, void *d,
|
| yasm_output_value_func output_value,
|
| /*@unused@*/ yasm_output_reloc_func output_reloc)
|
| {
|
| x86_jmpfar *jmpfar = (x86_jmpfar *)bc->contents;
|
| unsigned int i;
|
| - unsigned char *bufp_orig = *bufp;
|
| unsigned char opersize;
|
|
|
| x86_common_tobytes(&jmpfar->common, bufp, 0);
|
| @@ -1009,12 +1013,12 @@
|
| i = (opersize == 16) ? 2 : 4;
|
| jmpfar->offset.size = i*8;
|
| if (output_value(&jmpfar->offset, *bufp, i,
|
| - (unsigned long)(*bufp-bufp_orig), bc, 1, d))
|
| + (unsigned long)(*bufp-bufstart), bc, 1, d))
|
| return 1;
|
| *bufp += i;
|
| jmpfar->segment.size = 16;
|
| if (output_value(&jmpfar->segment, *bufp, 2,
|
| - (unsigned long)(*bufp-bufp_orig), bc, 1, d))
|
| + (unsigned long)(*bufp-bufstart), bc, 1, d))
|
| return 1;
|
| *bufp += 2;
|
|
|
|
|