All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Bug] [Patch] MIPS code fails at branch instruction
Date: Sun, 25 Mar 2007 03:43:16 +0200	[thread overview]
Message-ID: <4605D3B4.4000402@aurel32.net> (raw)
In-Reply-To: <20070325002234.GA14411@networkno.de>

Thiemo Seufer a écrit :
> Stefan Weil wrote:
>> Hi,
>>
>> here is the patch which adds a "4KEcR1" CPU (a 4KEc, processor revision 2.2,
>> with MIPS32 Release 1 (!) instruction set is the heart of the AR7 SoC).
>>
>> See also include/asm-mips/cpu.h in the Linux kernel sources:
>> ./include/asm-mips/cpu.h:#define PRID_IMP_4KEC          0x8400
>> ./include/asm-mips/cpu.h:#define PRID_IMP_4KECR2        0x9000
> 
> This was the bit which prompted to to ask The People Who Know[TM].
> Indeed the early 4KEc were MIPS32R1 only. About the branch-in-delay-slot
> I got the following information:
> 
> Very simple pipelines with branch delay slots tend to behave like this
> (when both branches are taken):
> 
>  - Execute the first branch, that is, calculate the target of the
>    branch. This has no effect until it ran far enough through the
>    pipeline. Increment PC.
>  - Execute the second branch. This changes the branch target value
>    again. Increment PC.
>  - Execute the second branch's delay slot instruction. Increment PC.
>  - Now the PC is overridden by the first branch's target. A single
>    instruction from that place is executed.
>  - The PC is overridden again by the second branch's target. Normal
>    execution resumes from there.
> 
> Apparently the SPARC architecture _requires_ this behaviour for all
> CPUs.

Yep I confirm that, it is clearly explained starting at the page 54 of
the SPARC v8 manual. To avoid this behaviour it is possible to cancel
the delay slot instruction by having a=1.

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

  reply	other threads:[~2007-03-25  1:46 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-16 23:12 [Qemu-devel] [Bug] MIPS code fails at branch instruction Stefan Weil
2007-03-17  0:46 ` Thiemo Seufer
2007-03-17 11:37   ` Stefan Weil
2007-03-17 14:31     ` Thiemo Seufer
2007-03-17 18:57       ` Stefan Weil
2007-03-17 20:32         ` Paul Brook
2007-03-19 21:04           ` [Qemu-devel] [Bug] [Patch] " Stefan Weil
2007-03-19 21:34             ` Thiemo Seufer
2007-03-19 22:34               ` Thiemo Seufer
2007-03-20  7:54                 ` Alexander Voropay
2007-03-20  9:51                   ` Thiemo Seufer
2007-03-20 18:27                 ` Stefan Weil
2007-03-25  0:22                   ` Thiemo Seufer
2007-03-25  1:43                     ` Aurelien Jarno [this message]
2007-03-25 12:51                       ` Stuart Brady
2007-03-25 16:26                         ` Thiemo Seufer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4605D3B4.4000402@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.