qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/5] [sh4] patches for SH4 system emulation
@ 2008-08-18 16:20 Shin-ichiro KAWASAKI
  2008-08-21  7:33 ` [Qemu-devel] " Jan Kiszka
  2008-08-22  9:00 ` [Qemu-devel] " Aurelien Jarno
  0 siblings, 2 replies; 6+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-08-18 16:20 UTC (permalink / raw)
  To: qemu-devel

Hello all,

To improve SH4 system emulation, I'm sending five patches which implement some
MMU featrues, bug fixes, and sleep instruction.
With these patches, simple '/init' scripts can be executed after Linux kernel boot.
I saw BusyBox ash's prompt is printed, though I cannot input key types because
serial controler's implementation is not enough.

The kernel and command line I used to check is available here.
http://www.assembla.com/wiki/show/qemu-sh4/BuildingEnvironment

I hope these patches will help and merged in trunk.
Any comments will be welcome.

Regards,
Shin-ichiro KAWASAKI

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Qemu-devel] Re: [PATCH 0/5] [sh4] patches for SH4 system emulation
  2008-08-18 16:20 [Qemu-devel] [PATCH 0/5] [sh4] patches for SH4 system emulation Shin-ichiro KAWASAKI
@ 2008-08-21  7:33 ` Jan Kiszka
  2008-08-22 19:54   ` Shin-ichiro KAWASAKI
  2008-08-22  9:00 ` [Qemu-devel] " Aurelien Jarno
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Kiszka @ 2008-08-21  7:33 UTC (permalink / raw)
  To: kawasaki; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 921 bytes --]

Shin-ichiro KAWASAKI wrote:
> Hello all,
> 
> To improve SH4 system emulation, I'm sending five patches which implement some
> MMU featrues, bug fixes, and sleep instruction.
> With these patches, simple '/init' scripts can be executed after Linux kernel boot.
> I saw BusyBox ash's prompt is printed, though I cannot input key types because
> serial controler's implementation is not enough.
> 
> The kernel and command line I used to check is available here.
> http://www.assembla.com/wiki/show/qemu-sh4/BuildingEnvironment
> 
> I hope these patches will help and merged in trunk.
> Any comments will be welcome.

I cannot comment on your patches, but maybe you can comment on (or test)
the tas.b issue of qemu's sh4 emulation

http://comments.gmane.org/gmane.comp.emulators.qemu/27235

specifically the last proposed solution

http://permalink.gmane.org/gmane.comp.emulators.qemu/27337

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] [sh4] patches for SH4 system emulation
  2008-08-18 16:20 [Qemu-devel] [PATCH 0/5] [sh4] patches for SH4 system emulation Shin-ichiro KAWASAKI
  2008-08-21  7:33 ` [Qemu-devel] " Jan Kiszka
@ 2008-08-22  9:00 ` Aurelien Jarno
  2008-08-22 20:03   ` Shin-ichiro KAWASAKI
  1 sibling, 1 reply; 6+ messages in thread
From: Aurelien Jarno @ 2008-08-22  9:00 UTC (permalink / raw)
  To: qemu-devel

On Tue, Aug 19, 2008 at 01:20:18AM +0900, Shin-ichiro KAWASAKI wrote:
> Hello all,
> 
> To improve SH4 system emulation, I'm sending five patches which implement some
> MMU featrues, bug fixes, and sleep instruction.
> With these patches, simple '/init' scripts can be executed after Linux kernel boot.
> I saw BusyBox ash's prompt is printed, though I cannot input key types because
> serial controler's implementation is not enough.
> 
> The kernel and command line I used to check is available here.
> http://www.assembla.com/wiki/show/qemu-sh4/BuildingEnvironment
> 
> I hope these patches will help and merged in trunk.
> Any comments will be welcome.
> 

All patches of the series committed, thanks.

By the way, do you have any plan to convert the SH4 target to TCG? It is
one of the few missing targets.

