xref: /original-bsd/sys/tahoe/align/Adivl3.c (revision bbb96de4)
1 /*	Adivl3.c	1.1	86/07/20	*/
2 
3 #include "../tahoealign/align.h"
4 divl3(infop) 	process_info *infop;
5 /*
6 /*	Arithmetic division, 3 operands.
7 /*
8 /**************************************/
9 {
10 	register	long	Register_12;	/* Has to be first reg ! */
11 	register 	long	divident, divisor, result;
12 
13 	divisor = operand(infop,0)->data;
14 	divident = operand(infop,1)->data;
15 	if (divisor == 0) {
16 		exception (infop, ARITHMETIC, 2);
17 	} else {
18 		Register_12=psl;
19 		Set_psl(r12);	/* restore the user psl */
20 		result = divident / divisor;
21 		asm ("	movpsl	r12");
22 		New_cc (Register_12);
23 	}
24 	write_back (infop,result, operand(infop,2));
25 }
26