Skip to content

Commit 27ee1f3

Browse files
committed
qemu: actually add patch
1 parent b7adae8 commit 27ee1f3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
../tcg/tcg-op.c:1750:28: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'int64_t' (aka 'long')
2+
3+
fixes a signed overflow breaking TCG under
4+
certain conditions, esp. with qemu-user emulation (causing
5+
internal SIGILL)
6+
7+
source: https://github.com/chimera-linux/cports/blob/master/main/qemu/patches/tcg-overflow.patch
8+
9+
--- a/tcg/tcg-op.c
10+
+++ b/tcg/tcg-op.c
11+
@@ -1747,7 +1747,7 @@ void tcg_gen_andi_i64(TCGv_i64 ret, TCGv_i64 arg1, int64_t arg2)
12+
* which does not require matching operands. Other backends can
13+
* trivially expand the extract to AND during code generation.
14+
*/
15+
- if (!(arg2 & (arg2 + 1))) {
16+
+ if (!((uint64_t)arg2 & ((uint64_t)arg2 + 1))) {
17+
unsigned len = ctz64(~arg2);
18+
if (TCG_TARGET_extract_valid(TCG_TYPE_I64, 0, len)) {
19+
tcg_gen_extract_i64(ret, arg1, 0, len);

0 commit comments

Comments
 (0)