xref: /csrg-svn/sys/tahoe/align/Adivl3.c (revision 45699)
1*45699Sbostic /*	Adivl3.c	1.2	90/12/04	*/
229606Ssam 
3*45699Sbostic #include "align.h"
429606Ssam divl3(infop) 	process_info *infop;
529606Ssam /*
629606Ssam /*	Arithmetic division, 3 operands.
729606Ssam /*
829606Ssam /**************************************/
929606Ssam {
1029606Ssam 	register	long	Register_12;	/* Has to be first reg ! */
1129606Ssam 	register 	long	divident, divisor, result;
1229606Ssam 
1329606Ssam 	divisor = operand(infop,0)->data;
1429606Ssam 	divident = operand(infop,1)->data;
1529606Ssam 	if (divisor == 0) {
1629606Ssam 		exception (infop, ARITHMETIC, 2);
1729606Ssam 	} else {
1829606Ssam 		Register_12=psl;
1929606Ssam 		Set_psl(r12);	/* restore the user psl */
2029606Ssam 		result = divident / divisor;
2129606Ssam 		asm ("	movpsl	r12");
2229606Ssam 		New_cc (Register_12);
2329606Ssam 	}
2429606Ssam 	write_back (infop,result, operand(infop,2));
2529606Ssam }
26