xref: /csrg-svn/sys/tahoe/align/Asbwc.c (revision 45699)
1*45699Sbostic /*	Asbwc.c	1.2	90/12/04	*/
229631Ssam 
329631Ssam 
4*45699Sbostic #include "align.h"
529631Ssam sbwc(infop)	process_info *infop;
629631Ssam /*
729631Ssam /*	Subtract with carry.
829631Ssam /*	Note : the play with 'tmp' just before the 'asm' line makes
929631Ssam /*		sure that when the sbwc opcode is executed, the current
1029631Ssam /*		carry in psl is the same as the 'offending' process'.
1129631Ssam /*		Don't change unless you know exactly what you're doing.
1229631Ssam /*
1329631Ssam /*****************************/
1429631Ssam {
1529631Ssam 	register	long	Register_12;	/* Has to be first reg ! */
1629631Ssam 	register	long	Register_11;
1729631Ssam 	register	long	Register_10;
1829631Ssam 	register 	long	tmp;
1929631Ssam 
2029631Ssam 	Register_12 = operand(infop,0)->data;
2129631Ssam 	Register_11 = operand(infop,1)->data;
2229631Ssam 	if (carry)	/* If process' carry set */
2329631Ssam 		tmp = -1;
2429631Ssam 	else tmp = 0;
2529631Ssam 	tmp++;		/* 0 => carry set.  1 => carry clear */
2629631Ssam 
2729631Ssam 	Register_10=psl;
2829631Ssam 	Set_psl(r10);	/* restore the user psl */
2929631Ssam 	asm("	sbwc	r12,r11");
3029631Ssam 	asm("	movpsl	r12");
3129631Ssam 	New_cc (Register_12);
3229631Ssam 
3329631Ssam 	write_back(infop, Register_11, operand(infop,1) );
3429631Ssam }
35