* makecontext(3) and swapcontext(3) for OSF/1 V2.0 ?
@ 1995-02-05 10:57 Andrew Gabriel
0 siblings, 0 replies; only message in thread
From: Andrew Gabriel @ 1995-02-05 10:57 UTC (permalink / raw)
Cc: Andrew.Gabriel
I am porting an application to DEC Alpha running OSF/1 V2.0, which
is new to me. We make use of the internal process context switching
functions getcontext(2), makecontext(3), and swapcontext(3).
However, OSF/1 seems to be missing makecontext(3) and swapcontext(3).
No problem, I thought. The missing ones are only library functions;
I'll write them myself... ...famous last words!
I have written a plausable swapcontext(3), based on getcontext(2)
and setcontext(2). Not actually tried it yet though.
However, I cannot get my makecontext(3) to work.
I think this takes a ucontext_t structure, and modifies the
program counter saved in it, setting it to the address of a function
passed as an argument. (It also allows arguments to be passed to the
function, but I've ignored this since in my case, I never pass any.)
However, this does not seem to be working.
When I call setcontext(2), it seems to resume from where getcontext(2)
was last called, rather than the function address passed to a more
recent call on my makecontext(3). This implies to me that I am not
saving the function address in the right place. I have tried saving
it in sc_pc and in sc_regs[30] (or sc_regs[26], whichever one isn't
the stack pointer - this is from memory since listings are at work
and I'm currently at home, I might also have names slightly wrong).
Can anyone help me out? I found the program counter by repeatedly
calling getcontext(2) (not in a loop) and seeing which register in
sc_regs[] incremented appropriately between each call (none of the
others changed). But there are two other locations in u_context
which, judging from their names, might also be program counters?
As an added complication, each of my contexts runs with its own
stack. So I also need to know where the stack pointer should be
saved in the u_context structure (again, there's more than one
possible location).
Thanks,
--
Andrew Gabriel Home: Andrew@cucumber.demon.co.uk
Consultant Software Engineer Work: Andrew.Gabriel@net-tel.co.uk
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1995-02-05 10:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-02-05 10:57 makecontext(3) and swapcontext(3) for OSF/1 V2.0 ? Andrew Gabriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox