Hi everyone,

Attached are a few minor fixes for the sh4 user space emulator. Please commit.

I will continue to improve the sh4 user space and system emulation
code in the near future, so feel free to send any qemu on sh4 related
questions or comments to me!

Thanks in advance,

/ magnus
sh4: Use 16-bit uid wrappers

Without this patch a simple hello world program emits this:
qemu: Unsupported syscall: 47

Signed-off-by: Magnus Damm <[EMAIL PROTECTED]>

--- 0001/linux-user/syscall.c
+++ work/linux-user/syscall.c	2007-04-17 11:48:24.000000000 +0900
@@ -74,7 +74,7 @@
 //#define DEBUG
 
 #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
-    || defined(TARGET_M68K)
+    || defined(TARGET_M68K) || defined(TARGET_SH4)
 /* 16 bit uid wrappers emulation */
 #define USE_UID16
 #endif
sh4: Fix opcode for sts.l fpul/cpscr

0x4052/0x4062 should be used instead of 0x0052/0x0062 according to the
SH-4 Software Manual.

Signed-off-by: Magnus Damm <[EMAIL PROTECTED]>

--- 0001/target-sh4/translate.c
+++ work/target-sh4/translate.c	2007-04-17 15:51:36.000000000 +0900
@@ -1003,8 +1003,8 @@ void decode_opc(DisasContext * ctx)
 	LDST(mach, 0x400a, 0x4006, lds, 0x000a, 0x4002, sts,)
 	LDST(macl, 0x401a, 0x4016, lds, 0x001a, 0x4012, sts,)
 	LDST(pr, 0x402a, 0x4026, lds, 0x002a, 0x4022, sts,)
-	LDST(fpul, 0x405a, 0x4056, lds, 0x005a, 0x0052, sts,)
-	LDST(fpscr, 0x406a, 0x4066, lds, 0x006a, 0x0062, sts, ctx->flags |=
+	LDST(fpul, 0x405a, 0x4056, lds, 0x005a, 0x4052, sts,)
+	LDST(fpscr, 0x406a, 0x4066, lds, 0x006a, 0x4062, sts, ctx->flags |=
 	     MODE_CHANGE;)
     case 0x00c3:		/* movca.l R0,@Rm */
 	gen_op_movl_rN_T0(REG(0));
sh4: Fix inc8 and dec8 operations

We should increment and decrement by 8 according to the SH-4 Software Manual.

Signed-off-by: Magnus Damm <[EMAIL PROTECTED]>

--- 0001/target-sh4/op.c
+++ work/target-sh4/op.c	2007-04-25 16:18:47.000000000 +0900
@@ -737,7 +737,7 @@ void OPPROTO op_dec4_rN(void)
 
 void OPPROTO op_dec8_rN(void)
 {
-    env->gregs[PARAM1] -= 4;
+    env->gregs[PARAM1] -= 8;
     RETURN();
 }
 
@@ -761,7 +761,7 @@ void OPPROTO op_inc4_rN(void)
 
 void OPPROTO op_inc8_rN(void)
 {
-    env->gregs[PARAM1] += 4;
+    env->gregs[PARAM1] += 8;
     RETURN();
 }
 

Reply via email to