;
; NULLTIME - get the NULL processes accumulated CPU time
;
; call:  status = nulltime(cputime)
;
	.title	nulltime
	.library /sys$library:lib/
	.global	sch$gl_pcbvec
	$phddef
	$pcbdef
	.entry get_nulltime,^m<>
	$cmkrnl_s	routin=nulltime
	ret

	.entry	nulltime,^m<r2,r3,r4>
	cputime = 4			;offset to cputime value
	movl	@sch$gl_pcbvec,r0	;Get NULL PCB address
	setipl	#ipl$_synch		;Synch use of PCB vector
	movl	pcb$l_sts(r0),r3	;Save status field while synched
	bbs	#pcb$v_res,r3,10$	;If process resident, get PHD info
	setipl	#0			; else return to IPL 0
	clrq	r4			;Indicate no info available
	movl	#-2,r0
	brb	20$
10$:
	movl	pcb$l_phd(r0),r1	; get process header(PHD)
	movl	phd$l_cputim(r1),r0	;Get accumulated CPU time from PHD
					; while at raised IPL. Use register
					; to avoid page faults
	setipl	#0			;Return to IPL 0
	ret
20$:
	movl	r4,r0			;Return CPU time value
	ret
	.end
