🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: mod.computers.pyramid
Article #47

Submission for mod-computers-pyramid

#47
From: andrew
Date: Mon, 02 Feb 1987 04:33
53 lines
2264 bytes
Path: vuwcomp!andrew
From: andrew@vuwcomp.UUCP (Andrew Vignaux)
Newsgroups: mod.computers.pyramid
Subject: Problems with chgstack()
Keywords: chgstack
Message-ID: <12615@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@vuwcomp.nz
Technical Details
Message-ID: <8702020434.AA27730@vuwcomp>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ucbvax!andrew@seismo.css.gov@vuwcomp.UUCP

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!cbatt!ucbvax!andrew@seismo.css.gov@vuwcomp.UUCP
From: andrew@seismo.css.gov@vuwcomp.UUCP
Newsgroups: mod.computers.pyramid
Subject: Submission for mod-computers-pyramid
Message-ID: <8702020434.AA27730@vuwcomp>
Date: Sun, 1-Feb-87 23:33:59 EST
Article-I.D.: vuwcomp.8702020434.AA27730
Posted: Sun Feb  1 23:33:59 1987
Date-Received: Sat, 7-Feb-87 12:32:42 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 53
Approved: info-pyramid@mimsy.umd.edu