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