xref: /csrg-svn/sys/tahoe/align/Acall.c (revision 29593)
1*29593Ssam /*	Acall.c	1.1	86/07/20	*/
2*29593Ssam 
3*29593Ssam #include "../tahoealign/align.h"
4*29593Ssam call(infop)
5*29593Ssam process_info *infop;
6*29593Ssam /*
7*29593Ssam /*	Call a procedure with argument list on stack.
8*29593Ssam /*
9*29593Ssam /******************************************************/
10*29593Ssam {
11*29593Ssam 
12*29593Ssam 	register long removed, mask, new_address, i, next, temp_fp;
13*29593Ssam 
14*29593Ssam 	printf("entering call\n");
15*29593Ssam 	removed = operand(infop, 0)->data & 0xffff ;
16*29593Ssam 	printf("after first call to operand\n");
17*29593Ssam 	new_address = operand(infop, 1)->address;
18*29593Ssam 	printf("in call, removed = 0x%x , new_address=0x%x \n",removed, new_address);
19*29593Ssam 	push (infop, fp);
20*29593Ssam 	temp_fp = sp;
21*29593Ssam 	mask = get_word (infop, new_address) & 0x1fff;  /* Only bits 12-0 */
22*29593Ssam 	printf("in call, mask = 0x%x , pc=0x%x \n",mask,pc);
23*29593Ssam 	push (infop, mask << 16 | removed);
24*29593Ssam 	push (infop, pc);				/* Next opcode address */
25*29593Ssam 	next = 12;				/* Register # to save */
26*29593Ssam 	for (i = 0x1000; i != 0; i = i >> 1)
27*29593Ssam 	{
28*29593Ssam 		if ( i & mask ) push (infop,  Register (infop, next));
29*29593Ssam 		next--;
30*29593Ssam 	}
31*29593Ssam 	fp = temp_fp;
32*29593Ssam 	pc = new_address + 2;			/* Transfer control */
33*29593Ssam }
34