* [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused @ 2009-02-16 22:41 Lionel Landwerlin 2009-02-21 15:21 ` Lionel Landwerlin 2009-03-03 6:13 ` Aurelien Jarno 0 siblings, 2 replies; 6+ messages in thread From: Lionel Landwerlin @ 2009-02-16 22:41 UTC (permalink / raw) To: qemu-devel With my previous patch (the one monitoring tlb), I found that the last TLB entry was never use. Here a little fix. Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> --- target-sh4/helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-sh4/helper.c b/target-sh4/helper.c index cd0f392..918a946 100644 --- a/target-sh4/helper.c +++ b/target-sh4/helper.c @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) urb = ((env->mmucr) >> 18) & 0x3f; urc = ((env->mmucr) >> 10) & 0x3f; urc++; - if (urc == urb || urc == UTLB_SIZE - 1) + if (urc == urb || urc == UTLB_SIZE) urc = 0; env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); } -- 1.5.6.5 -- Lione Landwerlin O p e n W i d e 14, rue Gaillon 75002 Paris ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused 2009-02-16 22:41 [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused Lionel Landwerlin @ 2009-02-21 15:21 ` Lionel Landwerlin 2009-02-22 0:05 ` Lionel Landwerlin 2009-03-03 6:13 ` Aurelien Jarno 1 sibling, 1 reply; 6+ messages in thread From: Lionel Landwerlin @ 2009-02-21 15:21 UTC (permalink / raw) To: qemu-devel A more exact patch (according to datasheet) would be : Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> --- target-sh4/helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-sh4/helper.c b/target-sh4/helper.c index cd0f392..918a946 100644 --- a/target-sh4/helper.c +++ b/target-sh4/helper.c @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) urb = ((env->mmucr) >> 18) & 0x3f; urc = ((env->mmucr) >> 10) & 0x3f; urc++; - if (urc == urb || urc == UTLB_SIZE - 1) + if (urc == urb || urc > (UTLB_SIZE - 1)) urc = 0; env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); } -- 1.5.6.5 -- Lione Landwerlin O p e n W i d e 14, rue Gaillon 75002 Paris ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused 2009-02-21 15:21 ` Lionel Landwerlin @ 2009-02-22 0:05 ` Lionel Landwerlin 2009-03-03 6:15 ` Aurelien Jarno 0 siblings, 1 reply; 6+ messages in thread From: Lionel Landwerlin @ 2009-02-22 0:05 UTC (permalink / raw) To: qemu-devel Still not happy with the fix ... Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> --- target-sh4/helper.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/target-sh4/helper.c b/target-sh4/helper.c index cd0f392..8498d3f 100644 --- a/target-sh4/helper.c +++ b/target-sh4/helper.c @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) urb = ((env->mmucr) >> 18) & 0x3f; urc = ((env->mmucr) >> 10) & 0x3f; urc++; - if (urc == urb || urc == UTLB_SIZE - 1) + if (urc > urb || urc > (UTLB_SIZE - 1)) urc = 0; env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); } -- 1.5.6.5 -- Lione Landwerlin O p e n W i d e 14, rue Gaillon 75002 Paris ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused 2009-02-22 0:05 ` Lionel Landwerlin @ 2009-03-03 6:15 ` Aurelien Jarno 2009-03-03 7:12 ` Lionel Landwerlin 0 siblings, 1 reply; 6+ messages in thread From: Aurelien Jarno @ 2009-03-03 6:15 UTC (permalink / raw) To: Lionel Landwerlin; +Cc: qemu-devel On Sun, Feb 22, 2009 at 01:05:37AM +0100, Lionel Landwerlin wrote: > Still not happy with the fix ... > > Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> > --- > target-sh4/helper.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Sorry I missed this one when committing the first patch. I have applied it on top of it. > diff --git a/target-sh4/helper.c b/target-sh4/helper.c > index cd0f392..8498d3f 100644 > --- a/target-sh4/helper.c > +++ b/target-sh4/helper.c > @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) > urb = ((env->mmucr) >> 18) & 0x3f; > urc = ((env->mmucr) >> 10) & 0x3f; > urc++; > - if (urc == urb || urc == UTLB_SIZE - 1) > + if (urc > urb || urc > (UTLB_SIZE - 1)) > urc = 0; > env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); > } > -- > 1.5.6.5 > > > -- > Lione Landwerlin > > O p e n W i d e 14, rue Gaillon 75002 Paris > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused 2009-03-03 6:15 ` Aurelien Jarno @ 2009-03-03 7:12 ` Lionel Landwerlin 0 siblings, 0 replies; 6+ messages in thread From: Lionel Landwerlin @ 2009-03-03 7:12 UTC (permalink / raw) To: qemu-devel; +Cc: Aurelien Jarno Le mardi 03 mars 2009 à 07:15 +0100, Aurelien Jarno a écrit : > On Sun, Feb 22, 2009 at 01:05:37AM +0100, Lionel Landwerlin wrote: > > Still not happy with the fix ... > > > > Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> > > --- > > target-sh4/helper.c | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > Sorry I missed this one when committing the first patch. I have applied > it on top of it. > > > diff --git a/target-sh4/helper.c b/target-sh4/helper.c > > index cd0f392..8498d3f 100644 > > --- a/target-sh4/helper.c > > +++ b/target-sh4/helper.c > > @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) > > urb = ((env->mmucr) >> 18) & 0x3f; > > urc = ((env->mmucr) >> 10) & 0x3f; > > urc++; > > - if (urc == urb || urc == UTLB_SIZE - 1) > > + if (urc > urb || urc > (UTLB_SIZE - 1)) > > urc = 0; > > env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); > > } > > -- > > 1.5.6.5 Hi Aurelien, Thanks for applying my patches, but even with this version, I was still missing the real condition (according to SH4 datasheet) : Random counter for indicating the UTLB entry for which replacement is to be performed with an LDTLB instruction. URC is incremented each time the UTLB is accessed. When URB > 0, URC is reset to 0 when the condition URC = URB occurs. Also note that, if a value is written to URC by software which results in the condition URC > URB, incrementing is first performed in excess of URB until URC = 0x3F. URC is not incremented by an LDTLB instruction. So the final version is : [PATCH] SH4: Fixed last UTLB unused and URB/URC management Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> --- target-sh4/helper.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target-sh4/helper.c b/target-sh4/helper.c index cd0f392..54a3f1f 100644 --- a/target-sh4/helper.c +++ b/target-sh4/helper.c @@ -297,7 +297,7 @@ static int same_tlb_entry_exists(const tlb_t * haystack, uint8_t nbtlb, return 0; } static void increment_urc(CPUState * env) { uint8_t urb, urc; @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) urb = ((env->mmucr) >> 18) & 0x3f; urc = ((env->mmucr) >> 10) & 0x3f; urc++; - if (urc == urb || urc == UTLB_SIZE - 1) + if ((urb > 0 && urc > urb) || urc > (UTLB_SIZE - 1)) urc = 0; env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); } -- 1.5.6.5 Sorry for that mistake. -- Lionel Landwerlin <lionel.landwerlin@openwide.fr> ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused 2009-02-16 22:41 [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused Lionel Landwerlin 2009-02-21 15:21 ` Lionel Landwerlin @ 2009-03-03 6:13 ` Aurelien Jarno 1 sibling, 0 replies; 6+ messages in thread From: Aurelien Jarno @ 2009-03-03 6:13 UTC (permalink / raw) To: Lionel Landwerlin; +Cc: qemu-devel On Mon, Feb 16, 2009 at 11:41:03PM +0100, Lionel Landwerlin wrote: > With my previous patch (the one monitoring tlb), I found that the last > TLB entry was never use. Here a little fix. > > > Signed-off-by: Lionel Landwerlin <lionel.landwerlin@openwide.fr> Thanks, applied. > --- > target-sh4/helper.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/target-sh4/helper.c b/target-sh4/helper.c > index cd0f392..918a946 100644 > --- a/target-sh4/helper.c > +++ b/target-sh4/helper.c > @@ -305,7 +305,7 @@ static void increment_urc(CPUState * env) > urb = ((env->mmucr) >> 18) & 0x3f; > urc = ((env->mmucr) >> 10) & 0x3f; > urc++; > - if (urc == urb || urc == UTLB_SIZE - 1) > + if (urc == urb || urc == UTLB_SIZE) > urc = 0; > env->mmucr = (env->mmucr & 0xffff03ff) | (urc << 10); > } > -- > 1.5.6.5 > > > -- > Lione Landwerlin > > O p e n W i d e 14, rue Gaillon 75002 Paris > > > > -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-03 7:12 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-02-16 22:41 [Qemu-devel] [PATCH] SH4: Fixed last UTLB unused Lionel Landwerlin 2009-02-21 15:21 ` Lionel Landwerlin 2009-02-22 0:05 ` Lionel Landwerlin 2009-03-03 6:15 ` Aurelien Jarno 2009-03-03 7:12 ` Lionel Landwerlin 2009-03-03 6:13 ` Aurelien Jarno
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).