All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Carlos O'Donell Jr." <carlos@megatonmonkey.net>
To: John Marvin <jsm@udlkern.fc.hp.com>, parisc-linux@lists.parisc-linux.org
Subject: Re: [parisc-linux] Delayed branching explanation
Date: Wed, 3 Oct 2001 10:28:48 -0400	[thread overview]
Message-ID: <20011003102848.C18841@megatonmonkey.net> (raw)
In-Reply-To: <200110031004.EAA15528@udlkern.fc.hp.com>; from jsm@udlkern.fc.hp.com on Wed, Oct 03, 2001 at 04:04:31AM -0600

> 
> One more step:
> 
>     pc[0] -> target2
>     pc[1] -> target2 + 4
> 
> the "cool" thing about the above sequence is that the instruction at
> target1 gets executed, and then immediately we jump somewhere else, i.e.
> we can execute one instruction somewhere and then immediately go somewhere
> else (without having a branch at target1).  If you follow this example,
> then you really understand delayed branching.
> 
> Note that the above example is the whole reason we must have a "B" bit in
> the PSW (processor status word).  The B bit is set by any taken branch,
> and is cleared by any other instruction.  The "gate" instruction, which is
> used for privilege promotion, will fault if the B bit is set when the gate
> instruction is executed.  The reason is that even though the gate
> instruction can only be located on a execute only page (i.e. you can't
> change the instruction sequence), you could use the above trick to execute
> only the gate instruction and then return to your own code with increased
> privilege if the "B" bit didn't exist.
> 
>

This is very very similar to the the Sparc.
Delayed branches are an interesting compiler optimization.

I think I see what you mean about "B" being in the PSW, though
I'm not clear on the semantics of an execute only page.

Time to hit the books again!

Thanks for the interesting explanation John!

c.

  reply	other threads:[~2001-10-03 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-03 10:04 [parisc-linux] Delayed branching explanation John Marvin
2001-10-03 14:28 ` Carlos O'Donell Jr. [this message]
2001-10-06 14:18 ` [parisc-linux] " Michael S.Zick

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=20011003102848.C18841@megatonmonkey.net \
    --to=carlos@megatonmonkey.net \
    --cc=jsm@udlkern.fc.hp.com \
    --cc=parisc-linux@lists.parisc-linux.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.