Megalextoria
Retro computing and gaming, sci-fi books, tv and movies and other geeky stuff.

Home » Archive » comp.sys.amiga » Re: Help creating a Task; CreateProc()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Help creating a Task; CreateProc() [message #293880] Tue, 09 December 1986 02:23
dillon is currently offline  dillon
Messages: 81
Registered: November 1985
Karma: 0
Member
Article-I.D.: cory.8612090723.AA28823
Posted: Tue Dec  9 02:23:19 1986
Date-Received: Tue, 9-Dec-86 09:32:21 EST
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: University of California at Berkeley
Lines: 45

extern struct Process *CreateProc();
extern void asm_go();

struct Process *proc;
long priority = 0;

proc = CreateProc("proce_sname", priority, (long)asm_go >> 2, 4096);


Here I am creating a process called "process_name" with priority 0 (normal), 
a stack of 4096 bytes, which begins at asm_go, which is some procedure.

I have to convert the address of asm_go to a BPTR (BCPL pointer).
The code actually starts at (bcplpointer << 2) + 4, as you can see by
the assembly below.

I think Manx requires one of the address registers to hold some
base pointer.  If using lattice, compile with the -v option to disable
stack checking.

asm_go() cannot be a normal C function, it must be written in assembly and
look something like:

	xref  myroutine
      	xdef  _asm_go


            CNOP  0,4			  ; make sure on longword boundry
_asm_go
            dc.l     0			  ; BCPL segment ptr (0).
            movem.l  d0-d7/a0-a6,-(sp)       ; save regs
		   ; ??? for manx load some address register?
            jsr      myroutine               ; call routine
	    movem.l  (sp)+,d0-d7/a0-a6	     ; restore regs
            rts

FOR MANX, you may have to also load an address register to get the global
base pointer.  I myself do not use Manx, so your on your own on that.

NOTE!!! To use stdio and other things, you must set up other entries in
the Process structure.  You CANNOT use exit()  from the spawned process 
since it will attempt to exit from the first process from the second.


						-Matt
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: More bugs in DBW's VT100 (OR ANY VT100 and another system)
Next Topic: A better file requester !
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Mar 29 09:02:02 EDT 2024

Total time taken to generate the page: 0.02623 seconds