xref: /csrg-svn/sys/tahoe/align/Acall.c (revision 45699)
1*45699Sbostic /*	Acall.c	1.2	90/12/04	*/
229593Ssam 
3*45699Sbostic #include "align.h"
429593Ssam call(infop)
529593Ssam process_info *infop;
629593Ssam /*
729593Ssam /*	Call a procedure with argument list on stack.
829593Ssam /*
929593Ssam /******************************************************/
1029593Ssam {
1129593Ssam 
1229593Ssam 	register long removed, mask, new_address, i, next, temp_fp;
1329593Ssam 
1429593Ssam 	printf("entering call\n");
1529593Ssam 	removed = operand(infop, 0)->data & 0xffff ;
1629593Ssam 	printf("after first call to operand\n");
1729593Ssam 	new_address = operand(infop, 1)->address;
1829593Ssam 	printf("in call, removed = 0x%x , new_address=0x%x \n",removed, new_address);
1929593Ssam 	push (infop, fp);
2029593Ssam 	temp_fp = sp;
2129593Ssam 	mask = get_word (infop, new_address) & 0x1fff;  /* Only bits 12-0 */
2229593Ssam 	printf("in call, mask = 0x%x , pc=0x%x \n",mask,pc);
2329593Ssam 	push (infop, mask << 16 | removed);
2429593Ssam 	push (infop, pc);				/* Next opcode address */
2529593Ssam 	next = 12;				/* Register # to save */
2629593Ssam 	for (i = 0x1000; i != 0; i = i >> 1)
2729593Ssam 	{
2829593Ssam 		if ( i & mask ) push (infop,  Register (infop, next));
2929593Ssam 		next--;
3029593Ssam 	}
3129593Ssam 	fp = temp_fp;
3229593Ssam 	pc = new_address + 2;			/* Transfer control */
3329593Ssam }
34