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 * @(#)Asbwc.c 7.1 (Berkeley) 12/06/90 11*45760Sbostic */ 1229631Ssam 1345699Sbostic #include "align.h" sbwc(infop)1429631Ssamsbwc(infop) process_info *infop; 1529631Ssam /* 1629631Ssam /* Subtract with carry. 1729631Ssam /* Note : the play with 'tmp' just before the 'asm' line makes 1829631Ssam /* sure that when the sbwc opcode is executed, the current 1929631Ssam /* carry in psl is the same as the 'offending' process'. 2029631Ssam /* Don't change unless you know exactly what you're doing. 2129631Ssam /* 2229631Ssam /*****************************/ 2329631Ssam { 2429631Ssam register long Register_12; /* Has to be first reg ! */ 2529631Ssam register long Register_11; 2629631Ssam register long Register_10; 2729631Ssam register long tmp; 2829631Ssam 2929631Ssam Register_12 = operand(infop,0)->data; 3029631Ssam Register_11 = operand(infop,1)->data; 3129631Ssam if (carry) /* If process' carry set */ 3229631Ssam tmp = -1; 3329631Ssam else tmp = 0; 3429631Ssam tmp++; /* 0 => carry set. 1 => carry clear */ 3529631Ssam 3629631Ssam Register_10=psl; 3729631Ssam Set_psl(r10); /* restore the user psl */ 3829631Ssam asm(" sbwc r12,r11"); 3929631Ssam asm(" movpsl r12"); 4029631Ssam New_cc (Register_12); 4129631Ssam 4229631Ssam write_back(infop, Register_11, operand(infop,1) ); 4329631Ssam } 44