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