Newsgroups: comp.sys.amiga.programmer,amiga.welmat
Path: utzoo!utgpu!cunews!micor!latour!mcr
From: mcr@Sandelman.OCUnix.On.Ca (Michael Richardson)
Subject: Re: Starting another copy of your own code (was Re: Help! (AmigaDOS CreateProc/LoadSeg)
Message-ID: <1991Mar11.012700.16121@Sandelman.OCUnix.On.Ca>
Followup-To: comp.sys.amiga.programmer
Organization: Sandelman Software Works, Debugging Department, Ottawa, ON
References: <18cb4d63.ARN0b56@swinjm.UUCP> <1991Mar9.170859.4810@Sandelman.OCUnix.On.Ca> <06493.AA06493@babylon.rmt.sub.org>
Date: Mon, 11 Mar 1991 01:27:00 GMT

In article <06493.AA06493@babylon.rmt.sub.org> cbmvax.commodore.com!cbmehq!babylon!rbabel (Ralph Babel) writes:
>In article <1991Mar9.170859.4810@Sandelman.OCUnix.On.Ca>,
>mcr@Sandelman.OCUnix.On.Ca (Michael Richardson) writes:
>
>> Please suggest an alternative to doing this.
>
>Simply use a function entry that is longword-aligned, e.g.
>an assembly language stub after a "CNOP 0,4" or the first
>(C-) function in an object module, and convert it to a
>seglist:
>
>void (*pfv)(void);
>BPTR sl;
>
>sl = (BPTR)(((ULONG)pfv >> 2) - 1);

  Thank you. This had not occured to me, and I'm a little hesistant
about it. We shall try this.

>> CopyMem(&template, fakelist, sizeof(struct PhonySegList));
>> fakelist->psl_EntryPoint = SlaveStart;
>
>Sorry, self-modifying code. Even if Leo did it. :-)

  No dispute about it being not exactly kosher. I had assumed that the
first long word (which was NULL, the next pointer) was used in some
way. Probably we'll wind up assembling a short assembly program to
'jmp' to the right place rather than depend on the function being
first. 
  Actually, we are probably going to pull the two processes into
seperate binaries. It will allow a lot more customization. (And a lot
more user confusion :-)




-- 
   :!mcr!:            |  The postmaster never | - Pay attention only
   Michael Richardson |    resolves twice.    | to _MY_ opinions. -  
 HOME: mcr@sandelman.ocunix.on.ca +   Small Ottawa nodes contact me
 Bell: (613) 237-5629             +    about joining ocunix.on.ca!
