1 #if defined(WITH_SELF_VERIFICATION) 2 /* 3 * This handler encapsulates heap memory ops for selfVerification mode. 4 * 5 * The call to the handler is inserted prior to a heap memory operation. 6 * This handler then calls a function to decode the memory op, and process 7 * it accordingly. Afterwards, the handler changes the return address to 8 * skip the memory op so it never gets executed. 9 */ 10 #ifdef HARD_FLOAT 11 /* push f0-f31 onto stack */ 12 sw f0, fr0*-4(sp) # push f0 13 sw f1, fr1*-4(sp) # push f1 14 sw f2, fr2*-4(sp) # push f2 15 sw f3, fr3*-4(sp) # push f3 16 sw f4, fr4*-4(sp) # push f4 17 sw f5, fr5*-4(sp) # push f5 18 sw f6, fr6*-4(sp) # push f6 19 sw f7, fr7*-4(sp) # push f7 20 sw f8, fr8*-4(sp) # push f8 21 sw f9, fr9*-4(sp) # push f9 22 sw f10, fr10*-4(sp) # push f10 23 sw f11, fr11*-4(sp) # push f11 24 sw f12, fr12*-4(sp) # push f12 25 sw f13, fr13*-4(sp) # push f13 26 sw f14, fr14*-4(sp) # push f14 27 sw f15, fr15*-4(sp) # push f15 28 sw f16, fr16*-4(sp) # push f16 29 sw f17, fr17*-4(sp) # push f17 30 sw f18, fr18*-4(sp) # push f18 31 sw f19, fr19*-4(sp) # push f19 32 sw f20, fr20*-4(sp) # push f20 33 sw f21, fr21*-4(sp) # push f21 34 sw f22, fr22*-4(sp) # push f22 35 sw f23, fr23*-4(sp) # push f23 36 sw f24, fr24*-4(sp) # push f24 37 sw f25, fr25*-4(sp) # push f25 38 sw f26, fr26*-4(sp) # push f26 39 sw f27, fr27*-4(sp) # push f27 40 sw f28, fr28*-4(sp) # push f28 41 sw f29, fr29*-4(sp) # push f29 42 sw f30, fr30*-4(sp) # push f30 43 sw f31, fr31*-4(sp) # push f31 44 45 sub sp, (32-0)*4 # adjust stack pointer 46 #endif 47 48 /* push gp registers (except zero, gp, sp, and fp) */ 49 .set noat 50 sw AT, r_AT*-4(sp) # push at 51 .set at 52 sw v0, r_V0*-4(sp) # push v0 53 sw v1, r_V1*-4(sp) # push v1 54 sw a0, r_A0*-4(sp) # push a0 55 sw a1, r_A1*-4(sp) # push a1 56 sw a2, r_A2*-4(sp) # push a2 57 sw a3, r_A3*-4(sp) # push a3 58 sw t0, r_T0*-4(sp) # push t0 59 sw t1, r_T1*-4(sp) # push t1 60 sw t2, r_T2*-4(sp) # push t2 61 sw t3, r_T3*-4(sp) # push t3 62 sw t4, r_T4*-4(sp) # push t4 63 sw t5, r_T5*-4(sp) # push t5 64 sw t6, r_T6*-4(sp) # push t6 65 sw t7, r_T7*-4(sp) # push t7 66 sw s0, r_S0*-4(sp) # push s0 67 sw s1, r_S1*-4(sp) # push s1 68 sw s2, r_S2*-4(sp) # push s2 69 sw s3, r_S3*-4(sp) # push s3 70 sw s4, r_S4*-4(sp) # push s4 71 sw s5, r_S5*-4(sp) # push s5 72 sw s6, r_S6*-4(sp) # push s6 73 sw s7, r_S7*-4(sp) # push s7 74 sw t8, r_T8*-4(sp) # push t8 75 sw t9, r_T9*-4(sp) # push t9 76 sw k0, r_K0*-4(sp) # push k0 77 sw k1, r_K1*-4(sp) # push k1 78 sw ra, r_RA*-4(sp) # push RA 79 80 # Note: even if we don't save all 32 registers, we still need to 81 # adjust SP by 32 registers due to the way we are storing 82 # the registers on the stack. 83 sub sp, (32-0)*4 # adjust stack pointer 84 85 la a2, .LdvmSelfVerificationMemOpDecode # defined in footer.S 86 lw a2, (a2) 87 move a0, ra # a0<- link register 88 move a1, sp # a1<- stack pointer 89 JALR(a2) 90 91 /* pop gp registers (except zero, gp, sp, and fp) */ 92 # Note: even if we don't save all 32 registers, we still need to 93 # adjust SP by 32 registers due to the way we are storing 94 # the registers on the stack. 95 add sp, (32-0)*4 # adjust stack pointer 96 .set noat 97 lw AT, r_AT*-4(sp) # pop at 98 .set at 99 lw v0, r_V0*-4(sp) # pop v0 100 lw v1, r_V1*-4(sp) # pop v1 101 lw a0, r_A0*-4(sp) # pop a0 102 lw a1, r_A1*-4(sp) # pop a1 103 lw a2, r_A2*-4(sp) # pop a2 104 lw a3, r_A3*-4(sp) # pop a3 105 lw t0, r_T0*-4(sp) # pop t0 106 lw t1, r_T1*-4(sp) # pop t1 107 lw t2, r_T2*-4(sp) # pop t2 108 lw t3, r_T3*-4(sp) # pop t3 109 lw t4, r_T4*-4(sp) # pop t4 110 lw t5, r_T5*-4(sp) # pop t5 111 lw t6, r_T6*-4(sp) # pop t6 112 lw t7, r_T7*-4(sp) # pop t7 113 lw s0, r_S0*-4(sp) # pop s0 114 lw s1, r_S1*-4(sp) # pop s1 115 lw s2, r_S2*-4(sp) # pop s2 116 lw s3, r_S3*-4(sp) # pop s3 117 lw s4, r_S4*-4(sp) # pop s4 118 lw s5, r_S5*-4(sp) # pop s5 119 lw s6, r_S6*-4(sp) # pop s6 120 lw s7, r_S7*-4(sp) # pop s7 121 lw t8, r_T8*-4(sp) # pop t8 122 lw t9, r_T9*-4(sp) # pop t9 123 lw k0, r_K0*-4(sp) # pop k0 124 lw k1, r_K1*-4(sp) # pop k1 125 lw ra, r_RA*-4(sp) # pop RA 126 127 #ifdef HARD_FLOAT 128 /* pop f0-f31 from stack */ 129 add sp, (32-0)*4 # adjust stack pointer 130 lw f0, fr0*-4(sp) # pop f0 131 lw f1, fr1*-4(sp) # pop f1 132 lw f2, fr2*-4(sp) # pop f2 133 lw f3, fr3*-4(sp) # pop f3 134 lw f4, fr4*-4(sp) # pop f4 135 lw f5, fr5*-4(sp) # pop f5 136 lw f6, fr6*-4(sp) # pop f6 137 lw f7, fr7*-4(sp) # pop f7 138 lw f8, fr8*-4(sp) # pop f8 139 lw f9, fr9*-4(sp) # pop f9 140 lw f10, fr10*-4(sp) # pop f10 141 lw f11, fr11*-4(sp) # pop f11 142 lw f12, fr12*-4(sp) # pop f12 143 lw f13, fr13*-4(sp) # pop f13 144 lw f14, fr14*-4(sp) # pop f14 145 lw f15, fr15*-4(sp) # pop f15 146 lw f16, fr16*-4(sp) # pop f16 147 lw f17, fr17*-4(sp) # pop f17 148 lw f18, fr18*-4(sp) # pop f18 149 lw f19, fr19*-4(sp) # pop f19 150 lw f20, fr20*-4(sp) # pop f20 151 lw f21, fr21*-4(sp) # pop f21 152 lw f22, fr22*-4(sp) # pop f22 153 lw f23, fr23*-4(sp) # pop f23 154 lw f24, fr24*-4(sp) # pop f24 155 lw f25, fr25*-4(sp) # pop f25 156 lw f26, fr26*-4(sp) # pop f26 157 lw f27, fr27*-4(sp) # pop f27 158 lw f28, fr28*-4(sp) # pop f28 159 lw f29, fr29*-4(sp) # pop f29 160 lw f30, fr30*-4(sp) # pop f30 161 lw f31, fr31*-4(sp) # pop f31 162 #endif 163 164 RETURN 165 #endif 166