[TUHS] Early Unix function calls: expensive?

Diomidis Spinellis dds at aueb.gr
Wed Jan 6 03:33:24 AEST 2016

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".


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.

More information about the TUHS mailing list