The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: dds@aueb.gr (Diomidis Spinellis)
Subject: [TUHS] Early Unix function calls: expensive?
Date: Tue, 5 Jan 2016 19:33:24 +0200	[thread overview]
Message-ID: <568BFE64.7080906@aueb.gr> (raw)
In-Reply-To: <20160105164642.GA20786@mercury.ccil.org>

On 05/01/2016 18:46, John Cowan wrote:
> Clem Cole scripsit:
> 
>> On Mon, Jan 4, 2016 at 9:00 PM, Ronald Natalie <ron at ronnatalie.com> wrote:
>>
>>> Just never figured out how to make good use of the MARK instruction on the
>>> PDP-11.
>>
>> If I understand it correctly, few if anyone did.
> 
> My guess would be that it was intended to support the antiquated Fortran
> feature of "multiple returns"

Digital's handbook presents a reasonable (if unusual for Unix) calling
convention that uses MARK.  It terms the convention "the standard PDP-11
subroutine return convention".

https://pdos.csail.mit.edu/6.828/2005/readings/pdp11-40.pdf#page=107

This convention pushes a tailored MARK instruction onto the stack, and
then has the called routine return to the address of the pushed MARK
instruction.  MARK will in turn clean up the stack and restore R5.  If I
understand things correctly, this saves one instruction over doing the
same things through other explicit instructions.

Interestingly, many years before the invention of stack smashing
attacks, we had a calling convention that was based on executing code
placed on the stack.


  reply	other threads:[~2016-01-05 17:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-03 23:35 Warren Toomey
2016-01-03 23:53 ` Tim Bradshaw
2016-01-04  0:01   ` John Cowan
2016-01-04  4:40     ` Armando Stettner
2016-01-04  8:52       ` Tim Bradshaw
2016-01-04 17:29         ` Larry McVoy
2016-01-04 13:50       ` Clem Cole
2016-01-05  2:00       ` Ronald Natalie
2016-01-05 15:13         ` Clem Cole
2016-01-05 16:46           ` John Cowan
2016-01-05 17:33             ` Diomidis Spinellis [this message]
2016-01-05 17:42             ` Clem Cole
2016-01-05 17:28           ` Ronald Natalie
2016-01-05 17:43             ` Clem Cole
2016-01-05 17:46               ` Ronald Natalie
2016-01-05 18:03                 ` Warner Losh
2016-01-05 18:24                   ` Ronald Natalie
2016-01-05 20:26                     ` scj
2016-01-05 20:49                     ` John Cowan
2016-01-05 23:24         ` Dave Horsfall
2016-01-05 23:55           ` Ronald Natalie
2016-01-04  0:00 ` John Cowan
2016-01-04  0:42 ` scj
2016-01-04 11:35   ` Tony Finch
     [not found] <mailman.3.1451865187.15972.tuhs@minnie.tuhs.org>
2016-01-04  1:08 ` Johnny Billquist
2016-01-04  1:29   ` Larry McVoy
2016-01-04  1:31 Noel Chiappa
2016-01-04  2:24 ` scj
2016-01-04  4:24   ` Larry McVoy
2016-01-04  1:59 Norman Wilson
2016-01-04 15:09 ` John Cowan
2016-01-04  2:21 Clem Cole
2016-01-04 12:53 Noel Chiappa

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=568BFE64.7080906@aueb.gr \
    --to=dds@aueb.gr \
    /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).