-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Re: [PATCH 0/5] [sh4] patches for SH4 system emulation
  2008-08-21  7:33 ` [Qemu-devel] " Jan Kiszka
@ 2008-08-22 19:54   ` Shin-ichiro KAWASAKI
  2008-08-22 21:30     ` Aurelien Jarno
  0 siblings, 1 reply; 6+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-08-22 19:54 UTC (permalink / raw)
  To: qemu-devel

Jan Kiszka wrote:
>> I hope these patches will help and merged in trunk.
>> Any comments will be welcome.
> 
> I cannot comment on your patches, but maybe you can comment on (or test)
> the tas.b issue of qemu's sh4 emulation
> 
> http://comments.gmane.org/gmane.comp.emulators.qemu/27235
> 
> specifically the last proposed solution
> 
> http://permalink.gmane.org/gmane.comp.emulators.qemu/27337

Andrzej's two patches are both seem to be consistent with tas.b
specification.
To make it sure, I've taken out a function, __pthread_spin_trylock(), 
from glibc's linuxthreads/sysdeps/sh/pspinlock.c, as the test code for
tas.b.  I confirmed that current QEMU implementation fails
this test, and whichever of the two patches makes it pass the test. 

In my opinion, the first patch is the better, because it is smaller and
easier to understand.  I add the patch to the end of this mail again,
which is modified to avoid patch failure.
FYI, I add the test code, too.

Regards,
Shin-ichiro KAWASAKI


=== test code starts here ===

#include <stdio.h>

typedef volatile int pthread_spinlock_t;
#define EBUSY 16

int
__pthread_spin_trylock (pthread_spinlock_t *lock)
{
  unsigned int val;

  asm volatile ("tas.b @%1; movt %0"
		: "=r" (val)
		: "r" (lock)
		: "memory");
  return val ? 0 : EBUSY;
}

int main(int argc, char * argv[])
{
  pthread_spinlock_t lock = 0;

  printf("test #1 : ");
  printf(" %s.\n", __pthread_spin_trylock(&lock) ? "NG" : "ok");
  
  printf("test #2 : ");
  printf(" %s.\n", __pthread_spin_trylock(&lock) ? "ok" : "NG");
}

=== test code ends ===


diff -ruwN a/target-sh4/op.c b/target-sh4/op.c
--- a/target-sh4/op.c	2008-08-22 17:57:27.000000000 +0900
+++ b/target-sh4/op.c	2008-08-23 03:42:30.000000000 +0900
@@ -592,13 +592,6 @@
     RETURN();
 }
 
-void OPPROTO op_tasb_rN(void)
-{
-    cond_t((env->gregs[PARAM1] & 0xff) == 0);
-    *(int8_t *) &env->gregs[PARAM1] |= 0x80;
-    RETURN();
-}
-
 void OPPROTO op_movl_T0_rN(void)
 {
     env->gregs[PARAM1] = T0;
diff -ruwN a/target-sh4/translate.c b/target-sh4/translate.c
--- a/target-sh4/translate.c	2008-08-22 17:58:00.000000000 +0900
+++ b/target-sh4/translate.c	2008-08-23 03:42:30.000000000 +0900
@@ -1100,7 +1100,12 @@
 	gen_op_shlr16_Rn(REG(B11_8));
 	return;
     case 0x401b:		/* tas.b @Rn */
-	gen_op_tasb_rN(REG(B11_8));
+        gen_op_movl_rN_T0(REG(B11_8));
+        gen_op_movl_T0_T1();
+        gen_op_ldub_T0_T0(ctx);
+        gen_op_cmp_eq_imm_T0(0);
+        gen_op_or_imm_T0(0x80);
+        gen_op_stb_T0_T1(ctx);
 	return;
     case 0xf00d: /* fsts FPUL,FRn - FPSCR: Nothing */
 	gen_op_movl_fpul_FT0();

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] [sh4] patches for SH4 system emulation
  2008-08-22  9:00 ` [Qemu-devel] " Aurelien Jarno
@ 2008-08-22 20:03   ` Shin-ichiro KAWASAKI
  0 siblings, 0 replies; 6+ messages in thread
From: Shin-ichiro KAWASAKI @ 2008-08-22 20:03 UTC (permalink / raw)
  To: qemu-devel

Aurelien Jarno wrote:
> On Tue, Aug 19, 2008 at 01:20:18AM +0900, Shin-ichiro KAWASAKI wrote:
>> Hello all,
>>
>> To improve SH4 system emulation, I'm sending five patches which implement some
>> MMU featrues, bug fixes, and sleep instruction.
>> With these patches, simple '/init' scripts can be executed after Linux kernel boot.
>> I saw BusyBox ash's prompt is printed, though I cannot input key types because
>> serial controler's implementation is not enough.
>>
>> The kernel and command line I used to check is available here.
>> http://www.assembla.com/wiki/show/qemu-sh4/BuildingEnvironment
>>
>> I hope these patches will help and merged in trunk.
>> Any comments will be welcome.
>>
> 
> All patches of the series committed, thanks.

Thanks a lot!

> By the way, do you have any plan to convert the SH4 target to TCG? 

Yes.  I've just started working to eliminate target-sh4/op.c.


Regards,
Shin-ichiro KAWASAKI

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] Re: [PATCH 0/5] [sh4] patches for SH4 system emulation
  2008-08-22 19:54   ` Shin-ichiro KAWASAKI
@ 2008-08-22 21:30     ` Aurelien Jarno
  0 siblings, 0 replies; 6+ messages in thread
From: Aurelien Jarno @ 2008-08-22 21:30 UTC (permalink / raw)
  To: qemu-devel

On Sat, Aug 23, 2008 at 04:54:50AM +0900, Shin-ichiro KAWASAKI wrote:
> Jan Kiszka wrote:
>>> I hope these patches will help and merged in trunk.
>>> Any comments will be welcome.
>>
>> I cannot comment on your patches, but maybe you can comment on (or test)
>> the tas.b issue of qemu's sh4 emulation
>>
>> http://comments.gmane.org/gmane.comp.emulators.qemu/27235
>>
>> specifically the last proposed solution
>>
>> http://permalink.gmane.org/gmane.comp.emulators.qemu/27337
>
> Andrzej's two patches are both seem to be consistent with tas.b
> specification.
> To make it sure, I've taken out a function, __pthread_spin_trylock(),  
> from glibc's linuxthreads/sysdeps/sh/pspinlock.c, as the test code for
> tas.b.  I confirmed that current QEMU implementation fails
> this test, and whichever of the two patches makes it pass the test. 
>
> In my opinion, the first patch is the better, because it is smaller and
> easier to understand.  I add the patch to the end of this mail again,
> which is modified to avoid patch failure.
> FYI, I add the test code, too.

Thanks, applied.


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-08-22 21:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-18 16:20 [Qemu-devel] [PATCH 0/5] [sh4] patches for SH4 system emulation Shin-ichiro KAWASAKI
2008-08-21  7:33 ` [Qemu-devel] " Jan Kiszka
2008-08-22 19:54   ` Shin-ichiro KAWASAKI
2008-08-22 21:30     ` Aurelien Jarno
2008-08-22  9:00 ` [Qemu-devel] " Aurelien Jarno
2008-08-22 20:03   ` Shin-ichiro KAWASAKI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).