diff 3rdparty/packages/cc/sources/process.a @ 867:0198655f2552

Added sources
author boisy
date Thu, 16 Jan 2003 19:54:21 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/3rdparty/packages/cc/sources/process.a	Thu Jan 16 19:54:21 2003 +0000
@@ -0,0 +1,82 @@
+*
+* Process system calls
+*
+ use ..../defs/os9defs.a
+ psect process_a,0,0,2,0,0
+
+* kill(pid,signal)
+kill: lda 3,s get process id
+ ldb 5,s get signal number
+ os9 F$SEND
+ lbra _sysret
+
+* wait(status)
+wait: clra clear these so
+ clrb signal can be detected
+ os9 F$WAIT
+ lbcs _os9err
+
+ ldx 2,s
+ beq wait10
+ stb 1,x
+ clr ,x
+
+wait10 tfr a,b
+ clra
+ rts
+
+* setpr(pid,priority)
+setpr: lda 3,s get process id
+ ldb 5,s get priority
+ os9 F$SPRIOR call os9
+ lbra _sysret
+
+* chain(modname,paramsize,paramp,type,language,datasize)
+*
+* This call can never return to the caller. The stack pointer
+* must be adjusted to point into the direct page which, in general,
+* contains global variables belonging to the program. OS-9 will
+* therefore overwrite these values making the state of the program
+* undefined after the call.
+* In addition, we cannot report the error here because the module
+* name string could easily be in the direct page.
+chain:
+ leau 0,s save the sp
+ leas $ff,y set the stack into the direct page
+
+ ldx 2,u get the module name pointer
+ ldy 4,u get the parameter area size
+ lda 9,u get the type
+ lsla
+ lsla
+ lsla
+ lsla
+ ora 11,u and the language
+ ldb 13,u get the data size
+ ldu 6,u get the parameter area beginning address
+
+ os9 F$CHAIN go do it
+
+* return here indicates an error
+ os9 F$EXIT error code already in b reg.
+
+* os9fork(modname,paramsize,paramp,language,type,datasize)
+os9fork: pshs y,u save environment
+
+ ldx 6,s get module name
+ ldy 8,s get parameter area size
+ ldu 10,s get parameter area pointer
+ lda 13,s get language
+ ora 15,s and type
+ ldb 17,s get data size
+
+ os9 F$FORK call os9
+
+* return here indicates either error or parent
+ puls y,u restore environment
+ lbcs _os9err
+ tfr a,b make an integer out of it
+ clra
+* NOTE: the x register return value (points past name) is ignored
+ rts
+ endsect