Browse Source

ubsan: or1k: left shift of negative value

cpu/
	* or1korbis.cpu (f-disp26, f-disp21): Don't left shift negative values.
opcodes/
	* or1k-ibld.c: Regenerate.
binutils-2_34-branch
Alan Modra 7 years ago
parent
commit
bcd9f578a9
  1. 4
      cpu/ChangeLog
  2. 4
      cpu/or1korbis.cpu
  3. 4
      opcodes/ChangeLog
  4. 4
      opcodes/or1k-ibld.c

4
cpu/ChangeLog

@ -1,3 +1,7 @@
2019-12-20 Alan Modra <amodra@gmail.com>
* or1korbis.cpu (f-disp26, f-disp21): Don't left shift negative values.
2019-12-17 Alan Modra <amodra@gmail.com> 2019-12-17 Alan Modra <amodra@gmail.com>
* bpf.cpu (f-imm64): Avoid signed overflow. * bpf.cpu (f-imm64): Avoid signed overflow.

4
cpu/or1korbis.cpu

@ -76,7 +76,7 @@
26 26
INT INT
((value pc) (sra IAI (sub IAI value pc) (const 2))) ((value pc) (sra IAI (sub IAI value pc) (const 2)))
((value pc) (add IAI (sll IAI value (const 2)) pc)) ((value pc) (add IAI (mul IAI value (const 4)) pc))
) )
; PC relative, 21-bit, 13 shifted to right, aligned. ; PC relative, 21-bit, 13 shifted to right, aligned.
@ -91,7 +91,7 @@
((value pc) ((value pc)
(sub IAI (sra IAI value (const 13)) (sra IAI pc (const 13)))) (sub IAI (sra IAI value (const 13)) (sra IAI pc (const 13))))
((value pc) ((value pc)
(sll IAI (add IAI value (sra IAI pc (const 13))) (const 13))) (mul IAI (add IAI value (sra IAI pc (const 13))) (const 8192)))
) )
; Immediates. ; Immediates.

4
opcodes/ChangeLog

@ -1,3 +1,7 @@
2019-12-20 Alan Modra <amodra@gmail.com>
* or1k-ibld.c: Regenerate.
2019-12-20 Alan Modra <amodra@gmail.com> 2019-12-20 Alan Modra <amodra@gmail.com>
* hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use * hppa-dis.c (extract_16, extract_21, print_insn_hppa): Use

4
opcodes/or1k-ibld.c

@ -783,7 +783,7 @@ or1k_cgen_extract_operand (CGEN_CPU_DESC cd,
{ {
long value; long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_ABS_ADDR), 0, 20, 21, 32, total_length, pc, & value); length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_ABS_ADDR), 0, 20, 21, 32, total_length, pc, & value);
value = ((((value) + (((DI) (pc) >> (13))))) << (13)); value = ((((value) + (((DI) (pc) >> (13))))) * (MAKEDI (0, 8192)));
fields->f_disp21 = value; fields->f_disp21 = value;
} }
break; break;
@ -791,7 +791,7 @@ or1k_cgen_extract_operand (CGEN_CPU_DESC cd,
{ {
long value; long value;
length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 25, 26, 32, total_length, pc, & value); length = extract_normal (cd, ex_info, insn_value, 0|(1<<CGEN_IFLD_SIGNED)|(1<<CGEN_IFLD_PCREL_ADDR), 0, 25, 26, 32, total_length, pc, & value);
value = ((((value) << (2))) + (pc)); value = ((((value) * (MAKEDI (0, 4)))) + (pc));
fields->f_disp26 = value; fields->f_disp26 = value;
} }
break; break;

Loading…
Cancel
Save