xref: /original-bsd/sys/tahoe/align/Aadwc.c (revision 74d2773b)
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  *	@(#)Aadwc.c	7.1 (Berkeley) 12/06/90
11  */
12 
13 #include "align.h"
14 adwc(infop)	process_info *infop;
15 /*
16 /*	Add with carry.
17 /*	Note : the play with 'tmp' just before the 'asm' line makes
18 /*		sure that when the adwc opcode is executed, the current
19 /*		carry in psl is the same as the 'offending' process'.
20 /*		Don't change unless you know exactly what you're doing.
21 /*
22 /*****************************/
23 {
24 	register	long	Register_12;	/* Has to be first reg ! */
25 	register	long	Register_11;
26 	register	long	Register_10;
27 	register 	long	tmp;
28 
29 	Register_12 = operand(infop,0)->data;
30 	Register_11 = operand(infop,1)->data;
31 	if (carry)	/* If process' carry set */
32 		tmp = -1;
33 	else tmp = 0;
34 	tmp++;		/* 0 => carry set.  1 => carry clear */
35 
36 	Register_10=psl;
37 	Set_psl(r10);	/* restore the user psl */
38 	asm("	adwc	r11,r12");
39 	asm("	movpsl	r11");
40 	New_cc (Register_11);
41 
42 	write_back(infop, Register_12, operand(infop,1) );
43 }
44