xref: /original-bsd/sys/tahoe/align/Acall.c (revision cf2124ff)
1 /*-
2  * Copyright (c) 1986 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley by
6  * Computer Consoles Inc.
7  *
8  * %sccs.include.redist.c%
9  *
10  *	@(#)Acall.c	7.1 (Berkeley) 12/06/90
11  */
12 
13 #include "align.h"
14 call(infop)
15 process_info *infop;
16 /*
17 /*	Call a procedure with argument list on stack.
18 /*
19 /******************************************************/
20 {
21 
22 	register long removed, mask, new_address, i, next, temp_fp;
23 
24 	printf("entering call\n");
25 	removed = operand(infop, 0)->data & 0xffff ;
26 	printf("after first call to operand\n");
27 	new_address = operand(infop, 1)->address;
28 	printf("in call, removed = 0x%x , new_address=0x%x \n",removed, new_address);
29 	push (infop, fp);
30 	temp_fp = sp;
31 	mask = get_word (infop, new_address) & 0x1fff;  /* Only bits 12-0 */
32 	printf("in call, mask = 0x%x , pc=0x%x \n",mask,pc);
33 	push (infop, mask << 16 | removed);
34 	push (infop, pc);				/* Next opcode address */
35 	next = 12;				/* Register # to save */
36 	for (i = 0x1000; i != 0; i = i >> 1)
37 	{
38 		if ( i & mask ) push (infop,  Register (infop, next));
39 		next--;
40 	}
41 	fp = temp_fp;
42 	pc = new_address + 2;			/* Transfer control */
43 }
44