From db829eeb9379555a1fac1c62b657e592a3c91e5b Mon Sep 17 00:00:00 2001
From: notaz <notasas@gmail.com>
Date: Fri, 6 Jan 2012 02:28:49 +0200
Subject: [PATCH] drc: never read to r0

r0 can be allocated for a write and program may decide to read to r0
while we have it alloacted, so *_readstub must be ready for it
---
 libpcsxcore/new_dynarec/assem_arm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c
index ebf733b0..3950d224 100644
--- a/libpcsxcore/new_dynarec/assem_arm.c
+++ b/libpcsxcore/new_dynarec/assem_arm.c
@@ -2835,7 +2835,7 @@ do_readstub(int n)
       temp=r; break;
     }
   }
-  if(rt>=0)
+  if(rt>=0&&rt1[i]!=0)
     reglist&=~(1<<rt);
   if(temp==-1) {
     save_regs(reglist);
@@ -3012,7 +3012,7 @@ inline_readstub(int type, int i, u_int addr, signed char regmap[], int target, i
     return;
   handler=get_direct_memhandler(mem_rtab,addr,type,&host_addr);
   if (handler==0) {
-    if(rt<0)
+    if(rt<0||rt1[i]==0)
       return;
     if(addr!=host_addr)
       emit_movimm_from(addr,rs,host_addr,rs);
@@ -3037,7 +3037,7 @@ inline_readstub(int type, int i, u_int addr, signed char regmap[], int target, i
   }
 
   // call a memhandler
-  if(rt>=0)
+  if(rt>=0&&rt1[i]!=0)
     reglist&=~(1<<rt);
   save_regs(reglist);
   if(target==0)
@@ -3068,7 +3068,7 @@ inline_readstub(int type, int i, u_int addr, signed char regmap[], int target, i
   else
     emit_call(handler);
 
-  if(rt>=0) {
+  if(rt>=0&&rt1[i]!=0) {
     switch(type) {
       case LOADB_STUB:  emit_signextend8(0,rt); break;
       case LOADBU_STUB: emit_andimm(0,0xff,rt); break;
-- 
2.39.5