blob: 0e73d83a9b05bdb7fe9ee2698a711dc78fb50604 [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
Ian Rogers15fdb8c2011-09-25 15:45:07 -070012 /* Macro that sets up the callee save frame to conform with Runtime::CreateCalleeSaveMethod */
13.macro SETUP_CALLEE_SAVE_FRAME
14 push {r1-r11, lr}
15 vpush {s0-s31}
16 sub sp, #16 @ 4 words of space, bottom word will hold Method*
17.endm
18
Ian Rogersff1ed472011-09-20 13:46:24 -070019 .global art_deliver_exception_from_code
Ian Rogersbdb03912011-09-14 00:55:44 -070020 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070021 * Called by managed code, saves mosts registers (forms basis of long jump context) and passes
22 * the bottom of the stack. artDeliverExceptionFromCode will place the callee save Method* at
23 * the bottom of the thread. On entry r0 holds Throwable*
Ian Rogersbdb03912011-09-14 00:55:44 -070024 */
Ian Rogersff1ed472011-09-20 13:46:24 -070025art_deliver_exception_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070026 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -070027 mov r1, r9 @ pass Thread::Current
28 mov r2, sp @ pass SP
29 b artDeliverExceptionFromCode @ artDeliverExceptionFromCode(Throwable*, Thread*, SP)
Ian Rogers9651f422011-09-19 20:26:07 -070030
31 .global art_throw_null_pointer_exception_from_code
Ian Rogersff1ed472011-09-20 13:46:24 -070032 .extern artThrowNullPointerExceptionFromCode
Ian Rogers9651f422011-09-19 20:26:07 -070033 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070034 * Called by managed code to create and deliver a NullPointerException
Ian Rogers9651f422011-09-19 20:26:07 -070035 */
36art_throw_null_pointer_exception_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070037 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -070038 mov r0, r9 @ pass Thread::Current
39 mov r1, sp @ pass SP
40 b artThrowNullPointerExceptionFromCode @ artThrowNullPointerExceptionFromCode(Thread*, SP)
Ian Rogers9651f422011-09-19 20:26:07 -070041
42 .global art_throw_div_zero_from_code
Ian Rogersff1ed472011-09-20 13:46:24 -070043 .extern artThrowDivZeroFromCode
Ian Rogers9651f422011-09-19 20:26:07 -070044 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070045 * Called by managed code to create and deliver an ArithmeticException
Ian Rogers9651f422011-09-19 20:26:07 -070046 */
47art_throw_div_zero_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070048 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -070049 mov r0, r9 @ pass Thread::Current
50 mov r1, sp @ pass SP
51 b artThrowDivZeroFromCode @ artThrowDivZeroFromCode(Thread*, SP)
Ian Rogers9651f422011-09-19 20:26:07 -070052
53 .global art_throw_array_bounds_from_code
Ian Rogersff1ed472011-09-20 13:46:24 -070054 .extern artThrowArrayBoundsFromCode
Ian Rogers9651f422011-09-19 20:26:07 -070055 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070056 * Called by managed code to create and deliver an ArrayIndexOutOfBoundsException
Ian Rogers9651f422011-09-19 20:26:07 -070057 */
58art_throw_array_bounds_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070059 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -070060 mov r2, r9 @ pass Thread::Current
61 mov r3, sp @ pass SP
62 b artThrowArrayBoundsFromCode @ artThrowArrayBoundsFromCode(index, limit, Thread*, SP)
Ian Rogersbdb03912011-09-14 00:55:44 -070063
Ian Rogers932746a2011-09-22 18:57:50 -070064 .global art_throw_stack_overflow_from_code
65 .extern artThrowStackOverflowFromCode
66art_throw_stack_overflow_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070067 SETUP_CALLEE_SAVE_FRAME
Ian Rogers932746a2011-09-22 18:57:50 -070068 mov r1, r9 @ pass Thread::Current
69 mov r2, sp @ pass SP
70 b artThrowStackOverflowFromCode @ artThrowStackOverflowFromCode(method, Thread*, SP)
71
Ian Rogersc0c8dc82011-09-24 18:15:59 -070072 .global art_throw_neg_array_size_from_code
73 .extern artThrowNegArraySizeFromCode
74art_throw_neg_array_size_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070075 SETUP_CALLEE_SAVE_FRAME
Ian Rogersc0c8dc82011-09-24 18:15:59 -070076 mov r1, r9 @ pass Thread::Current
77 mov r2, sp @ pass SP
78 b artThrowNegArraySizeFromCode @ artThrowNegArraySizeFromCode(size, Thread*, SP)
79
Ian Rogersc0c8dc82011-09-24 18:15:59 -070080 .global art_throw_no_such_method_from_code
81 .extern artThrowNoSuchMethodFromCode
82art_throw_no_such_method_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070083 SETUP_CALLEE_SAVE_FRAME
Ian Rogersc0c8dc82011-09-24 18:15:59 -070084 mov r1, r9 @ pass Thread::Current
85 mov r2, sp @ pass SP
86 b artThrowNoSuchMethodFromCode @ artThrowNoSuchMethodFromCode(method_idx, Thread*, SP)
87
Ian Rogersc0c8dc82011-09-24 18:15:59 -070088 .global art_throw_verification_error_from_code
89 .extern artThrowVerificationErrorFromCode
90art_throw_verification_error_from_code:
Ian Rogers15fdb8c2011-09-25 15:45:07 -070091 SETUP_CALLEE_SAVE_FRAME
Ian Rogersc0c8dc82011-09-24 18:15:59 -070092 mov r2, r9 @ pass Thread::Current
93 mov r3, sp @ pass SP
Elliott Hughes6c8867d2011-10-03 16:34:05 -070094 b artThrowVerificationErrorFromCode @ artThrowVerificationErrorFromCode(kind, ref, Thread*, SP)
Ian Rogersc0c8dc82011-09-24 18:15:59 -070095
buzbee4a3164f2011-09-03 11:25:10 -070096 .global art_invoke_interface_trampoline
Ian Rogersff1ed472011-09-20 13:46:24 -070097 .extern artFindInterfaceMethodInCacheFromCode
buzbee4a3164f2011-09-03 11:25:10 -070098 /*
Ian Rogersff1ed472011-09-20 13:46:24 -070099 * All generated callsites for interface invokes will load arguments as usual - except instead
100 * of loading arg0/r0 with the target Method*, arg0/r0 will contain the method_idx. This
101 * wrapper will save arg1-arg3, load the caller's Method*, align the stack and call the helper
102 * artFindInterfaceMethodInCacheFromCode(idx, this, method);
103 * NOTE: "this" is first visable argument of the target, and so can be found in arg1/r1.
buzbee4a3164f2011-09-03 11:25:10 -0700104 *
Ian Rogersff1ed472011-09-20 13:46:24 -0700105 * artFindInterfaceMethodInCacheFromCode will attempt to locate the target and return a 64-bit
106 * result in r0/r1 consisting of the target Method* in r0 and method->code_ in r1.
buzbee4a3164f2011-09-03 11:25:10 -0700107 *
Ian Rogersff1ed472011-09-20 13:46:24 -0700108 * If unsuccessful, artFindInterfaceMethodInCacheFromCode will return NULL/NULL. There will be
109 * a pending exception in the thread and we branch to another stub to deliver it.
buzbee4a3164f2011-09-03 11:25:10 -0700110 *
Ian Rogersff1ed472011-09-20 13:46:24 -0700111 * On success this wrapper will restore arguments and *jump* to the target, leaving the lr
112 * pointing back to the original caller.
buzbee4a3164f2011-09-03 11:25:10 -0700113 */
Ian Rogersff1ed472011-09-20 13:46:24 -0700114art_invoke_interface_trampoline:
115 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
116 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
buzbee4a3164f2011-09-03 11:25:10 -0700117 stmdb sp!, {r1, r2, r3, lr}
Ian Rogersff1ed472011-09-20 13:46:24 -0700118 ldr r2, [sp, #16] @ load caller's Method*
119 bl artFindInterfaceMethodInCacheFromCode @ (method_idx, this, callerMethod)
120 mov r12, r1 @ save r0->code_
121 ldmia sp!, {r1, r2, r3, lr} @ restore arguments
122 cmp r0, #0 @ did we find the target?
123 bxne r12 @ tail call to target if so
124 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700125 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -0700126 mov r0, r9 @ pass Thread::Current
127 mov r1, sp @ pass SP
128 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
129
130 .global art_handle_fill_data_from_code
131 .extern artHandleFillArrayDataFromCode
132 /*
133 * Entry from managed code that calls artHandleFillArrayDataFromCode and delivers exception on
134 * failure.
135 */
136art_handle_fill_data_from_code:
137 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
138 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
139 stmdb sp!, {lr} @ Save LR
140 sub sp, #12 @ Align stack
141 bl artHandleFillArrayDataFromCode @ (Array* array, const uint16_t* table)
142 add sp, #12
143 ldmia sp!, {lr} @ restore LR
144 cmp r0, #0 @ success?
145 moveq pc, lr @ return on success
146 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700147 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -0700148 mov r0, r9 @ pass Thread::Current
149 mov r1, sp @ pass SP
150 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
151
152 .global art_unlock_object_from_code
153 .extern artUnlockObjectFromCode
154 /*
155 * Entry from managed code that calls artUnlockObjectFromCode and delivers exception on failure.
156 */
157art_unlock_object_from_code:
158 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
159 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
160 stmdb sp!, {lr} @ Save LR
161 sub sp, #12 @ Align stack
162 bl artUnlockObjectFromCode @ (Thread* thread, Object* obj)
163 add sp, #12
164 ldmia sp!, {lr} @ restore LR
165 cmp r0, #0 @ success?
166 moveq pc, lr @ return on success
167 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700168 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -0700169 mov r0, r9 @ pass Thread::Current
170 mov r1, sp @ pass SP
171 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
172
173 .global art_check_cast_from_code
174 .extern artCheckCastFromCode
175 /*
176 * Entry from managed code that calls artCheckCastFromCode and delivers exception on failure.
177 */
178art_check_cast_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 artCheckCastFromCode @ (Class* a, Class* b)
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
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700189 SETUP_CALLEE_SAVE_FRAME
Ian Rogersff1ed472011-09-20 13:46:24 -0700190 mov r0, r9 @ pass Thread::Current
191 mov r1, sp @ pass SP
192 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
buzbee4a3164f2011-09-03 11:25:10 -0700193
Ian Rogerse51a5112011-09-23 14:16:35 -0700194 .global art_can_put_array_element_from_code
195 .extern artCanPutArrayElementFromCode
196 /*
197 * Entry from managed code that calls artCanPutArrayElementFromCode and delivers exception on
198 * failure.
199 */
200art_can_put_array_element_from_code:
201 cmp r0, #0 @ return if element == NULL
202 moveq pc, lr
203 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
204 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
205 stmdb sp!, {lr} @ Save LR
206 sub sp, #12 @ Align stack
207 bl artCanPutArrayElementFromCode @ (Object* element, Class* array_class)
208 add sp, #12
209 ldmia sp!, {lr} @ restore LR
210 cmp r0, #0 @ success?
211 moveq pc, lr @ return on success
212 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700213 SETUP_CALLEE_SAVE_FRAME
Ian Rogerse51a5112011-09-23 14:16:35 -0700214 mov r0, r9 @ pass Thread::Current
215 mov r1, sp @ pass SP
216 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
217
Ian Rogerscbba6ac2011-09-22 16:28:37 -0700218 .global art_initialize_static_storage_from_code
219 .extern _ZN3art11ClassLinker31InitializeStaticStorageFromCodeEjPKNS_6MethodE
220 /*
221 * Entry from managed code when uninitialized static storage, this stub will run the class
222 * initializer and deliver the exception on error. On success the static storage base is
223 * returned.
224 */
225art_initialize_static_storage_from_code:
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 @ ClassLinker::InitializeStaticStorageFromCode(uint32_t type_idx, Method* referrer)
231 bl _ZN3art11ClassLinker31InitializeStaticStorageFromCodeEjPKNS_6MethodE
232 add sp, #12
233 ldmia sp!, {lr} @ restore LR
234 cmp r0, #0 @ success if result is non-null
235 movne pc, lr @ return on success
236 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700237 SETUP_CALLEE_SAVE_FRAME
Ian Rogerscbba6ac2011-09-22 16:28:37 -0700238 mov r0, r9 @ pass Thread::Current
239 mov r1, sp @ pass SP
240 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
241
Ian Rogers21d9e832011-09-23 17:05:09 -0700242 .global art_alloc_object_from_code
243 .extern artAllocObjectFromCode
244 /*
245 * Called by managed code to allocate an object
246 */
247art_alloc_object_from_code:
buzbee33a129c2011-10-06 16:53:20 -0700248 SETUP_CALLEE_SAVE_FRAME
249 mov r2, r9 @ pass Thread::Current
250 mov r3, sp @ pass SP
251 bl artAllocObjectFromCode @ (uint32_t type_idx, Method* method, Thread*, SP)
252 add sp, #16
253 vpop {s0-s31}
254 pop {r1-r11, lr}
Ian Rogers21d9e832011-09-23 17:05:09 -0700255 cmp r0, #0 @ success if result is non-null
256 movne pc, lr @ return on success
257 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700258 SETUP_CALLEE_SAVE_FRAME
Ian Rogers21d9e832011-09-23 17:05:09 -0700259 mov r0, r9 @ pass Thread::Current
260 mov r1, sp @ pass SP
261 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
262
Elliott Hughesb408de72011-10-04 14:35:05 -0700263 .global art_alloc_array_from_code
264 .extern artAllocArrayFromCode
Ian Rogersb886da82011-09-23 16:27:54 -0700265 /*
266 * Called by managed code to allocate an array
267 */
Elliott Hughesb408de72011-10-04 14:35:05 -0700268art_alloc_array_from_code:
buzbee33a129c2011-10-06 16:53:20 -0700269 SETUP_CALLEE_SAVE_FRAME
270 mov r3, r9 @ pass Thread::Current
271 str sp, [sp, #0] @ pass SP
272 bl artAllocArrayFromCode @ (uint32_t type_idx, Method* method, int32_t component_count, Thread*, SP)
273 add sp, #16
274 vpop {s0-s31}
275 pop {r1-r11, lr}
Ian Rogersb886da82011-09-23 16:27:54 -0700276 cmp r0, #0 @ success if result is non-null
277 movne pc, lr @ return on success
278 @ set up for throwing exception
Ian Rogers15fdb8c2011-09-25 15:45:07 -0700279 SETUP_CALLEE_SAVE_FRAME
Ian Rogersb886da82011-09-23 16:27:54 -0700280 mov r0, r9 @ pass Thread::Current
281 mov r1, sp @ pass SP
282 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
283
Elliott Hughesb408de72011-10-04 14:35:05 -0700284 .global art_check_and_alloc_array_from_code
285 .extern artCheckAndAllocArrayFromCode
Ian Rogersb886da82011-09-23 16:27:54 -0700286 /*
287 * Called by managed code to allocate an array
288 */
Elliott Hughesb408de72011-10-04 14:35:05 -0700289art_check_and_alloc_array_from_code:
Ian Rogersb886da82011-09-23 16:27:54 -0700290 str sp, [R9, #THREAD_TOP_OF_MANAGED_STACK_OFFSET] @ record top of stack and pc in case of
291 str lr, [R9, #THREAD_TOP_OF_MANAGED_STACK_PC_OFFSET] @ walking stack
292 stmdb sp!, {lr} @ Save LR
293 sub sp, #12 @ Align stack
Elliott Hughesb408de72011-10-04 14:35:05 -0700294 bl artCheckAndAllocArrayFromCode @ (uint32_t type_idx, Method* method, int32_t count)
Ian Rogersb886da82011-09-23 16:27:54 -0700295 add sp, #12
296 ldmia sp!, {lr} @ restore LR
297 cmp r0, #0 @ success if result is non-null
298 movne pc, lr @ return on success
299 @ set up for throwing exception
300 stmdb sp!, {r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, lr}
301 sub sp, #16 @ 4 words of space, bottom word will hold Method*
302 mov r0, r9 @ pass Thread::Current
303 mov r1, sp @ pass SP
304 b artDeliverPendingExceptionFromCode @ artDeliverPendingExceptionFromCode(Thread*, SP)
305
buzbee54330722011-08-23 16:46:55 -0700306 .global art_shl_long
307art_shl_long:
308 /*
309 * Long integer shift. This is different from the generic 32/64-bit
310 * binary operations because vAA/vBB are 64-bit but vCC (the shift
311 * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low
312 * 6 bits.
313 * On entry:
314 * r0: low word
315 * r1: high word
316 * r2: shift count
317 */
318 /* shl-long vAA, vBB, vCC */
319 and r2, r2, #63 @ r2<- r2 & 0x3f
320 mov r1, r1, asl r2 @ r1<- r1 << r2
321 rsb r3, r2, #32 @ r3<- 32 - r2
322 orr r1, r1, r0, lsr r3 @ r1<- r1 | (r0 << (32-r2))
323 subs ip, r2, #32 @ ip<- r2 - 32
324 movpl r1, r0, asl ip @ if r2 >= 32, r1<- r0 << (r2-32)
325 mov r0, r0, asl r2 @ r0<- r0 << r2
326 bx lr
327
328 .balign 4
329 .global art_shr_long
330art_shr_long:
331 /*
332 * Long integer shift. This is different from the generic 32/64-bit
333 * binary operations because vAA/vBB are 64-bit but vCC (the shift
334 * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low
335 * 6 bits.
336 * On entry:
337 * r0: low word
338 * r1: high word
339 * r2: shift count
340 */
341 /* shr-long vAA, vBB, vCC */
342 and r2, r2, #63 @ r0<- r0 & 0x3f
343 mov r0, r0, lsr r2 @ r0<- r2 >> r2
344 rsb r3, r2, #32 @ r3<- 32 - r2
345 orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2))
346 subs ip, r2, #32 @ ip<- r2 - 32
347 movpl r0, r1, asr ip @ if r2 >= 32, r0<-r1 >> (r2-32)
348 mov r1, r1, asr r2 @ r1<- r1 >> r2
349 bx lr
350
351 .balign 4
352 .global art_ushr_long
353art_ushr_long:
354 /*
355 * Long integer shift. This is different from the generic 32/64-bit
356 * binary operations because vAA/vBB are 64-bit but vCC (the shift
357 * distance) is 32-bit. Also, Dalvik requires us to ignore all but the low
358 * 6 bits.
359 * On entry:
360 * r0: low word
361 * r1: high word
362 * r2: shift count
363 */
364 /* ushr-long vAA, vBB, vCC */
365 and r2, r2, #63 @ r0<- r0 & 0x3f
366 mov r0, r0, lsr r2 @ r0<- r2 >> r2
367 rsb r3, r2, #32 @ r3<- 32 - r2
368 orr r0, r0, r1, asl r3 @ r0<- r0 | (r1 << (32-r2))
369 subs ip, r2, #32 @ ip<- r2 - 32
370 movpl r0, r1, lsr ip @ if r2 >= 32, r0<-r1 >>> (r2-32)
371 mov r1, r1, lsr r2 @ r1<- r1 >>> r2
372 bx lr
373
buzbeec1f45042011-09-21 16:03:19 -0700374 .balign 4
375 .global art_test_suspend
376 .extern artCheckSuspendFromCode
377art_test_suspend:
378 /*
379 * Check to see if there's a pending suspend request on our thread.
380 * reset rSUSPEND to SUSPEND_CHECK_INTERVAL.
381 * On entry, rSUSPEND holds the suspend request value
382 * [TUNING: move load of suspend check value into this stub.
383 */
384 cmp rSUSPEND, #0
385 mov rSUSPEND, #SUSPEND_CHECK_INTERVAL
386 bxeq rLR
387 mov r0, rSELF
388 b artCheckSuspendFromCode
389
390
buzbee54330722011-08-23 16:46:55 -0700391#endif
Ian Rogers67375ac2011-09-14 00:55:44 -0700392
393#if defined(__i386__)
394
Ian Rogersff1ed472011-09-20 13:46:24 -0700395 .global art_deliver_exception_from_code
396 .extern artDeliverExceptionFromCode
Ian Rogers67375ac2011-09-14 00:55:44 -0700397 /*
Ian Rogersff1ed472011-09-20 13:46:24 -0700398 * Called by managed code, saves callee saves and then calls artThrowException
Ian Rogers67375ac2011-09-14 00:55:44 -0700399 * that will place a mock Method* at the bottom of the stack.
400 * EAX holds the exception.
401 */
Ian Rogersff1ed472011-09-20 13:46:24 -0700402art_deliver_exception_from_code:
Ian Rogers67375ac2011-09-14 00:55:44 -0700403 // Create frame
404 pushl %edi // Save callee saves
405 pushl %esi
406 pushl %ebp
407 pushl %ebx
408 pushl $0
409 pushl $0
410 pushl $0 // Will be clobbered to be Method*
411 mov %esp, %ecx
412 // Outgoing argument set up
Ian Rogersff1ed472011-09-20 13:46:24 -0700413 pushl $0 // Alignment padding
414 pushl %ecx // pass SP
415 pushl %fs:THREAD_SELF_OFFSET // pass fs:offsetof(Thread,self_)
416 pushl %eax // pass Throwable*
417 call artDeliverExceptionFromCode // artDeliverExceptionFromCode(Throwable*, Thread*, SP)
Ian Rogers67375ac2011-09-14 00:55:44 -0700418 int3
419
420#endif