xref: /csrg-svn/sys/tahoe/align/Acall.c (revision 45760)
1*45760Sbostic /*-
2*45760Sbostic  * Copyright (c) 1986 The Regents of the University of California.
3*45760Sbostic  * All rights reserved.
4*45760Sbostic  *
5*45760Sbostic  * This code is derived from software contributed to Berkeley by
6*45760Sbostic  * Computer Consoles Inc.
7*45760Sbostic  *
8*45760Sbostic  * %sccs.include.redist.c%
9*45760Sbostic  *
10*45760Sbostic  *	@(#)Acall.c	7.1 (Berkeley) 12/06/90
11*45760Sbostic  */
1229593Ssam 
1345699Sbostic #include "align.h"
call(infop)1429593Ssam call(infop)
1529593Ssam process_info *infop;
1629593Ssam /*
1729593Ssam /*	Call a procedure with argument list on stack.
1829593Ssam /*
1929593Ssam /******************************************************/
2029593Ssam {
2129593Ssam 
2229593Ssam 	register long removed, mask, new_address, i, next, temp_fp;
2329593Ssam 
2429593Ssam 	printf("entering call\n");
2529593Ssam 	removed = operand(infop, 0)->data & 0xffff ;
2629593Ssam 	printf("after first call to operand\n");
2729593Ssam 	new_address = operand(infop, 1)->address;
2829593Ssam 	printf("in call, removed = 0x%x , new_address=0x%x \n",removed, new_address);
2929593Ssam 	push (infop, fp);
3029593Ssam 	temp_fp = sp;
3129593Ssam 	mask = get_word (infop, new_address) & 0x1fff;  /* Only bits 12-0 */
3229593Ssam 	printf("in call, mask = 0x%x , pc=0x%x \n",mask,pc);
3329593Ssam 	push (infop, mask << 16 | removed);
3429593Ssam 	push (infop, pc);				/* Next opcode address */
3529593Ssam 	next = 12;				/* Register # to save */
3629593Ssam 	for (i = 0x1000; i != 0; i = i >> 1)
3729593Ssam 	{
3829593Ssam 		if ( i & mask ) push (infop,  Register (infop, next));
3929593Ssam 		next--;
4029593Ssam 	}
4129593Ssam 	fp = temp_fp;
4229593Ssam 	pc = new_address + 2;			/* Transfer control */
4329593Ssam }
44