xref: /original-bsd/sys/tahoe/align/Adivl2.c (revision d272e02a)
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  *	@(#)Adivl2.c	7.1 (Berkeley) 12/06/90
11  */
12 
13 #include "align.h"
14 divl2(infop) 	process_info *infop;
15 /*
16 /*	Arithmetic division, 2 operands.
17 /*
18 /**************************************/
19 {
20 	register	long	Register_12;	/* Has to be first reg ! */
21 	register 	long	divident, divisor, result;
22 
23 	divisor = operand(infop,0)->data;
24 	divident = operand(infop,1)->data;
25 	if (divisor == 0) {
26 		exception (infop, ARITHMETIC, 2);
27 	} else {
28 		Register_12=psl;
29 		Set_psl(r12);	/* restore the user psl */
30 		result = divident / divisor;
31 		asm ("	movpsl	r12");
32 		New_cc (Register_12);
33 	}
34 	write_back (infop,result, operand(infop,1));
35 }
36 
37 
38