1 /* 2 * This handler performs a register save for selfVerification mode. 3 * On entry: 4 * Top of stack + 4: a1 value to save 5 * Top of stack + 0: a0 value to save 6 * a0 - offset from rSELF to the beginning of the heapArgSpace record 7 * a1 - the value of regMap 8 * 9 * The handler must save regMap, r0-r31, f0-f31 if FPU, and then return with 10 * r0-r31 with their original values (note that this means a0 and a1 must take 11 * the values on the stack - not the ones in those registers on entry. 12 * Finally, the two registers previously pushed must be popped. 13 * Note: the following registers are not saved 14 * zero, AT, gp, sp, fp, ra 15 */ 16 add a0, a0, rSELF # pointer to heapArgSpace 17 sw a1, 0(a0) # save regMap 18 add a0, a0, 4 # pointer to coreRegs 19 #if 0 20 sw zero, r_ZERO*4(a0) # save zero 21 #endif 22 .set noat 23 sw AT, r_AT*4(a0) # save at 24 .set at 25 sw v0, r_V0*4(a0) # save v0 26 sw v1, r_V1*4(a0) # save v1 27 28 lw a1, 0(sp) # recover a0 value 29 sw a1, r_A0*4(a0) # save a0 30 lw a1, 4(sp) # recover a1 value 31 sw a1, r_A1*4(a0) # save a1 32 sw a2, r_A2*4(a0) # save a2 33 sw a3, r_A3*4(a0) # save a3 34 35 sw t0, r_T0*4(a0) # save t0 36 sw t1, r_T1*4(a0) # save t1 37 sw t2, r_T2*4(a0) # save t2 38 sw t3, r_T3*4(a0) # save t3 39 sw t4, r_T4*4(a0) # save t4 40 sw t5, r_T5*4(a0) # save t5 41 sw t6, r_T6*4(a0) # save t6 42 sw t7, r_T7*4(a0) # save t7 43 44 sw s0, r_S0*4(a0) # save s0 45 sw s1, r_S1*4(a0) # save s1 46 sw s2, r_S2*4(a0) # save s2 47 sw s3, r_S3*4(a0) # save s3 48 sw s4, r_S4*4(a0) # save s4 49 sw s5, r_S5*4(a0) # save s5 50 sw s6, r_S6*4(a0) # save s6 51 sw s7, r_S7*4(a0) # save s7 52 53 sw t8, r_T8*4(a0) # save t8 54 sw t9, r_T9*4(a0) # save t9 55 56 sw k0, r_K0*4(a0) # save k0 57 sw k1, r_K1*4(a0) # save k1 58 59 #if 0 60 sw gp, r_GP*4(a0) # save gp 61 sw sp, r_SP*4(a0) # save sp (need to adjust??? ) 62 sw fp, r_FP*4(a0) # save fp 63 sw ra, r_RA*4(a0) # save ra 64 #endif 65 66 /* #ifdef HARD_FLOAT */ 67 #if 0 68 sw f0, fr0*4(a0) # save f0 69 sw f1, fr1*4(a0) # save f1 70 sw f2, fr2*4(a0) # save f2 71 sw f3, fr3*4(a0) # save f3 72 sw f4, fr4*4(a0) # save f4 73 sw f5, fr5*4(a0) # save f5 74 sw f6, fr6*4(a0) # save f6 75 sw f7, fr7*4(a0) # save f7 76 sw f8, fr8*4(a0) # save f8 77 sw f9, fr9*4(a0) # save f9 78 sw f10, fr10*4(a0) # save f10 79 sw f11, fr11*4(a0) # save f11 80 sw f12, fr12*4(a0) # save f12 81 sw f13, fr13*4(a0) # save f13 82 sw f14, fr14*4(a0) # save f14 83 sw f15, fr15*4(a0) # save f15 84 sw f16, fr16*4(a0) # save f16 85 sw f17, fr17*4(a0) # save f17 86 sw f18, fr18*4(a0) # save f18 87 sw f19, fr19*4(a0) # save f19 88 sw f20, fr20*4(a0) # save f20 89 sw f21, fr21*4(a0) # save f21 90 sw f22, fr22*4(a0) # save f22 91 sw f23, fr23*4(a0) # save f23 92 sw f24, fr24*4(a0) # save f24 93 sw f25, fr25*4(a0) # save f25 94 sw f26, fr26*4(a0) # save f26 95 sw f27, fr27*4(a0) # save f27 96 sw f28, fr28*4(a0) # save f28 97 sw f29, fr29*4(a0) # save f29 98 sw f30, fr30*4(a0) # save f30 99 sw f31, fr31*4(a0) # save f31 100 #endif 101 102 lw a1, 0(sp) # recover a0 value 103 lw a1, 4(sp) # recover a1 value 104 sub sp, sp, 8 # adjust stack ptr 105 RETURN 106