Submission for mod-computers-pyramid

andrew at seismo.css.gov andrew at seismo.css.gov
Mon Feb 2 14:33:59 AEST 1987


Path: vuwcomp!andrew
From: andrew at vuwcomp.UUCP (Andrew Vignaux)
Newsgroups: mod.computers.pyramid
Subject: Problems with chgstack()
Keywords: chgstack
Message-ID: <12615 at vuwcomp.UUCP>
Date: 2 Feb 87 04:33:58 GMT
Organization: Comp Sci, Victoria Univ., Wellington, New Zealand
Lines: 43

I am having problems getting chgstack() to work.  I can set up a
context but when I try returning to a previous context I get a Bus
error.  This seems to be because chgstack() is placing a strange value
in the "codeaddr" field of the context and the system call has nowhere
to go when it returns.

Example:
	struct context *to_context, *from_context;
	extern int my_routine ();
	. . .
	malloc space etc.
	. . .
	to_context -> codeaddr = my_routine;
	. . .
	ret = chgstack (to_context, from_context);

	. . . (much later in my_routine())
	ret = chgstack (from_context, to_context);
	Bus error!
	

"my_routine" gets called but the "from_context->codeaddr" is set
to a value inside the stack "range" and nowhere near my program.  We
are running OSx 3.1.

The manual entry does not give an example so I am probably passing
something wrong.  I am also confused about the pointers "stktop",
"stkcfp" and "stkbottom" and what I should initialise them to when I
make a new context.

Could someone either:
	(a)	tell me (e-mail) what I am doing wrong,
	(b)	send me an example program,
	(c)	tell me to give up and get back to my masters (:-)

Thanks,
	Andrew

-------------------------------------------------------------
Rule Six: The winning team shall be the first team that wins.

UUCP: ...!{alberta,ubc-vision}!calgary!vuwcomp!andrew
ACSnet:  andrew at vuwcomp.nz



More information about the Mod.computers.pyramid mailing list