diff options
author | Homer Hsing <homer.xing@intel.com> | 2012-09-24 16:39:36 +0800 |
---|---|---|
committer | Damien Lespiau <damien.lespiau@intel.com> | 2013-03-04 15:54:33 +0000 |
commit | f55ed65bb28bd8bce416a9dfd32dfc0028cb61bf (patch) | |
tree | 94a662e955a28b292ec37b4e483a9bb0bf48dd5e /assembler | |
parent | 4bf84ec1461a5346a84259ade14ae0da2c4ac898 (diff) |
Fix reloc_target_offset computing logic
Diffstat (limited to 'assembler')
-rw-r--r-- | assembler/src/main.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/assembler/src/main.c b/assembler/src/main.c index 4dee1b32..3236e757 100644 --- a/assembler/src/main.c +++ b/assembler/src/main.c @@ -402,18 +402,18 @@ int main(int argc, char **argv) struct brw_instruction *inst = & entry->instruction; if (inst->first_reloc_target) - inst->first_reloc_offset = label_to_addr(inst->first_reloc_target, entry->inst_offset); + inst->first_reloc_offset = label_to_addr(inst->first_reloc_target, entry->inst_offset) - entry->inst_offset; if (inst->second_reloc_target) - inst->second_reloc_offset = label_to_addr(inst->second_reloc_target, entry->inst_offset); + inst->second_reloc_offset = label_to_addr(inst->second_reloc_target, entry->inst_offset) - entry->inst_offset; if (inst->second_reloc_offset) { // this is a branch instruction with two offset arguments - entry->instruction.bits3.branch_2_offset.JIP = jump_distance(inst->first_reloc_offset - entry->inst_offset); - entry->instruction.bits3.branch_2_offset.UIP = jump_distance(inst->second_reloc_offset - entry->inst_offset); + entry->instruction.bits3.branch_2_offset.JIP = jump_distance(inst->first_reloc_offset); + entry->instruction.bits3.branch_2_offset.UIP = jump_distance(inst->second_reloc_offset); } else if (inst->first_reloc_offset) { // this is a branch instruction with one offset argument - int offset = inst->first_reloc_offset - entry->inst_offset; + int offset = inst->first_reloc_offset; /* bspec: Unlike other flow control instructions, the offset used by JMPI is relative to the incremented instruction pointer rather than the IP value for the instruction itself. */ if(entry->instruction.header.opcode == BRW_OPCODE_JMPI) offset --; |