diff --git a/minicoro.h b/minicoro.h index bb691a7..900ef6d 100644 --- a/minicoro.h +++ b/minicoro.h @@ -1114,13 +1114,23 @@ int _mco_switch(_mco_ctxbuf* from, _mco_ctxbuf* to); __asm__( ".text\n" +#if defined(__thumb__) + ".thumb\n" +#endif + ".syntax unified\n" #ifdef __APPLE__ ".globl __mco_switch\n" +#if defined(__thumb__) + ".thumb_func\n" +#endif "__mco_switch:\n" #else ".globl _mco_switch\n" - ".type _mco_switch #function\n" + ".type _mco_switch, %function\n" ".hidden _mco_switch\n" +#if defined(__thumb__) + ".thumb_func\n" +#endif "_mco_switch:\n" #endif #ifndef __SOFTFP__ @@ -1132,7 +1142,8 @@ __asm__( " vldmia r1!, {d8-d15}\n" #endif " ldr sp, [r1, #9*4]\n" - " ldmia r1, {r4-r11, pc}\n" + " ldmia r1, {r4-r11, lr}\n" + " bx lr\n" #ifndef __APPLE__ ".size _mco_switch, .-_mco_switch\n" #endif @@ -1140,13 +1151,23 @@ __asm__( __asm__( ".text\n" +#if defined(__thumb__) + ".thumb\n" +#endif + ".syntax unified\n" #ifdef __APPLE__ ".globl __mco_wrap_main\n" +#if defined(__thumb__) + ".thumb_func\n" +#endif "__mco_wrap_main:\n" #else ".globl _mco_wrap_main\n" - ".type _mco_wrap_main #function\n" + ".type _mco_wrap_main, %function\n" ".hidden _mco_wrap_main\n" +#if defined(__thumb__) + ".thumb_func\n" +#endif "_mco_wrap_main:\n" #endif " mov r0, r4\n"