blob: 1b2c39b7ef2611b7c8678631daddf414449e2fb8 [file] [log] [blame]
Ian Rogers9651f422011-09-19 20:26:07 -07001#include "asm_support.h"
2
buzbee54330722011-08-23 16:46:55 -07003#if defined(__arm__)
4
5 .balign 4
buzbee4a3164f2011-09-03 11:25:10 -07006
Ian Rogersff1ed472011-09-20 13:46:24 -07007 /* Deliver the given exception */
8 .extern artDeliverExceptionFromCode
9 /* Deliver an exception pending on a thread */
10 .extern artDeliverPendingException
11
12 .global art_deliver_exception_from_code
Ian Rogersbdb03912011-09-14 00:55:44 -070013 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070014 * Called by managed code, saves mosts registers (forms basis of long jump context) and passes
15 * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at
16 * the bottom of the thread. On entry r0 holds Throwable*
Ian Rogersbdb03912011-09-14 00:55:44 -070017 */
Ian Rogersff1ed472011-09-20 13:46:24 -070018art_deliver_exception_from_code:
Ian Rogersbdb03912011-09-14 00:55:44 -070019 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
Ian Rogersff1ed472011-09-20 13:46:24 -070020 sub sp, #16 @ 4 words of space, bottom word will hold Method*
21 mov r1, r9 @ pass Thread::Current
22 mov r2, sp @ pass SP
23 b artDeliverExceptionFromCode @ artDeliverExceptionFromCode(Throwable*, Thread*, SP)
Ian Rogers9651f422011-09-19 20:26:07 -070024
25 .global art_throw_null_pointer_exception_from_code
Ian Rogersff1ed472011-09-20 13:46:24 -070026 .extern artThrowNullPointerExceptionFromCode
Ian Rogers9651f422011-09-19 20:26:07 -070027 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070028 * Called by managed code to create and deliver a NullPointerException
Ian Rogers9651f422011-09-19 20:26:07 -070029 */
30art_throw_null_pointer_exception_from_code:
31 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
Ian Rogersff1ed472011-09-20 13:46:24 -070032 sub sp, #16 @ 4 words of space, bottom word will hold Method*
33 mov r0, r9 @ pass Thread::Current
34 mov r1, sp @ pass SP
35 b artThrowNullPointerExceptionFromCode @ artThrowNullPointerExceptionFromCode(Thread*, SP)
Ian Rogers9651f422011-09-19 20:26:07 -070036
37 .global art_throw_div_zero_from_code
Ian Rogersff1ed472011-09-20 13:46:24 -070038 .extern artThrowDivZeroFromCode
Ian Rogers9651f422011-09-19 20:26:07 -070039 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070040 * Called by managed code to create and deliver an ArithmeticException
Ian Rogers9651f422011-09-19 20:26:07 -070041 */
42art_throw_div_zero_from_code:
43 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
Ian Rogersff1ed472011-09-20 13:46:24 -070044 sub sp, #16 @ 4 words of space, bottom word will hold Method*
45 mov r0, r9 @ pass Thread::Current
46 mov r1, sp @ pass SP
47 b artThrowDivZeroFromCode @ artThrowDivZeroFromCode(Thread*, SP)
Ian Rogers9651f422011-09-19 20:26:07 -070048
49 .global art_throw_array_bounds_from_code
Ian Rogersff1ed472011-09-20 13:46:24 -070050 .extern artThrowArrayBoundsFromCode
Ian Rogers9651f422011-09-19 20:26:07 -070051 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070052 * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException
Ian Rogers9651f422011-09-19 20:26:07 -070053 */
54art_throw_array_bounds_from_code:
55 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
Ian Rogersff1ed472011-09-20 13:46:24 -070056 sub sp, #16 @ 4 words of space, bottom word will hold Method*
57 mov r2, r9 @ pass Thread::Current
58 mov r3, sp @ pass SP
59 b artThrowArrayBoundsFromCode @ artThrowArrayBoundsFromCode(index, limit, Thread*, SP)
Ian Rogersbdb03912011-09-14 00:55:44 -070060
Ian Rogers932746a2011-09-22 18:57:50 -070061 .global art_throw_stack_overflow_from_code
62 .extern artThrowStackOverflowFromCode
63art_throw_stack_overflow_from_code:
64 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
65 sub sp, #16 @ 4 words of space, bottom word will hold Method*
66 mov r1, r9 @ pass Thread::Current
67 mov r2, sp @ pass SP
68 b artThrowStackOverflowFromCode @ artThrowStackOverflowFromCode(method, Thread*, SP)
69
Ian Rogersc0c8dc82011-09-24 18:15:59 -070070 .global art_throw_neg_array_size_from_code
71 .extern artThrowNegArraySizeFromCode
72art_throw_neg_array_size_from_code:
73 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
74 sub sp, #16 @ 4 words of space, bottom word will hold Method*
75 mov r1, r9 @ pass Thread::Current
76 mov r2, sp @ pass SP
77 b artThrowNegArraySizeFromCode @ artThrowNegArraySizeFromCode(size, Thread*, SP)
78
79 .global art_throw_internal_error_from_code
80 .extern artThrowInternalErrorFromCode
81art_throw_internal_error_from_code:
82 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
83 sub sp, #16 @ 4 words of space, bottom word will hold Method*
84 mov r1, r9 @ pass Thread::Current
85 mov r2, sp @ pass SP
86 b artThrowInternalErrorFromCode @ artThrowInternalErrorFromCode(errnum, Thread*, SP)
87
88 .global art_throw_no_such_method_from_code
89 .extern artThrowNoSuchMethodFromCode
90art_throw_no_such_method_from_code:
91 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
92 sub sp, #16 @ 4 words of space, bottom word will hold Method*
93 mov r1, r9 @ pass Thread::Current
94 mov r2, sp @ pass SP
95 b artThrowNoSuchMethodFromCode @ artThrowNoSuchMethodFromCode(method_idx, Thread*, SP)
96
97 .global art_throw_runtime_exception_from_code
98 .extern artThrowRuntimeExceptionFromCode
99art_throw_runtime_exception_from_code:
100 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
101 sub sp, #16 @ 4 words of space, bottom word will hold Method*
102 mov r1, r9 @ pass Thread::Current
103 mov r2, sp @ pass SP
104 b artThrowRuntimeExceptionFromCode @ artThrowRuntimeExceptionFromCode(errnum, Thread*, SP)
105
106 .global art_throw_verification_error_from_code
107 .extern artThrowVerificationErrorFromCode
108art_throw_verification_error_from_code:
109 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
110 sub sp, #16 @ 4 words of space, bottom word will hold Method*
111 mov r2, r9 @ pass Thread::Current
112 mov r3, sp @ pass SP
113 b artThrowVerificationErrorFromCode @ artThrowVerificationErrorFromCode(src1, ref, Thread*, SP)
114
buzbee4a3164f2011-09-03 11:25:10 -0700115 .global art_invoke_interface_trampoline
Ian Rogersff1ed472011-09-20 13:46:24 -0700116 .extern artFindInterfaceMethodInCacheFromCode
buzbee4a3164f2011-09-03 11:25:10 -0700117 /*
Ian Rogersff1ed472011-09-20 13:46:24 -0700118 * All generated callsites for interface invokes will load arguments as usual - except instead
119 * of loading arg0/r0 with the target Method*, arg0/r0 will contain the method_idx. This
120 * wrapper will save arg1-arg3, load the caller's Method*, align the stack and call the helper
121 * artFindInterfaceMethodInCacheFromCode(idx, this, method);
122 * NOTE: "this" is first visable argument of the target, and so can be found in arg1/r1.
buzbee4a3164f2011-09-03 11:25:10 -0700123 *
Ian Rogersff1ed472011-09-20 13:46:24 -0700124 * artFindInterfaceMethodInCacheFromCode will attempt to locate the target and return a 64-bit
125 * result in r0/r1 consisting of the target Method* in r0 and method->code_ in r1.
buzbee4a3164f2011-09-03 11:25:10 -0700126 *
Ian Rogersff1ed472011-09-20 13:46:24 -0700127 * If unsuccessful, artFindInterfaceMethodInCacheFromCode will return NULL/NULL. There will be
128 * a pending exception in the thread and we branch to another stub to deliver it.
buzbee4a3164f2011-09-03 11:25:10 -0700129 *
Ian Rogersff1ed472011-09-20 13:46:24 -0700130 * On success this wrapper will restore arguments and *jump* to the target, leaving the lr
131 * pointing back to the original caller.
buzbee4a3164f2011-09-03 11:25:10 -0700132 */
Ian Rogersff1ed472011-09-20 13:46:24 -0700133art_invoke_interface_trampoline:
134 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
135 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
buzbee4a3164f2011-09-03 11:25:10 -0700136 stmdb sp!, {r1, r2, r3, lr}
Ian Rogersff1ed472011-09-20 13:46:24 -0700137 ldr r2, [sp, #16] @ load caller's Method*
138 bl artFindInterfaceMethodInCacheFromCode @ (method_idx, this, callerMethod)
139 mov r12, r1 @ save r0->code_
140 ldmia sp!, {r1, r2, r3, lr} @ restore arguments
141 cmp r0, #0 @ did we find the target?
142 bxne r12 @ tail call to target if so
143 @ set up for throwing exception
144 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
145 sub sp, #16 @ 4 words of space, bottom word will hold Method*
146 mov r0, r9 @ pass Thread::Current
147 mov r1, sp @ pass SP
148 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
149
150 .global art_handle_fill_data_from_code
151 .extern artHandleFillArrayDataFromCode
152 /*
153 * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on
154 * failure.
155 */
156art_handle_fill_data_from_code:
157 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
158 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
159 stmdb sp!, {lr} @ Save LR
160 sub sp, #12 @ Align stack
161 bl artHandleFillArrayDataFromCode @ (Array* array, const uint16_t* table)
162 add sp, #12
163 ldmia sp!, {lr} @ restore LR
164 cmp r0, #0 @ success?
165 moveq pc, lr @ return on success
166 @ set up for throwing exception
167 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
168 sub sp, #16 @ 4 words of space, bottom word will hold Method*
169 mov r0, r9 @ pass Thread::Current
170 mov r1, sp @ pass SP
171 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
172
173 .global art_unlock_object_from_code
174 .extern artUnlockObjectFromCode
175 /*
176 * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure.
177 */
178art_unlock_object_from_code:
179 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
180 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
181 stmdb sp!, {lr} @ Save LR
182 sub sp, #12 @ Align stack
183 bl artUnlockObjectFromCode @ (Thread* thread, Object* obj)
184 add sp, #12
185 ldmia sp!, {lr} @ restore LR
186 cmp r0, #0 @ success?
187 moveq pc, lr @ return on success
188 @ set up for throwing exception
189 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
190 sub sp, #16 @ 4 words of space, bottom word will hold Method*
191 mov r0, r9 @ pass Thread::Current
192 mov r1, sp @ pass SP
193 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
194
195 .global art_check_cast_from_code
196 .extern artCheckCastFromCode
197 /*
198 * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure.
199 */
200art_check_cast_from_code:
201 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
202 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
203 stmdb sp!, {lr} @ Save LR
204 sub sp, #12 @ Align stack
205 bl artCheckCastFromCode @ (Class* a, Class* b)
206 add sp, #12
207 ldmia sp!, {lr} @ restore LR
208 cmp r0, #0 @ success?
209 moveq pc, lr @ return on success
210 @ set up for throwing exception
211 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
212 sub sp, #16 @ 4 words of space, bottom word will hold Method*
213 mov r0, r9 @ pass Thread::Current
214 mov r1, sp @ pass SP
215 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
buzbee4a3164f2011-09-03 11:25:10 -0700216
Ian Rogerse51a5112011-09-23 14:16:35 -0700217 .global art_can_put_array_element_from_code
218 .extern artCanPutArrayElementFromCode
219 /*
220 * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on
221 * failure.
222 */
223art_can_put_array_element_from_code:
224 cmp r0, #0 @ return if element == NULL
225 moveq pc, lr
226 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
227 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
228 stmdb sp!, {lr} @ Save LR
229 sub sp, #12 @ Align stack
230 bl artCanPutArrayElementFromCode @ (Object* element, Class* array_class)
231 add sp, #12
232 ldmia sp!, {lr} @ restore LR
233 cmp r0, #0 @ success?
234 moveq pc, lr @ return on success
235 @ set up for throwing exception
236 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
237 sub sp, #16 @ 4 words of space, bottom word will hold Method*
238 mov r0, r9 @ pass Thread::Current
239 mov r1, sp @ pass SP
240 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
241
Ian Rogerscbba6ac2011-09-22 16:28:37 -0700242 .global art_initialize_static_storage_from_code
243 .extern _ZN3art11ClassLinker31InitializeStaticStorageFromCodeEjPKNS_6MethodE
244 /*
245 * Entry from managed code when uninitialized static storage, this stub will run the class
246 * initializer and deliver the exception on error. On success the static storage base is
247 * returned.
248 */
249art_initialize_static_storage_from_code:
250 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
251 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
252 stmdb sp!, {lr} @ Save LR
253 sub sp, #12 @ Align stack
254 @ ClassLinker::InitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer)
255 bl _ZN3art11ClassLinker31InitializeStaticStorageFromCodeEjPKNS_6MethodE
256 add sp, #12
257 ldmia sp!, {lr} @ restore LR
258 cmp r0, #0 @ success if result is non-null
259 movne pc, lr @ return on success
260 @ set up for throwing exception
261 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
262 sub sp, #16 @ 4 words of space, bottom word will hold Method*
263 mov r0, r9 @ pass Thread::Current
264 mov r1, sp @ pass SP
265 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
266
Ian Rogers21d9e832011-09-23 17:05:09 -0700267 .global art_alloc_object_from_code
268 .extern artAllocObjectFromCode
269 /*
270 * Called by managed code to allocate an object
271 */
272art_alloc_object_from_code:
273 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
274 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
275 stmdb sp!, {lr} @ Save LR
276 sub sp, #12 @ Align stack
277 bl artAllocObjectFromCode @ (uint32_t type_idx, Method* method)
278 add sp, #12
279 ldmia sp!, {lr} @ restore LR
280 cmp r0, #0 @ success if result is non-null
281 movne pc, lr @ return on success
282 @ set up for throwing exception
283 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
284 sub sp, #16 @ 4 words of space, bottom word will hold Method*
285 mov r0, r9 @ pass Thread::Current
286 mov r1, sp @ pass SP
287 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
288
Ian Rogersb886da82011-09-23 16:27:54 -0700289 .global art_array_alloc_from_code
290 .extern artArrayAllocFromCode
291 /*
292 * Called by managed code to allocate an array
293 */
294art_array_alloc_from_code:
295 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
296 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
297 stmdb sp!, {lr} @ Save LR
298 sub sp, #12 @ Align stack
299 bl artArrayAllocFromCode @ (uint32_t type_idx, Method* method, int32_t component_count)
300 add sp, #12
301 ldmia sp!, {lr} @ restore LR
302 cmp r0, #0 @ success if result is non-null
303 movne pc, lr @ return on success
304 @ set up for throwing exception
305 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
306 sub sp, #16 @ 4 words of space, bottom word will hold Method*
307 mov r0, r9 @ pass Thread::Current
308 mov r1, sp @ pass SP
309 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
310
311 .global art_check_and_array_alloc_from_code
312 .extern artCheckAndArrayAllocFromCode
313 /*
314 * Called by managed code to allocate an array
315 */
316art_check_and_array_alloc_from_code:
317 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
318 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
319 stmdb sp!, {lr} @ Save LR
320 sub sp, #12 @ Align stack
321 bl artCheckAndArrayAllocFromCode @ (uint32_t type_idx, Method* method, int32_t count)
322 add sp, #12
323 ldmia sp!, {lr} @ restore LR
324 cmp r0, #0 @ success if result is non-null
325 movne pc, lr @ return on success
326 @ set up for throwing exception
327 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
328 sub sp, #16 @ 4 words of space, bottom word will hold Method*
329 mov r0, r9 @ pass Thread::Current
330 mov r1, sp @ pass SP
331 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
332
buzbee54330722011-08-23 16:46:55 -0700333 .global art_shl_long
334art_shl_long:
335 /*
336 * Long integer shift. This is different from the generic 32/64-bit
337 * binary operations because vAA/vBB are 64-bit but vCC (the shift
338 * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low
339 * 6 bits.
340 * On entry:
341 * r0: low word
342 * r1: high word
343 * r2: shift count
344 */
345 /* shl-long vAA, vBB, vCC */
346 and r2, r2, #63 @ r2<- r2 & 0x3f
347 mov r1, r1, asl r2 @ r1<- r1 << r2
348 rsb r3, r2, #32 @ r3<- 32 - r2
349 orr r1, r1, r0, lsr r3 @ r1<- r1 | (r0 << (32-r2))
350 subs ip, r2, #32 @ ip<- r2 - 32
351 movpl r1, r0, asl ip @ if r2 >= 32, r1<- r0 << (r2-32)
352 mov r0, r0, asl r2 @ r0<- r0 << r2
353 bx lr
354
355 .balign 4
356 .global art_shr_long
357art_shr_long:
358 /*
359 * Long integer shift. This is different from the generic 32/64-bit
360 * binary operations because vAA/vBB are 64-bit but vCC (the shift
361 * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low
362 * 6 bits.
363 * On entry:
364 * r0: low word
365 * r1: high word
366 * r2: shift count
367 */
368 /* shr-long vAA, vBB, vCC */
369 and r2, r2, #63 @ r0<- r0 & 0x3f
370 mov r0, r0, lsr r2 @ r0<- r2 >> r2
371 rsb r3, r2, #32 @ r3<- 32 - r2
372 orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2))
373 subs ip, r2, #32 @ ip<- r2 - 32
374 movpl r0, r1, asr ip @ if r2 >= 32, r0<-r1 >> (r2-32)
375 mov r1, r1, asr r2 @ r1<- r1 >> r2
376 bx lr
377
378 .balign 4
379 .global art_ushr_long
380art_ushr_long:
381 /*
382 * Long integer shift. This is different from the generic 32/64-bit
383 * binary operations because vAA/vBB are 64-bit but vCC (the shift
384 * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low
385 * 6 bits.
386 * On entry:
387 * r0: low word
388 * r1: high word
389 * r2: shift count
390 */
391 /* ushr-long vAA, vBB, vCC */
392 and r2, r2, #63 @ r0<- r0 & 0x3f
393 mov r0, r0, lsr r2 @ r0<- r2 >> r2
394 rsb r3, r2, #32 @ r3<- 32 - r2
395 orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2))
396 subs ip, r2, #32 @ ip<- r2 - 32
397 movpl r0, r1, lsr ip @ if r2 >= 32, r0<-r1 >>> (r2-32)
398 mov r1, r1, lsr r2 @ r1<- r1 >>> r2
399 bx lr
400
buzbeec1f45042011-09-21 16:03:19 -0700401 .balign 4
402 .global art_test_suspend
403 .extern artCheckSuspendFromCode
404art_test_suspend:
405 /*
406 * Check to see if there's a pending suspend request on our thread.
407 * reset rSUSPEND to SUSPEND_CHECK_INTERVAL.
408 * On entry, rSUSPEND holds the suspend request value
409 * [TUNING: move load of suspend check value into this stub.
410 */
411 cmp rSUSPEND, #0
412 mov rSUSPEND, #SUSPEND_CHECK_INTERVAL
413 bxeq rLR
414 mov r0, rSELF
415 b artCheckSuspendFromCode
416
417
buzbee54330722011-08-23 16:46:55 -0700418#endif
Ian Rogers67375ac2011-09-14 00:55:44 -0700419
420#if defined(__i386__)
421
Ian Rogersff1ed472011-09-20 13:46:24 -0700422 .global art_deliver_exception_from_code
423 .extern artDeliverExceptionFromCode
Ian Rogers67375ac2011-09-14 00:55:44 -0700424 /*
Ian Rogersff1ed472011-09-20 13:46:24 -0700425 * Called by managed code, saves callee saves and then calls artThrowException
Ian Rogers67375ac2011-09-14 00:55:44 -0700426 * that will place a mock Method* at the bottom of the stack.
427 * EAX holds the exception.
428 */
Ian Rogersff1ed472011-09-20 13:46:24 -0700429art_deliver_exception_from_code:
Ian Rogers67375ac2011-09-14 00:55:44 -0700430 // Create frame
431 pushl %edi // Save callee saves
432 pushl %esi
433 pushl %ebp
434 pushl %ebx
435 pushl $0
436 pushl $0
437 pushl $0 // Will be clobbered to be Method*
438 mov %esp, %ecx
439 // Outgoing argument set up
Ian Rogersff1ed472011-09-20 13:46:24 -0700440 pushl $0 // Alignment padding
441 pushl %ecx // pass SP
442 pushl %fs:THREAD_SELF_OFFSET // pass fs:offsetof(Thread,self_)
443 pushl %eax // pass Throwable*
444 call artDeliverExceptionFromCode // artDeliverExceptionFromCode(Throwable*, Thread*, SP)
Ian Rogers67375ac2011-09-14 00:55:44 -0700445 int3
446
447#endif