@@ -282,6 +282,10 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
282
282
283
283
#elif __arm__ && !__APPLE__
284
284
285
+ #if !defined(__ARM_ARCH_ISA_ARM)
286
+ .thumb
287
+ #endif
288
+
285
289
@
286
290
@ extern int unw_getcontext(unw_context_t* thread_state)
287
291
@
@@ -296,19 +300,24 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
296
300
@
297
301
.p2align 2
298
302
DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
303
+ #if !defined(__ARM_ARCH_ISA_ARM)
304
+ stm r0!, {r0-r7}
305
+ mov r2, sp
306
+ mov r3, lr
307
+ str r2, [r0, #52]
308
+ str r3, [r0, #56]
309
+ str r3, [r0, #60] @ store return address as pc
310
+ #else
299
311
@ 32bit thumb-2 restrictions for stm:
300
312
@ . the sp (r13) cannot be in the list
301
313
@ . the pc (r15) cannot be in the list in an STM instruction
302
314
stm r0, {r0-r12}
303
315
str sp, [r0, #52]
304
316
str lr, [r0, #56]
305
317
str lr, [r0, #60] @ store return address as pc
306
- mov r0, #0 @ return UNW_ESUCCESS
307
- #if __ARM_ARCH > 4
308
- bx lr
309
- #else
310
- mov pc, lr
311
318
#endif
319
+ mov r0, #0 @ return UNW_ESUCCESS
320
+ JMP (lr)
312
321
313
322
@
314
323
@ static void libunwind: :Registers_arm::saveVFPWithFSTMD(unw_fpreg_t* values)
@@ -318,12 +327,14 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext)
318
327
@
319
328
.p2align 2
320
329
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMDEPy)
330
+ #if defined(__ARM_FP)
321
331
#if __ARM_ARCH < 7
322
332
stc p11, cr0, [r0], {0x20 } @ fstmiad r0, {d0-d15}
323
333
#else
324
334
vstmia r0, {d0-d15}
325
335
#endif
326
- mov pc, lr
336
+ #endif
337
+ JMP (lr)
327
338
328
339
@
329
340
@ static void libunwind: :Registers_arm::saveVFPWithFSTMX(unw_fpreg_t* values)
@@ -333,12 +344,14 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMD
333
344
@
334
345
.p2align 2
335
346
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMXEPy)
347
+ #if defined(__ARM_FP)
336
348
#if __ARM_ARCH < 7
337
349
stc p11, cr0, [r0], {0x21 } @ fstmiax r0, {d0-d15}
338
350
#else
339
351
vstmia r0, {d0-d15} @ fstmiax is deprecated in ARMv7+ and now behaves like vstmia
340
352
#endif
341
- mov pc, lr
353
+ #endif
354
+ JMP (lr)
342
355
343
356
@
344
357
@ static void libunwind: :Registers_arm::saveVFPv3(unw_fpreg_t* values)
@@ -348,8 +361,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMX
348
361
@
349
362
.p2align 2
350
363
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPy)
364
+ #if defined(__ARM_FP)
351
365
@ VFP and iwMMX instructions are only available when compiling with the flags
352
- @ that enable them. We don't want to do that in the library (because we don't
366
+ @ that enable them. We do not want to do that in the library (because we do not
353
367
@ want the compiler to generate instructions that access those) but this is
354
368
@ only accessed if the personality routine needs these registers. Use of
355
369
@ these registers implies they are, actually, available on the target, so
@@ -360,7 +374,8 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPy)
360
374
#else
361
375
vstmia r0, {d16-d31}
362
376
#endif
363
- mov pc, lr
377
+ #endif
378
+ JMP (lr)
364
379
365
380
@
366
381
@ static void libunwind: :Registers_arm::saveiWMMX(unw_fpreg_t* values)
@@ -370,6 +385,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPy)
370
385
@
371
386
.p2align 2
372
387
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPy)
388
+ #if (!defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_6SM__)) || __ARM_WMMX
373
389
stcl p1, cr0, [r0], #8 @ wstrd wR0, [r0], #8
374
390
stcl p1, cr1, [r0], #8 @ wstrd wR1, [r0], #8
375
391
stcl p1, cr2, [r0], #8 @ wstrd wR2, [r0], #8
@@ -386,7 +402,8 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPy)
386
402
stcl p1, cr13, [r0], #8 @ wstrd wR13, [r0], #8
387
403
stcl p1, cr14, [r0], #8 @ wstrd wR14, [r0], #8
388
404
stcl p1, cr15, [r0], #8 @ wstrd wR15, [r0], #8
389
- mov pc, lr
405
+ #endif
406
+ JMP (lr)
390
407
391
408
@
392
409
@ static void libunwind: :Registers_arm::saveiWMMXControl(unw_uint32_t* values)
@@ -396,10 +413,12 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPy)
396
413
@
397
414
.p2align 2
398
415
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveiWMMXControlEPj)
416
+ #if (!defined(__ARM_ARCH_6M__) && !defined(__ARM_ARCH_6SM__)) || __ARM_WMMX
399
417
stc2 p1, cr8, [r0], #4 @ wstrw wCGR0, [r0], #4
400
418
stc2 p1, cr9, [r0], #4 @ wstrw wCGR1, [r0], #4
401
419
stc2 p1, cr10, [r0], #4 @ wstrw wCGR2, [r0], #4
402
420
stc2 p1, cr11, [r0], #4 @ wstrw wCGR3, [r0], #4
403
- mov pc, lr
421
+ #endif
422
+ JMP (lr)
404
423
405
424
#endif
0 commit comments