1*45760Sbostic /*-
2*45760Sbostic * Copyright (c) 1986 The Regents of the University of California.
3*45760Sbostic * All rights reserved.
4*45760Sbostic *
5*45760Sbostic * This code is derived from software contributed to Berkeley by
6*45760Sbostic * Computer Consoles Inc.
7*45760Sbostic *
8*45760Sbostic * %sccs.include.redist.c%
9*45760Sbostic *
10*45760Sbostic * @(#)Adivl2.c 7.1 (Berkeley) 12/06/90
11*45760Sbostic */
1229605Ssam
1345699Sbostic #include "align.h"
divl2(infop)1429605Ssam divl2(infop) process_info *infop;
1529605Ssam /*
1629605Ssam /* Arithmetic division, 2 operands.
1729605Ssam /*
1829605Ssam /**************************************/
1929605Ssam {
2029605Ssam register long Register_12; /* Has to be first reg ! */
2129605Ssam register long divident, divisor, result;
2229605Ssam
2329605Ssam divisor = operand(infop,0)->data;
2429605Ssam divident = operand(infop,1)->data;
2529605Ssam if (divisor == 0) {
2629605Ssam exception (infop, ARITHMETIC, 2);
2729605Ssam } else {
2829605Ssam Register_12=psl;
2929605Ssam Set_psl(r12); /* restore the user psl */
3029605Ssam result = divident / divisor;
3129605Ssam asm (" movpsl r12");
3229605Ssam New_cc (Register_12);
3329605Ssam }
3429605Ssam write_back (infop,result, operand(infop,1));
3529605Ssam }
3629605Ssam
3729605Ssam
38