old/sdb/display.c
/*
 *  stackreg(reg):
 * If the register for the current frame is somewhere on the stack
 * then return the address of where it is, otherwise its still in
 * the register so return the register number.
 * We distinguish the two by noting that register numbers are less
 * than 16 and that stack addresses are greater.
 *
 *  MACHINE DEPENDENT
 */
If the register for the current frame is somewhere on the stack
then return the address of where it is, otherwise its still in
the register so return the register number.
We distinguish the two by noting that register numbers are less
than 16 and that stack addresses are greater.

MACHINE DEPENDENT
If the register for the current frame is somewhere on the stack then return the address of where it is otherwise its still in the register so return the register number . We distinguish the two by noting that register numbers are less than 16 and that stack addresses are greater . MACHINE DEPENDENT
ADDR
stackreg(reg) {
	register int curframe, regfl, mask, i;
	struct proct *procp;
	ADDR regaddr;
	curframe = frame;
	regaddr = reg;
	regfl = 0x10000 << reg;
	for (procp=initframe(); frame!=curframe; procp=nextframe()) {
		if (procp == badproc) {
			error("Stackreg error: frame");
			return(-1);
		}
		mask = get(frame+4, DSP);
		if (mask & regfl) {
			regaddr = frame + 20;
			for (i=0; i<reg; i++) {
				if (mask & 0x10000)
					regaddr += WORDSIZE;
				mask = mask >> 1;
			}
			if (!(mask & 0x10000)) {
				error("Stackreg error: contents");
				return(-1);
			}
		}
	}
	return(regaddr);
}
ADDR stackreg ( reg ) { register int curframe , regfl , mask , i ; struct proct * procp ; ADDR regaddr ; curframe = frame ; regaddr = reg ; regfl = 0x10000 << reg ; for ( procp = initframe ( ) ; frame != curframe ; procp = nextframe ( ) ) { if ( procp == badproc ) { error ( " " ) ; return ( -1 ) ; } mask = get ( frame + 4 , DSP ) ; if ( mask & regfl ) { regaddr = frame + 20 ; for ( i = 0 ; i < reg ; i ++ ) { if ( mask & 0x10000 ) regaddr += WORDSIZE ; mask = mask >> 1 ; } if ( ! ( mask & 0x10000 ) ) { error ( " " ) ; return ( -1 ) ; } } } return ( regaddr ) ; }
stackreg(reg):
 If the register for the current frame is somewhere on the stack
 then return the address of where it is, otherwise its still in
 the register so return the register number.
stackreg ( reg ) : If the register for the current frame is somewhere on the stack then return the address of where it is otherwise its still in the register so return the register number .