home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
EFFO
/
forum16.lzh
/
SOFTWARE
/
ASSEMBLER
/
EXIT_HANDLER
/
uacct.a
< prev
next >
Wrap
Text File
|
1991-01-09
|
4KB
|
143 lines
******************************************************************
**
** OS-9 EXIT HANDLER HOOK
** A. Miotto - P. Mato
**
**---
** Edition history
** # Date Changes made by
** -- -------- ------------------------------------------------ --
** 00 88-12-01 first edition am
** 01 89-01-06 problem on F$DExit corrected pm
** 02 89-07-23 version 2 am
** 03 90-10-12 this version is installed automatically at boot am
**---
Edition equ 3
use <oskdefs.d>
use uacct.d
Typ_Lang set (Systm<<8)+Objct system module, object code
Attr_Rev set ((ReEnt+SupStat+Ghost)<<8)+3 supervisor state, sharable
psect uacct,Typ_Lang,Attr_Rev,Edition,0,Init
********************
* Entry Point
*
* Passed: (a3) = vsect data ptr
* (a6) = system global data ptr
* (sp) = (system) stack ptr
*
* Returns: nothing
*
* Error Return: d1.w = error code
* (cc) = carry set
*
* Destroys: only d1 and cc may be modified.
*
Init: move.l a1,-(sp) save reg
lea.l SvcTbl(pc),a1 get address of service table
OS9 F$SSvc install F$UAcct system call
movea.l (sp)+,a1 restore reg (retain Carry)
rts return status
SvcTbl:
dc.w F$UAcct,UAcct-*-4
dc.w F$ExhLnk,ExhLnk-*-4
dc.w F$ExhUlk,ExhUlk-*-4
dc.w -1
*------------------------------------------------------------*
* Call exit routine before process completion
*
* input: d0.w function code
* (a0) process descriptor pointer
* (a3) static storage (NULL)
* (a4) process descriptor pointer
* (a6) system global data pointer
*---
* variable used in the process descriptor:
* P$Acct first entry in the list
* P$Acct+4 last entry in the list
*
UAcct:
cmp.w #F$Fork,d0 is it a fork?
bne.s UA10
lea P$Acct(a0),a4 initialise P$Acct pointers
move.l a4,Exh_Next(a4)
move.l a4,Exh_Prev(a4)
bra.s UA99
UA10 cmp.w #F$Exit,d0 no action on F$Chain
bne.s UA99
movem.l d0-d7/a0-a6,-(a7)
lea P$Acct(a0),a4
bra.s UAwhile
UAloop move.l Exh_Next(a4),a1
bsr.s unlink
bcs.s UA90
move.l Exh_Entry(a1),a0
move.l Exh_a6(a1),a6
move.l Exh_d0(a1),d0
move.l Exh_d1(a1),d1
jsr (a0)
UAwhile cmpa.l Exh_Next(a4),a4
bne.s UAloop
UA90 movem.l (a7)+,d0-d7/a0-a6
UA99 tst.l d0
rts
*------------------------------------------------------------*
* Link software package to the exit routine list
*
* input: (a1) 4 longword structure pointer
* offset 0: reserved for next entry in the list
* 4: reserved for previous entry in the list
* 8: entry point of exit routine
* 12: a6 to be passed to the exit routine
* 16: d0 to be passed to the exit routine (optional)
* 20: d1 to be passed to the exit routine (optional)
*
ExhLnk: movem.l a2/a4,-(sp)
lea P$Acct(a4),a4
move.l Exh_Next(a4),a2
move.l a2,Exh_Next(a1)
move.l a4,Exh_Prev(a1)
move.l a1,Exh_Next(a4)
move.l a1,Exh_Prev(a2)
movem.l (sp)+,a2/a4
rts
*------------------------------------------------------------*
* Unlink software package from the exit routine list
*
* input: (a1) 4 longword structure pointer
*
ExhUlk:
bsr.s unlink
bcc.s EU99
move.w #E$Param,R$d1(a5)
ori #Carry,ccr
EU99 rts
*------------------------------------------------------------*
* Unlink entry from list
*
* input: (a1) entry pointer
*
unlink: movem.l a2-a3,-(a7)
move.l Exh_Next(a1),a2
move.l Exh_Prev(a1),a3
cmpa.l Exh_Prev(a2),a1
bne.s ulk90
cmpa.l Exh_Next(a3),a1
bne.s ulk90
move.l a3,Exh_Prev(a2)
move.l a2,Exh_Next(a3)
bra.s ulk99
ulk90 ori #Carry,ccr
ulk99 movem.l (a7)+,a2-a3
rts
ends