9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Eris Discordia" <eris.discordia@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] Non-stack-based calling conventions
Date: Sat, 16 Feb 2008 23:32:30 +0000	[thread overview]
Message-ID: <op.t6m4vdr9c6yvfe@computer> (raw)
In-Reply-To: <11c3f7123799c7bb2fb4637fc62a10f8@coraid.com>

On Fri, 15 Feb 2008 23:39:40 -0000, Pietro Gagliardi <pietro10@mac.com>
wrote:

> - DOS interrupt function calls use the registers, not the stack.
> - SPARC and MIPS registers are provided to pass parameters.
>
> On Feb 15, 2008, at 6:37 PM, Lyndon Nerenberg wrote:
>
>>>
>>> The calling conventions I have seen are the ccall, stdcall (Windows'
>>> slightly modified version of the ccall), and pascal. All of them push
>>> parameters on the stack.
>>
>> Take a look at the R-call and S-call conventions used on the IBM System
>> 360 architecture. These machines didn't even have a stack.
>>
>> --lyndon
>

Good pieces of info. By the way, MS-DOS software interrupts were
interrupts after all, i. e. different from procedure calls. Using the
stack there would create re-entry problems (?) and a serious performance
bottleneck (heh, MS-DOS to performance is Pumpkins to what?).

On Sat, 16 Feb 2008 00:23:22 -0000, Brantley Coile <brantley@coraid.com>
wrote:

> Early Control Data machines, like many machines
> of the era, used the return address to fine the parameters.
> This meant that you put he parameters in the instruction
> stream right after the call to the subroutine.
>
> Here's the calling convention for your entertainment.
>
>  1) The calling program would put the parameters into memory
>     locations just past the call to the subroutine.
>  2) Do a return-jump to the subroutine.  This puts the return
>     address in the first word of the subroutine and
>     begins to execute the second word.
>  3) Parameters are accessed by using and incrementing the
>     return address.
>  4) With the return address now safely stored in the first
>     word of the subroutine, we can now return to the
>     calling routine just by doing a indirect jump thru
>     the first word of the routine.
>    All this might not make sense to you so here is some code.

In fact, your explanation made much more sense than the code. To me, of
course. The question of why would anyone devise such a weird scheme of
calling procedures remains.

> All the memory you would need was known as compile time.

