shithub: riscv

Download patch

ref: 670493fe5ee39e4c819864006e3a5392c0f96248
parent: 2020190f945dbc264963abec22659df95cd61f04
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sat Nov 1 20:50:37 EDT 2014

realemu: make sure instruction arguments are initialized even when decoding traps

--- a/sys/src/cmd/aux/realemu/decode.c
+++ b/sys/src/cmd/aux/realemu/decode.c
@@ -572,6 +572,7 @@
 	i->dsreg = RDS;
 	i->olen = cpu->olen;
 	i->alen = cpu->alen;
+	i->a1 = i->a2 = i->a3 = nil;
 
 	for(;;){
 		i->code = ar(ip); ip->off++;
@@ -608,7 +609,6 @@
 	if(i->sreg == 0)
 		i->sreg = i->dsreg;
 
-	i->a1 = i->a2 = i->a3 = nil;
 	for(;;){
 		if(t->a1)
 			i->a1 = getarg(ip, i, t->a1);