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 * @(#)Adivl3.c 7.1 (Berkeley) 12/06/90
11*45760Sbostic */
1229606Ssam
1345699Sbostic #include "align.h"
divl3(infop)1429606Ssam divl3(infop) process_info *infop;
1529606Ssam /*
1629606Ssam /* Arithmetic division, 3 operands.
1729606Ssam /*
1829606Ssam /**************************************/
1929606Ssam {
2029606Ssam register long Register_12; /* Has to be first reg ! */
2129606Ssam register long divident, divisor, result;
2229606Ssam
2329606Ssam divisor = operand(infop,0)->data;
2429606Ssam divident = operand(infop,1)->data;
2529606Ssam if (divisor == 0) {
2629606Ssam exception (infop, ARITHMETIC, 2);
2729606Ssam } else {
2829606Ssam Register_12=psl;
2929606Ssam Set_psl(r12); /* restore the user psl */
3029606Ssam result = divident / divisor;
3129606Ssam asm (" movpsl r12");
3229606Ssam New_cc (Register_12);
3329606Ssam }
3429606Ssam write_back (infop,result, operand(infop,2));
3529606Ssam }
36