Ticket #9437: boost-trunk-context-throw-wp8-ios.patch
File boost-trunk-context-throw-wp8-ios.patch, 10.1 KB (added by , 9 years ago) |
---|
-
boost/context/detail/fcontext_arm_mac.hpp
1 2 // Copyright Oliver Kowalke 2009. 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 #ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H 8 #define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H 9 10 #include <cstddef> 11 12 #include <boost/config.hpp> 13 #include <boost/cstdint.hpp> 14 15 #include <boost/context/detail/config.hpp> 16 17 #ifdef BOOST_HAS_ABI_HEADERS 18 # include BOOST_ABI_PREFIX 19 #endif 20 21 namespace boost { 22 namespace context { 23 24 extern "C" { 25 26 #define BOOST_CONTEXT_CALLDECL 27 28 struct stack_t 29 { 30 void * sp; 31 std::size_t size; 32 33 stack_t() : 34 sp( 0), size( 0) 35 {} 36 }; 37 38 struct fp_t 39 { 40 boost::uint32_t fc_freg[16]; 41 42 fp_t() : 43 fc_freg() 44 {} 45 }; 46 47 struct fcontext_t 48 { 49 boost::uint32_t fc_greg[11]; 50 stack_t fc_stack; 51 fp_t fc_fp; 52 void * fc_unwind_sjlj; 53 54 fcontext_t() : 55 fc_greg(), 56 fc_stack(), 57 fc_fp() 58 {} 59 }; 60 61 } 62 63 }} 64 65 #ifdef BOOST_HAS_ABI_HEADERS 66 # include BOOST_ABI_SUFFIX 67 #endif 68 69 #endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H -
boost/context/fcontext.hpp
49 49 // arm 50 50 #elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \ 51 51 || defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM) 52 # include <boost/context/detail/fcontext_arm.hpp> 52 # if defined(__MACH__) && defined(__APPLE__) 53 # include <boost/context/detail/fcontext_arm_mac.hpp> 54 # else 55 # include <boost/context/detail/fcontext_arm.hpp> 56 # endif 53 57 // mips 54 58 #elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \ 55 59 || defined(_R3000) -
libs/context/src/asm/jump_arm_aapcs_macho_gas.S
42 42 * ------------------------------------------------------------- * 43 43 * | s26 | s27 | s28 | s29 | s30 | s31 | | * 44 44 * ------------------------------------------------------------- * 45 * ------------------------------------------------------------- * 46 * | 29 | | * 47 * ------------------------------------------------------------- * 48 * | 0x74| | * 49 * ------------------------------------------------------------- * 50 * | sjlj| | * 51 * ------------------------------------------------------------- * 45 52 * * 46 53 * *****************************************************************/ 47 54 … … 65 72 vldmia a4, {d8-d15} @ restore S16-S31 66 73 1: 67 74 #endif 75 76 mrc p15, 0, a4, c13, c0, #3 @ locate TLS to save/restore SjLj handler 77 bic a4, a4, #3 68 78 79 ldr v1, [a4, #72] @ load TLS[__PTK_LIBC_DYLD_Unwind_SjLj_Key] 80 str v1, [a1, #116] @ save SjLj unwind top handler 81 ldr v1, [a2, #116] @ load new SjLj handler 82 str v1, [a4, #72] @ store it to TLS 83 69 84 mov a1, a3 @ use third arg as return value after jump 70 85 @ and as first arg in context function 71 86 ldmia a2, {v1-v8,sp-pc} @ restore v1-V8,SP-PC -
libs/context/src/asm/jump_arm_aapcs_pe_armasm.asm
12 12 ; * ------------------------------------------------------------- * 13 13 ; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| * 14 14 ; * ------------------------------------------------------------- * 15 ; * | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr| *15 ; * | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | lr | sp | * 16 16 ; * ------------------------------------------------------------- * 17 17 ; * ------------------------------------------------------------- * 18 18 ; * | 10 | | * … … 50 50 EXPORT jump_fcontext 51 51 52 52 jump_fcontext PROC 53 stmia a1, {r4-r11,sp-lr} ; save V1-V8,SP-LR 54 str lr, [a1,#40] ; save LR as PC 53 stmia a1, {r4-r11,lr} ; save V1-V8,LR 54 str sp, [a1,#0x24] ; save SP separately - Thumb cannot handle stmia {sp-pc} 55 str lr, [a1,#0x28] ; save LR as PC 55 56 56 mov a1, a3 ; use third arg as return value after jump57 ; and as first arg in context function58 ldmia a2, {r4-r11,sp-pc} ; restore v1-V8,SP-PC57 ; load TIB to save/restore thread size and limit. 58 ; we do not need preserveCPU flag and can use it's arg register 59 mrc p15, #0, a4, c13, c0, #2 59 60 61 ldr r4, [a4,#0x04] ; current stack base 62 ldr r5, [a4,#0x08] ; current stack limit 63 sub r5, r4, r5 ; size = base - limit 64 str r4, [a1,#0x2c] ; save stack base 65 str r5, [a1,#0x30] ; save stack size 66 67 ldr r4, [a2,#0x2c] ; load stack base 68 ldr r5, [a2,#0x30] ; load stack limit 69 sub r5, r4, r5 ; limit = base - size 70 str r4, [a4,#0x04] ; restore stack base 71 str r5, [a4,#0x08] ; restore stack limit 72 73 mov a1, a3 ; use third arg as return value after jump 74 ; and as first arg in context function 75 76 ldmia a2, {r4-r11,lr} ; restore V1-V8,LR 77 ldr sp, [a2,#0x24] 78 ldr pc, [a2,#0x28] 79 60 80 ENDP 61 81 END -
libs/context/src/asm/make_arm_aapcs_macho_gas.S
42 42 * ------------------------------------------------------------- * 43 43 * | s26 | s27 | s28 | s29 | s30 | s31 | | * 44 44 * ------------------------------------------------------------- * 45 * ------------------------------------------------------------- * 46 * | 29 | | * 47 * ------------------------------------------------------------- * 48 * | 0x74| | * 49 * ------------------------------------------------------------- * 50 * | sjlj| | * 51 * ------------------------------------------------------------- * 45 52 * * 46 53 * *****************************************************************/ 47 54 … … 50 57 .align 2 51 58 _make_fcontext: 52 59 mov a4, a1 @ save address of context stack (base) A4 53 sub a1, a1, #1 16@ reserve space for fcontext_t at top of context stack60 sub a1, a1, #120 @ reserve space for fcontext_t at top of context stack 54 61 55 62 @ shift address in A1 to lower 16 byte boundary 56 63 @ == pointer to fcontext_t and address of context stack -
libs/context/src/asm/make_arm_aapcs_pe_armasm.asm
12 12 ; * ------------------------------------------------------------- * 13 13 ; * | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| * 14 14 ; * ------------------------------------------------------------- * 15 ; * | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr| *15 ; * | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | lr | sp | * 16 16 ; * ------------------------------------------------------------- * 17 17 ; * ------------------------------------------------------------- * 18 18 ; * | 10 | | * … … 53 53 54 54 make_fcontext PROC 55 55 mov a4, a1 ; save address of context stack (base) A4 56 sub a1, a1, # 116; reserve space for fcontext_t at top of context stack56 sub a1, a1, #0x74 ; reserve space for fcontext_t at top of context stack 57 57 58 58 ; shift address in A1 to lower 16 byte boundary 59 59 ; == pointer to fcontext_t and address of context stack 60 bic a1, a1, # 1560 bic a1, a1, #0x0f 61 61 62 str a4, [a1,# 44] ; save address of context stack (base) in fcontext_t63 str a2, [a1,# 48] ; save context stack size in fcontext_t64 str a3, [a1,# 40] ; save address of context function in fcontext_t62 str a4, [a1,#0x2c] ; save address of context stack (base) in fcontext_t 63 str a2, [a1,#0x30] ; save context stack size in fcontext_t 64 str a3, [a1,#0x28] ; save address of context function in fcontext_t 65 65 66 str a1, [a1,# 32] ; save address in A4 as stack pointer for context function66 str a1, [a1,#0x24] ; save address in A4 as stack pointer for context function 67 67 68 68 adr a2, finish ; compute abs address of label finish 69 str a2, [a1,# 36]; save address of finish as return address for context function69 str a2, [a1,#0x20] ; save address of finish as return address for context function 70 70 ; entered after context function returns 71 71 72 72 bx lr