At the cost of transforming relocation into black magic. Were there
binaries on that platform? Did those binaries need relocation? With code
and data intermingled, there must have also been serious problems with
minimizing binary sizes. All the "empty" words at the beginning of each
subroutine had to be written to permanent storage, I guess. The x86 stack
consumes zero space on permanent storage.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/


  reply	other threads:[~2008-02-16 23:32 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13 22:03 [9fans] quote of the day erik quanstrom
2008-02-13 23:08 ` Pietro Gagliardi
2008-02-13 23:24 ` [9fans] Google search " dave.l
2008-02-13 23:31   ` Pietro Gagliardi
2008-02-13 23:41     ` erik quanstrom
2008-02-13 23:49       ` Pietro Gagliardi
2008-02-13 23:59     ` john
2008-02-14  0:04       ` Pietro Gagliardi
2008-02-14  6:11         ` Anant Narayanan
2008-02-15 17:39         ` Skip Tavakkolian
2008-02-14 16:45       ` Douglas A. Gwyn
2008-02-14 17:09         ` john
2008-02-14 17:27           ` erik quanstrom
2008-02-15  9:50             ` Douglas A. Gwyn
2008-02-15 11:49               ` Alf
2008-02-15 13:15               ` erik quanstrom
2008-02-15 14:56                 ` Brantley Coile
2008-02-15 15:44                   ` Eris Discordia
2008-02-15 16:07                     ` erik quanstrom
2008-02-15 16:43                       ` maht
2008-02-15 17:35                         ` ron minnich
2008-02-15 18:14                           ` Iruata Souza
2008-02-15 18:37                           ` maht
2008-02-15 17:39                       ` Eris Discordia
2008-02-15 19:05                         ` maht
2008-02-15 20:11                           ` Eris Discordia
2008-02-15 20:18                             ` Pietro Gagliardi
2008-02-15 20:49                             ` maht
2008-02-16 23:32                               ` Eris Discordia
2008-02-15 23:37                         ` [9fans] Non-stack-based calling conventions Lyndon Nerenberg
2008-02-15 23:39                           ` Pietro Gagliardi
2008-02-15 23:47                             ` Paweł Lasek
2008-02-16  0:23                               ` Brantley Coile
2008-02-16 23:32                                 ` Eris Discordia [this message]
2008-02-16 23:41                                   ` Pietro Gagliardi
2008-02-16 23:49                                   ` Brantley Coile
2008-02-17  0:04                                   ` Brantley Coile
2008-02-17 13:30                                     ` Eris Discordia
2008-02-17 15:04                                       ` erik quanstrom
2008-02-17 21:43                                         ` Uriel
2008-02-17 23:58                                           ` erik quanstrom
2008-02-18  1:54                                             ` Bruce Ellis
2008-02-18  3:43                                               ` erik quanstrom
2008-02-18  4:31                                                 ` Bruce Ellis
2008-02-18  4:40                                                   ` Pietro Gagliardi
2008-02-18  6:22                                               ` Robert William Fuller
2008-02-18  7:23                                                 ` Bruce Ellis
2008-02-18  8:38                                                   ` Anant Narayanan
2008-02-22 10:02                                                     ` Douglas A. Gwyn
2008-02-22 19:35                                                       ` Anant Narayanan
2008-02-18  8:30                                                 ` Anant Narayanan
2008-02-18  8:44                                                   ` Bruce Ellis
2008-02-18 18:50                                                 ` Federico G. Benavento
2008-02-18 21:53                                                   ` Lorenzo Fernando Bivens de la Fuente
2008-02-18 22:55                                                     ` y i y u s
2008-02-18 23:46                                                       ` Uriel
2008-02-18 22:14                                                   ` Pietro Gagliardi
2008-02-18 22:16                                                     ` Pietro Gagliardi
2008-02-18 22:32                                                       ` Federico G. Benavento
2008-02-20 11:39                                                   ` maht
2008-02-20 17:19                                                     ` Bruce Ellis
2008-02-22 10:02                                                     ` Douglas A. Gwyn
2008-02-22 10:02                                                   ` Douglas A. Gwyn
2008-02-18 22:13                                                 ` LiteStar numnums
2008-02-18  4:44                                             ` Pietro Gagliardi
2008-02-18  4:46                                               ` Pietro Gagliardi
2008-02-18  5:03                                                 ` Uriel
2008-02-17 16:08                                       ` Anthony Sorace
2008-02-17 22:03                                         ` Charles Forsyth
2008-02-22 10:01                                       ` Douglas A. Gwyn
2008-02-22 14:07                                         ` Iruata Souza
2008-02-22 10:01                                     ` Douglas A. Gwyn
2008-02-22 10:01                                 ` Douglas A. Gwyn
2008-02-16  8:29                               ` Lluís Batlle
2008-02-17 23:09                                 ` Chad Dougherty
2008-02-18 21:50                                 ` Pietro Gagliardi
2008-02-22 10:02                                 ` Douglas A. Gwyn
2008-02-26 21:30                               ` Paweł Lasek
2008-02-26 22:00                                 ` maht
2008-02-26 22:32                                   ` Brantley Coile
2008-02-26 23:15                                     ` Uriel
2008-02-26 22:33                                   ` Brantley Coile
2008-02-26 22:46                                     ` Bruce Ellis
2008-02-27  4:26                                 ` lucio
2008-02-27  6:52                                   ` ron minnich
2008-02-27 17:57                                     ` lucio
2008-02-28  9:33                                     ` Bill Gunshannon
2008-02-28  9:58                                       ` Charles Forsyth
2008-02-28 14:15                                       ` Bill Gunshannon
2008-02-14 17:14         ` [9fans] Google search of the day Eris Discordia
2008-02-14 17:28           ` Fco. J. Ballesteros
2008-02-14 20:14             ` Eris Discordia
2008-02-14 20:30               ` Patrick Kristiansen
2008-02-14 20:38                 ` Eris Discordia
2008-02-14 22:09                   ` Pietro Gagliardi
2008-02-15  9:00                     ` Eris Discordia
2008-02-14 17:51           ` Iruata Souza
2008-02-15  9:31             ` sqweek
2008-02-18  9:48               ` Douglas A. Gwyn
2008-02-18  9:57                 ` Gorka Guardiola
2008-02-19  9:17                 ` sqweek
2008-02-19  0:28 [9fans] Non-stack-based calling conventions Andrew Simmons
2008-02-19  0:39 ` Brantley Coile
2008-02-19  0:43   ` Andrew Simmons
2008-02-19  0:52     ` Uriel
2008-02-19  1:06       ` Pietro Gagliardi
2008-02-19  1:33         ` Brantley Coile
2008-02-19  3:18         ` Michaelian Ennis
2008-02-19  3:29           ` Michaelian Ennis
2008-02-19  3:35             ` Pietro Gagliardi
2008-02-19  5:18       ` Skip Tavakkolian
2008-02-19  5:33       ` Skip Tavakkolian
2008-02-19  4:11   ` Bruce Ellis
2008-02-20 14:59     ` maht
2008-02-20 15:28     ` Uriel

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=op.t6m4vdr9c6yvfe@computer \
    --to=eris.discordia@gmail.com \
    --cc=9fans@cse.psu.edu \
    /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).