[comp.sys.atari.st] The mysteries of Pexec - Help

david@looking.UUCP (01/07/87)

I am writing a profiler for the ST, everything is done except for a few
crucial parts.  When I get an address from the interrupt,
I need to make it relative to the basepage of the currently executing
application.  As I see it there might be two ways of doing this.

GEMDOS might possibly keep a pointer to the basepage of the currently
running application, but I haven't been able to find one anywhere,
or I can use Pexec in two stages, one to load the program to profile,
(Pexec returns the load address in this mode), and then use Pexec 
to execute the program.

There is one problem, though these various modes are mentioned in the
Atari Docs, they are not fully documented.  The reader is referred to
the 'Pexec Cookbook', which according to Atari Canada, does not exist.
As of yet, I have not been able to get this method to work.

Neil, Landon ?  Comments ?

Any insight on this would be appreciated.

I will post the profiler to the net when it is finished.

David Rowley
Looking Glass Software
Waterloo, Ontario
...!utzoo!watmath!looking!david

bammi@cwruecmp.UUCP (01/08/87)

In article <724@looking.UUCP> david@looking.UUCP (David Rowley) writes:
>
>There is one problem, though these various modes are mentioned in the
>Atari Docs, they are not fully documented.  The reader is referred to
>the 'Pexec Cookbook', which according to Atari Canada, does not exist.
>As of yet, I have not been able to get this method to work.
>
	If you are programming in Alcyon C, to get at the base page address
all you have to do is to declare an external (long)variable '_base'. In
gemstart.s the variable __base gets assigned the value of the baspage address.
If you are not using Alcyon C, you can still pick up the value in your
gemstart.s and pass it on to your program in a similar manner. 
In gemstart.s
	.globl	__base
	 ...........
	.text

	move.l	a7,a5		* First executed instruction
	move.l	4(a5),a5	* a5=basepage address
	move.l	a5,__base	* save pointer to basepage
	.data
__base .ds.l 	1


	I had this same problem with Pexec. I could
get Pexec to load  & not go (mode 3) using

	char *basepage, *file, *commandl;
	int status;

	basepage = Pexec(3, file, commandl, (long)NULL);

	But i could not get the just go (mode 4) function to work. It always
bombs out. I called it as follows

	status = Pexec(4, (long)NULL, (long)NULL, basepage);
				^^^^^^^^^^^^^^
				this is different from what the Hitch Hikers
				origonally said.
I asked the question here and did'nt get any response from Atari. Is
anyone listening ?? 
-- 
usenet: .....!decvax!cwruecmp!bammi		jwahar r. bammi
csnet:       bammi@case
arpa:        bammi%case@csnet-relay
compuServe:  71515,155

iarocci@eneevax.UUCP (Bill Dorsey) (01/11/87)

Someone wanted to know if gemdos maintains a pointer to the currently exec-
uting process' basepage; well, it turns out it does.  The location is $602C.
Hope this helps.

dyer@atari.UUcp (Landon Dyer) (01/12/87)

in article <561@eneevax.UUCP>, iarocci@eneevax.UUCP (Bill Dorsey) says:
> 
> Someone wanted to know if gemdos maintains a pointer to the currently exec-
> uting process' basepage; well, it turns out it does.  The location is $602C.
> Hope this helps.

Nope, it doesn't help.  If you use this location, your software is
*gaurenteed* to break in a new release of the operating system.  The
magic location may not, in fact, even work as Bill claims it does.

There *are* several revisions of the TOS ROMs in existence....

-- 

-Landon Dyer, Atari Corp.		        {sun,lll-lcc,imagen}!atari!dyer

/-----------------------------------------------\
| The views represented here do not necessarily | "If Business is War, then
| reflect those of Atari Corp., or even my own. |  I'm a Prisoner of Business!"
\-----------------------------------------------/