9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Jens Staal <staal1978@gmail.com>
To: 9fans@9fans.net
Subject: [9fans] a jmp_buf in APE question
Date: Mon,  7 Jan 2013 06:45:42 +0100	[thread overview]
Message-ID: <1752877.EVzC7FFEmr@krypton> (raw)

Hi all. Perhaps I have been looking at completely the wrong places and perhaps
I am just not grasping it at all.

For a package that I want to build under APE, I need to put in the stack
pointer (sp) and the program counter (pc) part of jmp_buf specific for Plan9
(since APE does not expose any stack-related functions that could have been
used)

according to /sys/include/ape/setjmp.h, jmp_buf is an array of 10 int:s.

I then went to check out /sys/src/ape/lib/ap/$objtype/setjmp.s
but I could not really understand anything in those files

luckily, I also looked at the GAS-formatted setjmp.s in the GCC-port of the
APE libs.
There, it seems that each function with a jmp_buf variable as an argument has
a set of 10 rows of operations (which I guess correspond to the 10 values in
jmp_buf). Based on that, it would seem that the value for sp is in jmp_buf[2]
and for pc in jmp_buf[3].

Am I correct or have I totally misunderstood how these things work? I am a
self-taught hobbyist so sometimes really basic stuff can have eluded me.

The second question would be, is the position of those two values in jmp_buf
architecture-specific so that I should make a note of that it is working on
i386 only?



             reply	other threads:[~2013-01-07  5:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07  5:45 Jens Staal [this message]
2013-01-07 10:31 ` erik quanstrom
2013-01-07 11:05   ` Jens Staal
2013-01-07 11:15     ` erik quanstrom
2013-01-07 16:43       ` Jens Staal

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=1752877.EVzC7FFEmr@krypton \
    --to=staal1978@gmail.com \
    --cc=9fans@9fans.net \
    /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).