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 * @(#)Aadwc.c 7.1 (Berkeley) 12/06/90 11*45760Sbostic */ 1229586Ssam 1345699Sbostic #include "align.h" adwc(infop)1429586Ssamadwc(infop) process_info *infop; 1529586Ssam /* 1629586Ssam /* Add with carry. 1729586Ssam /* Note : the play with 'tmp' just before the 'asm' line makes 1829586Ssam /* sure that when the adwc opcode is executed, the current 1929586Ssam /* carry in psl is the same as the 'offending' process'. 2029586Ssam /* Don't change unless you know exactly what you're doing. 2129586Ssam /* 2229586Ssam /*****************************/ 2329586Ssam { 2429586Ssam register long Register_12; /* Has to be first reg ! */ 2529586Ssam register long Register_11; 2629586Ssam register long Register_10; 2729586Ssam register long tmp; 2829586Ssam 2929586Ssam Register_12 = operand(infop,0)->data; 3029586Ssam Register_11 = operand(infop,1)->data; 3129586Ssam if (carry) /* If process' carry set */ 3229586Ssam tmp = -1; 3329586Ssam else tmp = 0; 3429586Ssam tmp++; /* 0 => carry set. 1 => carry clear */ 3529586Ssam 3629586Ssam Register_10=psl; 3729586Ssam Set_psl(r10); /* restore the user psl */ 3829586Ssam asm(" adwc r11,r12"); 3929586Ssam asm(" movpsl r11"); 4029586Ssam New_cc (Register_11); 4129586Ssam 4229586Ssam write_back(infop, Register_12, operand(infop,1) ); 4329586Ssam } 44