support adn fixes for iOS/ARM

This commit is contained in:
Oliver Kowalke 2013-12-04 06:43:59 +01:00
parent 597f40dd06
commit f201ec576d
6 changed files with 108 additions and 7 deletions

View File

@ -127,6 +127,13 @@ alias asm_context_sources
<toolset>darwin
;
alias asm_context_sources
: [ make asm/make_arm_aapcs_macho_gas.o : asm/make_arm_aapcs_macho_gas.S : @gas ]
[ make asm/jump_arm_aapcs_macho_gas.o : asm/jump_arm_aapcs_macho_gas.S : @gas ]
: <architecture>arm
<target-os>iphone
;
alias asm_context_sources
: [ make asm/make_arm_aapcs_pe_armasm.o : asm/make_arm_aapcs_pe_armasm.asm : @armasm ]
[ make asm/jump_arm_aapcs_pe_armasm.o : asm/jump_arm_aapcs_pe_armasm.asm : @armasm ]

View File

@ -8,9 +8,9 @@
[section:acknowledgements Acknowledgments]
I'd like to thank Adreas Fett, Artyom Beilis, Daniel Larimer, David Deakins,
Fernando Pelliccioni, Giovanni Piero Deretta, Gordon Woodhull, Helge Bahmann,
Holger Grund, Jeffrey Lee Hellrung (Jr.), Keith Jeffery, Martin Husemann,
Phil Endecott, Robert Stewart, Sergey Cheban, Steven Watanabe,
Vicente J. Botet Escriba, Wayne Piekarski.
Evgeny Shapovalov, Fernando Pelliccioni, Giovanni Piero Deretta, Gordon
Woodhull, Helge Bahmann, Holger Grund, Jeffrey Lee Hellrung (Jr.), Keith
Jeffery, Martin Husemann, Phil Endecott, Robert Stewart, Sergey Cheban, Steven
Watanabe, Vicente J. Botet Escriba, Wayne Piekarski.
[endsect]

View File

@ -0,0 +1,70 @@
// Copyright Oliver Kowalke 2009.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H
#define BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H
#include <cstddef>
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#include <boost/context/detail/config.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace context {
extern "C" {
#define BOOST_CONTEXT_CALLDECL
struct stack_t
{
void * sp;
std::size_t size;
stack_t() :
sp( 0), size( 0)
{}
};
struct fp_t
{
boost::uint32_t fc_freg[16];
fp_t() :
fc_freg()
{}
};
struct fcontext_t
{
boost::uint32_t fc_greg[11];
stack_t fc_stack;
fp_t fc_fp;
void * fc_unwind_sjlj;
fcontext_t() :
fc_greg(),
fc_stack(),
fc_fp(),
fc_unwind_sjlj( 0)
{}
};
}
}}
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_CONTEXT_DETAIL_FCONTEXT_ARM_MAC_H

View File

@ -49,7 +49,11 @@ typedef int intptr_t;
// arm
#elif defined(__arm__) || defined(__thumb__) || defined(__TARGET_ARCH_ARM) \
|| defined(__TARGET_ARCH_THUMB) || defined(_ARM) || defined(_M_ARM)
# include <boost/context/detail/fcontext_arm.hpp>
# if defined(__MACH__) && defined(__APPLE__)
# include <boost/context/detail/fcontext_arm_mac.hpp>
# else
# include <boost/context/detail/fcontext_arm.hpp>
# endif
// mips
#elif (defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) \
|| defined(_R3000)

View File

@ -42,6 +42,12 @@
* ------------------------------------------------------------- *
* | s26 | s27 | s28 | s29 | s30 | s31 | | *
* ------------------------------------------------------------- *
* | 29 | | *
* ------------------------------------------------------------- *
* | 0x74| | *
* ------------------------------------------------------------- *
* | sjlj| | *
* ------------------------------------------------------------- *
* *
* *****************************************************************/
@ -66,6 +72,14 @@ _jump_fcontext:
1:
#endif
mrc p15, 0, a4, c13, c0, #3 @ locate TLS to save/restore SjLj handler
bic a4, a4, #3
ldr v1, [a4, #72] @ load TLS[__PTK_LIBC_DYLD_Unwind_SjLj_Key]
str v1, [a1, #116] @ save SjLj unwind top handler
ldr v1, [a2, #116] @ load new SjLj handler
str v1, [a4, #72] @ store it to TLS
mov a1, a3 @ use third arg as return value after jump
@ and as first arg in context function
ldmia a2, {v1-v8,sp-pc} @ restore v1-V8,SP-PC

View File

@ -42,6 +42,12 @@
* ------------------------------------------------------------- *
* | s26 | s27 | s28 | s29 | s30 | s31 | | *
* ------------------------------------------------------------- *
* | 29 | | *
* ------------------------------------------------------------- *
* | 0x74| | *
* ------------------------------------------------------------- *
* | sjlj| | *
* ------------------------------------------------------------- *
* *
* *****************************************************************/
@ -50,7 +56,7 @@
.align 2
_make_fcontext:
mov a4, a1 @ save address of context stack (base) A4
sub a1, a1, #116 @ reserve space for fcontext_t at top of context stack
sub a1, a1, #120 @ reserve space for fcontext_t at top of context stack
@ shift address in A1 to lower 16 byte boundary
@ == pointer to fcontext_t and address of context stack
@ -60,7 +66,7 @@ _make_fcontext:
str a2, [a1,#48] @ save context stack size in fcontext_t
str a3, [a1,#40] @ save address of context function in fcontext_t
str a1, [a1,#32] @ save address in A4 as stack pointer for context function
str a1, [a1,#32] @ save address in A1 as stack pointer for context function
adr a2, finish @ compute abs address of label finish
str a2, [a1,#36] @ save address of finish as return address for context function