The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: bqt@update.uu.se (Johnny Billquist)
Subject: [TUHS] Happy birthday, PDP-8!
Date: Wed, 29 Mar 2017 00:10:26 +0200	[thread overview]
Message-ID: <4dd54b02-7f1a-b594-0e25-009bc650c1c9@update.uu.se> (raw)
In-Reply-To: <mailman.659.1490686648.3779.tuhs@minnie.tuhs.org>

On 2017-03-28 09:37, jnc at mercury.lcs.mit.edu (Noel Chiappa) wrote:

>
>     > From: Johnny Billquist
>
>     > the PDP-11 have the means of doing this as well....  If anyone ever
>     > wondered about the strangeness of the JSR instruction of the PDP-11, it
>     > is precisely because of this.
>     > ...
>     > I doubt Unix ever used this, but maybe someone know of some obscure
>     > inner kernel code that do. :-)
>
> Actually Unix does use JSR with a non-PC register to hold the return address
> very extensively; but it also uses the 'saved PC points to the argument'
> technique; although only in a limited way. (Well, there may have been some
> user-mode commands that were not in C that used it, I don't know about that.)
>
> First, the 'PC points to arguments': the device interrrupts use that. All
> device interrupt vectors point to code that looks like:
>
> 	jsr r0, _call
> 	_iservice
>
> where iservice() is the interrupt service routine. call: is a common
> assembler-language routine that calls iservice(); the return from there goes
> to later down in call:, which does the return from interrupt.

Ah. Thanks for that. I hadn't dug into those parts, but that's the kind 
of place where I might have suspected it might have been, if anywhere.

> Use of a non-PC return address register is used in every C routine; to save
> space, there is only one copy of the linkage code that sets up the stack
> frame; PDP-11 C, by convention, uses R5 for the frame pointer. So that common
> code (csv) is called with a:
>
>      jsr r5, csv
>
> which saves the old FP on the stack; CSV does the rest of the work, and jumps
> back to the calling routine, at the address in R5 when csv: is entered. (There's
> a similar routine, cret:, to discard the frame, but it's 'called' with a plain
> jmp.)

Hah! Thinking about it, I actually knew that calling style, but didn't 
reflect on it, as you're not passing any arguments in the instruction 
stream in that situation.
But it's indeed not using the PC as the register in the call, so I guess 
it should count in some way. :-)

	Johnny



       reply	other threads:[~2017-03-28 22:10 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.659.1490686648.3779.tuhs@minnie.tuhs.org>
2017-03-28 22:10 ` Johnny Billquist [this message]
2018-03-21 21:52 Dave Horsfall
2018-03-21 21:59 ` George Michaelson
  -- strict thread matches above, loose matches on Subject: below --
2017-03-28  2:38 Noel Chiappa
     [not found] <mailman.1.1490580001.4973.tuhs@minnie.tuhs.org>
2017-03-27 23:30 ` Johnny Billquist
2017-03-27 23:33   ` Steve Nickolas
2017-03-27 23:49     ` Johnny Billquist
2017-03-27  1:24 Noel Chiappa
2017-03-27 14:07 ` Arthur Krewat
2017-03-27  0:31 Noel Chiappa
2017-03-27  0:37 ` Arthur Krewat
2017-03-27 12:05 ` Tim Bradshaw
2017-03-27 13:35   ` Tony Finch
2017-03-27 21:37   ` Terry Smith
2017-03-21 23:57 Atindra Chaturvedi
2017-03-21 21:34 Dave Horsfall
2017-03-22 16:34 ` Ron Natalie
2017-03-26 19:49   ` Dave Horsfall
2017-03-26 20:11     ` Paul Winalski
2017-03-26 22:20       ` Greg 'groggy' Lehey
2017-03-26 22:25     ` Greg 'groggy' Lehey

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=4dd54b02-7f1a-b594-0e25-009bc650c1c9@update.uu.se \
    --to=bqt@update.uu.se \
    /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 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).