867
|
1 *
|
|
2 * Process system calls
|
|
3 *
|
|
4 use ..../defs/os9defs.a
|
|
5 psect process_a,0,0,2,0,0
|
|
6
|
|
7 * kill(pid,signal)
|
|
8 kill: lda 3,s get process id
|
|
9 ldb 5,s get signal number
|
|
10 os9 F$SEND
|
|
11 lbra _sysret
|
|
12
|
|
13 * wait(status)
|
|
14 wait: clra clear these so
|
|
15 clrb signal can be detected
|
|
16 os9 F$WAIT
|
|
17 lbcs _os9err
|
|
18
|
|
19 ldx 2,s
|
|
20 beq wait10
|
|
21 stb 1,x
|
|
22 clr ,x
|
|
23
|
|
24 wait10 tfr a,b
|
|
25 clra
|
|
26 rts
|
|
27
|
|
28 * setpr(pid,priority)
|
|
29 setpr: lda 3,s get process id
|
|
30 ldb 5,s get priority
|
|
31 os9 F$SPRIOR call os9
|
|
32 lbra _sysret
|
|
33
|
|
34 * chain(modname,paramsize,paramp,type,language,datasize)
|
|
35 *
|
|
36 * This call can never return to the caller. The stack pointer
|
|
37 * must be adjusted to point into the direct page which, in general,
|
|
38 * contains global variables belonging to the program. OS-9 will
|
|
39 * therefore overwrite these values making the state of the program
|
|
40 * undefined after the call.
|
|
41 * In addition, we cannot report the error here because the module
|
|
42 * name string could easily be in the direct page.
|
|
43 chain:
|
|
44 leau 0,s save the sp
|
|
45 leas $ff,y set the stack into the direct page
|
|
46
|
|
47 ldx 2,u get the module name pointer
|
|
48 ldy 4,u get the parameter area size
|
|
49 lda 9,u get the type
|
|
50 lsla
|
|
51 lsla
|
|
52 lsla
|
|
53 lsla
|
|
54 ora 11,u and the language
|
|
55 ldb 13,u get the data size
|
|
56 ldu 6,u get the parameter area beginning address
|
|
57
|
|
58 os9 F$CHAIN go do it
|
|
59
|
|
60 * return here indicates an error
|
|
61 os9 F$EXIT error code already in b reg.
|
|
62
|
|
63 * os9fork(modname,paramsize,paramp,language,type,datasize)
|
|
64 os9fork: pshs y,u save environment
|
|
65
|
|
66 ldx 6,s get module name
|
|
67 ldy 8,s get parameter area size
|
|
68 ldu 10,s get parameter area pointer
|
|
69 lda 13,s get language
|
|
70 ora 15,s and type
|
|
71 ldb 17,s get data size
|
|
72
|
|
73 os9 F$FORK call os9
|
|
74
|
|
75 * return here indicates either error or parent
|
|
76 puls y,u restore environment
|
|
77 lbcs _os9err
|
|
78 tfr a,b make an integer out of it
|
|
79 clra
|
|
80 * NOTE: the x register return value (points past name) is ignored
|
|
81 rts
|
|
82 endsect
|