aboutsummaryrefslogtreecommitdiff
path: root/cpu
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-12-20 14:37:44 +1030
committerAlan Modra <amodra@gmail.com>2019-12-20 17:57:58 +1030
commitbcd9f578a96b9776e34e5cec963928f5a96b80e7 (patch)
tree81184dfccbbea896f95a5a0eedad2c2965f55ec4 /cpu
parente76832f125f6f005ddf3c75b7be675272568b01e (diff)
downloadgdb-bcd9f578a96b9776e34e5cec963928f5a96b80e7.zip
gdb-bcd9f578a96b9776e34e5cec963928f5a96b80e7.tar.gz
gdb-bcd9f578a96b9776e34e5cec963928f5a96b80e7.tar.bz2
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.
Diffstat (limited to 'cpu')
-rw-r--r--cpu/ChangeLog4
-rw-r--r--cpu/or1korbis.cpu4
2 files changed, 6 insertions, 2 deletions
diff --git a/cpu/ChangeLog b/cpu/ChangeLog
index 8755ee7..1729efd 100644
--- a/cpu/ChangeLog
+++ b/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>
* bpf.cpu (f-imm64): Avoid signed overflow.
diff --git a/cpu/or1korbis.cpu b/cpu/or1korbis.cpu
index 3741d4c..a8002a3 100644
--- a/cpu/or1korbis.cpu
+++ b/cpu/or1korbis.cpu
@@ -76,7 +76,7 @@
26
INT
((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.
@@ -91,7 +91,7 @@
((value pc)
(sub IAI (sra IAI value (const 13)) (sra IAI pc (const 13))))
((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.