xref: /csrg-svn/sys/tahoe/align/Asbwc.c (revision 29631)
1*29631Ssam /*	Asbwc.c	1.1	86/07/20	*/
2*29631Ssam 
3*29631Ssam 
4*29631Ssam #include "../tahoealign/align.h"
5*29631Ssam sbwc(infop)	process_info *infop;
6*29631Ssam /*
7*29631Ssam /*	Subtract with carry.
8*29631Ssam /*	Note : the play with 'tmp' just before the 'asm' line makes
9*29631Ssam /*		sure that when the sbwc opcode is executed, the current
10*29631Ssam /*		carry in psl is the same as the 'offending' process'.
11*29631Ssam /*		Don't change unless you know exactly what you're doing.
12*29631Ssam /*
13*29631Ssam /*****************************/
14*29631Ssam {
15*29631Ssam 	register	long	Register_12;	/* Has to be first reg ! */
16*29631Ssam 	register	long	Register_11;
17*29631Ssam 	register	long	Register_10;
18*29631Ssam 	register 	long	tmp;
19*29631Ssam 
20*29631Ssam 	Register_12 = operand(infop,0)->data;
21*29631Ssam 	Register_11 = operand(infop,1)->data;
22*29631Ssam 	if (carry)	/* If process' carry set */
23*29631Ssam 		tmp = -1;
24*29631Ssam 	else tmp = 0;
25*29631Ssam 	tmp++;		/* 0 => carry set.  1 => carry clear */
26*29631Ssam 
27*29631Ssam 	Register_10=psl;
28*29631Ssam 	Set_psl(r10);	/* restore the user psl */
29*29631Ssam 	asm("	sbwc	r12,r11");
30*29631Ssam 	asm("	movpsl	r12");
31*29631Ssam 	New_cc (Register_12);
32*29631Ssam 
33*29631Ssam 	write_back(infop, Register_11, operand(infop,1) );
34*29631Ssam }
35