[net.unix-wizards] fkword

mike@Brl-Bmd.ARPA (03/29/83)

From:      Mike Muuss <mike@Brl-Bmd.ARPA>

Useful additions to any PDP-11 machine assist.
		-Mike

/**********************************************************************
/
/			F K W O R D
/
/ This code courtesy of Bill Lindemann, NYIT
/
/**********************************************************************

.globl _fkword
_fkword:
	mov	2(sp), r1			/ address
	jsr	pc, gkword
	rts	pc

gkword:
	mov	PS, -(sp)
	bis	$340, PS			/ spl HIGH
	mov	nofault, -(sp)
	mov	$err,nofault			/ set error trap routine
	mov	(r1), r0			/ fetch word
	mov	(sp)+,nofault
	mov	(sp)+,PS
	rts	pc

/**********************************************************************
/
/		G E T P C / G E T C A L R
/
/ Routines -
/	getpc	- Determine the address of the caller
/	getcalr	- Determine the address of the caller's caller
/		  Useful for "C" routines determining who calls them.
/
/**********************************************************************

.globl _getpc
_getpc:
	mov	(sp), r0			/ return the callers address
	rts	pc				/ and return

.globl _getcalr
_getcalr:
	mov	2(r5), r0			/ return callers callers address
	rts	pc				/ and return