shithub: riscv

Download patch

ref: 3a322e9f329909c3c751de6cb5da33e7280c2738
parent: e890c3d9432a2dfbf238f3d60b7b3a96409ddd78
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Sep 4 18:53:54 EDT 2014

5e: fix signed long multiply

--- a/sys/src/cmd/5e/arm.c
+++ b/sys/src/cmd/5e/arm.c
@@ -367,11 +367,12 @@
 	RdH = P->R + ((instr >> 16) & 15);
 	if(RdL == RdH || RdH == Rm || RdL == Rm || Rm == P->R + 15 || Rs == P->R + 15 || RdL == P->R + 15 || RdH == P->R + 15)
 		invalid(instr);
-	if(instr & (1<<22)) {
+	if(instr & (1<<22))
+		res = ((vlong)*(int*)Rs) * *(int*)Rm;
+	else {
 		res = *Rs;
 		res *= *Rm;
-	} else
-		res = ((vlong)*(int*)Rs) * *(int*)Rm;
+	}
 	if(instr & (1<<21)) {
 		res += *RdL;
 		res += ((uvlong)*RdH) << 32;