Commit 2c39ea00 authored by Marco Serantoni's avatar Marco Serantoni

[MacOSX] Added support in boost context for PPC processors, now is possible...

[MacOSX] Added support in boost context for PPC processors, now is possible again compile kicad testing for PPC ( https://svn.boost.org/trac/boost/ticket/8266 )
parent 84cf7225
...@@ -201,6 +201,16 @@ ExternalProject_Add( boost ...@@ -201,6 +201,16 @@ ExternalProject_Add( boost
COMMAND bzr add libs/context/src/asm/make_x86_64_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/make_x86_64_ms_pe_gas.S
COMMAND bzr add libs/context/src/asm/jump_x86_64_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/jump_x86_64_ms_pe_gas.S
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/patch_macosx_context_ppc_v2.patch" #https://svn.boost.org/trac/boost/ticket/8266
COMMAND bzr add libs/context/build/Jamfile.v2
COMMAND bzr add libs/context/build/architecture.jam
COMMAND bzr add libs/context/src/asm/jump_combined_sysv_macho_gas.S
COMMAND bzr add libs/context/src/asm/jump_ppc32_sysv_macho_gas.S
COMMAND bzr add libs/context/src/asm/jump_ppc64_sysv_macho_gas.S
COMMAND bzr add libs/context/src/asm/make_combined_sysv_macho_gas.S
COMMAND bzr add libs/context/src/asm/make_ppc32_sysv_macho_gas.S
COMMAND bzr add libs/context/src/asm/make_ppc64_sysv_macho_gas.S
# [Mis-]use this step to erase all the boost headers and libraries before # [Mis-]use this step to erase all the boost headers and libraries before
# replacing them below. # replacing them below.
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}" UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"
......
=== modified file 'libs/context/build/Jamfile.v2'
--- libs/context/build/Jamfile.v2 2013-12-30 19:16:18 +0000
+++ libs/context/build/Jamfile.v2 2014-01-03 18:10:41 +0000
@@ -188,6 +188,15 @@
<binary-format>elf
;
+alias asm_context_sources
+ : [ make asm/make_ppc32_sysv_macho_gas.o : asm/make_ppc32_sysv_macho_gas.S : @gas ]
+ [ make asm/jump_ppc32_sysv_macho_gas.o : asm/jump_ppc32_sysv_macho_gas.S : @gas ]
+ : <address-model>32
+ <architecture>power
+ <binary-format>mach-o
+ <target-os>darwin
+ ;
+
# POWERPC_64
alias asm_context_sources
: asm/make_ppc64_sysv_elf_gas.S
@@ -215,6 +224,15 @@
<binary-format>elf
;
+alias asm_context_sources
+ : [ make asm/make_ppc64_sysv_macho_gas.o : asm/make_ppc64_sysv_macho_gas.S : @gas ]
+ [ make asm/jump_ppc64_sysv_macho_gas.o : asm/jump_ppc64_sysv_macho_gas.S : @gas ]
+ : <address-model>64
+ <architecture>power
+ <binary-format>mach-o
+ <target-os>darwin
+ ;
+
# SPARC
alias asm_context_sources
: asm/make_sparc_sysv_elf_gas.S
@@ -414,6 +432,25 @@
;
alias asm_context_sources
+ : asm/make_i386_x86_64_sysv_macho_gas.S
+ asm/jump_i386_x86_64_sysv_macho_gas.S
+ : <address-model>32_64
+ <architecture>x86
+ <binary-format>mach-o
+ <target-os>darwin
+ <toolset>darwin
+ ;
+
+alias asm_context_sources
+ : [ make asm/make_i386_x86_64_sysv_macho_gas.o : asm/make_i386_x86_64_sysv_macho_gas.S : @gas ]
+ [ make asm/jump_i386_x86_64_sysv_macho_gas.o : asm/jump_i386_x86_64_sysv_macho_gas.S : @gas ]
+ : <address-model>32_64
+ <architecture>x86
+ <binary-format>mach-o
+ <target-os>darwin
+ ;
+
+alias asm_context_sources
: asm/make_x86_64_ms_pe_masm.asm
asm/jump_x86_64_ms_pe_masm.asm
dummy.cpp
@@ -424,6 +461,25 @@
<toolset>intel
;
+#COMBINED
+
+alias asm_context_sources
+ : asm/make_combined_sysv_macho_gas.S
+ asm/jump_combined_sysv_macho_gas.S
+ : <architecture>combined
+ <binary-format>mach-o
+ <target-os>darwin
+ <toolset>darwin
+ ;
+
+alias asm_context_sources
+ : [ make asm/make_combined_sysv_macho_gas.o : asm/make_combined_sysv_macho_gas.S : @gas ]
+ [ make asm/jump_combined_sysv_macho_gas.o : asm/jump_combined_sysv_macho_gas.S : @gas ]
+ : <architecture>combined
+ <binary-format>mach-o
+ <target-os>darwin
+ ;
+
alias asm_context_sources
: asm/make_x86_64_ms_pe_masm.asm
asm/jump_x86_64_ms_pe_masm.asm
=== modified file 'libs/context/build/architecture.jam'
--- libs/context/build/architecture.jam 2013-12-30 19:16:18 +0000
+++ libs/context/build/architecture.jam 2014-01-02 10:47:09 +0000
@@ -71,6 +71,14 @@
{
return <architecture>x86 ;
}
+ else if [ configure.builds /boost/architecture//ppc : $(properties) : ppc ]
+ {
+ return <architecture>ppc ;
+ }
+ else if [ configure.builds /boost/architecture//combined : $(properties) : combined ]
+ {
+ return <architecture>combined ;
+ }
}
}
=== added file 'libs/context/src/asm/jump_combined_sysv_macho_gas.S'
--- libs/context/src/asm/jump_combined_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
+++ libs/context/src/asm/jump_combined_sysv_macho_gas.S 2014-01-03 17:46:02 +0000
@@ -0,0 +1,20 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ 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)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "jump_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "jump_x86_64_sysv_macho_gas.S"
+#elif defined(__ppc__)
+ #include "jump_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "jump_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
=== added file 'libs/context/src/asm/jump_ppc32_sysv_macho_gas.S'
--- libs/context/src/asm/jump_ppc32_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
+++ libs/context/src/asm/jump_ppc32_sysv_macho_gas.S 2014-01-03 15:18:19 +0000
@@ -0,0 +1,180 @@
+/*
+ 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)
+*/
+
+/*******************************************************************
+ * *
+ * ------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
+ * ------------------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
+ * ------------------------------------------------------------- *
+ * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
+ * ------------------------------------------------------------- *
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
+ * ------------------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 20 | 21 | 22 | | *
+ * ------------------------------------------------------------- *
+ * | 80 | 84 | 88 | | *
+ * ------------------------------------------------------------- *
+ * | CR | LR | PC | | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 23 | 24 | 25 | | *
+ * ------------------------------------------------------------- *
+ * | 92 | 96 | 100 | | *
+ * ------------------------------------------------------------- *
+ * | sp | size|<pad>| | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
+ * ------------------------------------------------------------- *
+ * | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | *
+ * ------------------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | F18 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | *
+ * ------------------------------------------------------------- *
+ * | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | *
+ * ------------------------------------------------------------- *
+ * | F19 | F20 | F21 | F22 | F23 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------------------- *
+ * | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------------------- *
+ * | F24 | F25 | F26 | F27 | F28 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | | *
+ * ------------------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | | *
+ * ------------------------------------------------------------- *
+ * | F29 | F30 | F31 | fpscr | | *
+ * ------------------------------------------------------------- *
+ * *
+ * *****************************************************************/
+
+.machine ppc
+
+.text
+.globl _jump_fcontext
+.align 2
+_jump_fcontext:
+ stw r13, 0(r3) ; save R13
+ stw r14, 4(r3) ; save R14
+ stw r15, 8(r3) ; save R15
+ stw r16, 12(r3) ; save R16
+ stw r17, 16(r3) ; save R17
+ stw r18, 20(r3) ; save R18
+ stw r19, 24(r3) ; save R19
+ stw r20, 28(r3) ; save R20
+ stw r21, 32(r3) ; save R21
+ stw r22, 36(r3) ; save R22
+ stw r23, 40(r3) ; save R23
+ stw r24, 44(r3) ; save R24
+ stw r25, 48(r3) ; save R25
+ stw r26, 52(r3) ; save R26
+ stw r27, 56(r3) ; save R27
+ stw r28, 60(r3) ; save R28
+ stw r29, 64(r3) ; save R29
+ stw r30, 68(r3) ; save R30
+ stw r31, 72(r3) ; save R31
+ stw r1, 76(r3) ; save SP
+
+ mfcr r0 ; load CR
+ stw r0, 80(r3) ; save CR
+ mflr r0 ; load LR
+ stw r0, 84(r3) ; save LR
+ stw r0, 88(r3) ; save LR as PC
+
+ cmpwi cr7, r6, 0 ; test if fpu env should be preserved
+ beq cr7, l1
+
+ stfd f14, 104(r3) ; save F14
+ stfd f15, 112(r3) ; save F15
+ stfd f16, 120(r3) ; save F16
+ stfd f17, 128(r3) ; save F17
+ stfd f18, 136(r3) ; save F18
+ stfd f19, 144(r3) ; save F19
+ stfd f20, 152(r3) ; save F20
+ stfd f21, 160(r3) ; save F21
+ stfd f22, 168(r3) ; save F22
+ stfd f23, 176(r3) ; save F23
+ stfd f24, 184(r3) ; save F24
+ stfd f25, 192(r3) ; save F25
+ stfd f26, 200(r3) ; save F26
+ stfd f27, 208(r3) ; save F27
+ stfd f28, 216(r3) ; save F28
+ stfd f29, 224(r3) ; save F29
+ stfd f30, 232(r3) ; save F30
+ stfd f31, 240(r3) ; save F31
+ mffs f0 ; load FPSCR
+ stfd f0, 248(r3) ; save FPSCR
+
+ lfd f14, 104(r4) ; restore F14
+ lfd f15, 112(r4) ; restore F15
+ lfd f16, 120(r4) ; restore F16
+ lfd f17, 128(r4) ; restore F17
+ lfd f18, 136(r4) ; restore F18
+ lfd f19, 144(r4) ; restore F19
+ lfd f20, 152(r4) ; restore F20
+ lfd f21, 160(r4) ; restore F21
+ lfd f22, 168(r4) ; restore F22
+ lfd f23, 176(r4) ; restore F23
+ lfd f24, 184(r4) ; restore F24
+ lfd f25, 192(r4) ; restore F25
+ lfd f26, 200(r4) ; restore F26
+ lfd f27, 208(r4) ; restore F27
+ lfd f28, 216(r4) ; restore F28
+ lfd f29, 224(r4) ; restore F29
+ lfd f30, 232(r4) ; restore F30
+ lfd f31, 240(r4) ; restore F31
+ lfd f0, 248(r4) ; load FPSCR
+ mtfsf 0xff, f0 ; restore FPSCR
+l1:
+
+ lwz r13, 0(r4) ; restore R13
+ lwz r14, 4(r4) ; restore R14
+ lwz r15, 8(r4) ; restore R15
+ lwz r16, 12(r4) ; restore R16
+ lwz r17, 16(r4) ; restore R17
+ lwz r18, 20(r4) ; restore R18
+ lwz r19, 24(r4) ; restore R19
+ lwz r20, 28(r4) ; restore R20
+ lwz r21, 32(r4) ; restore R21
+ lwz r22, 36(r4) ; restore R22
+ lwz r23, 40(r4) ; restore R23
+ lwz r24, 44(r4) ; restore R24
+ lwz r25, 48(r4) ; restore R25
+ lwz r26, 52(r4) ; restore R26
+ lwz r27, 56(r4) ; restore R27
+ lwz r28, 60(r4) ; restore R28
+ lwz r29, 64(r4) ; restore R29
+ lwz r30, 68(r4) ; restore R30
+ lwz r31, 72(r4) ; restore R31
+ lwz r1, 76(r4) ; restore SP
+
+ lwz r0, 80(r4) ; load CR
+ mtcr r0 ; restore CR
+ lwz r0, 84(r4) ; load LR
+ mtlr r0 ; restore LR
+
+ mr r3, r5 ; use third arg as return value after jump
+ ; and as first arg in context function
+
+ lwz r0, 88(r4) ; load PC
+ mtctr r0 ; restore CTR
+
+ bctr ; jump to context
=== added file 'libs/context/src/asm/jump_ppc64_sysv_macho_gas.S'
--- libs/context/src/asm/jump_ppc64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
+++ libs/context/src/asm/jump_ppc64_sysv_macho_gas.S 2014-01-03 17:54:53 +0000
@@ -0,0 +1,193 @@
+/*
+ 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)
+*/
+
+/*******************************************************************
+ * *
+ * ------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
+ * ------------------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
+ * ------------------------------------------------------------- *
+ * | R13 | R14 | R15 | R16 | R17 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
+ * ------------------------------------------------------------- *
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
+ * ------------------------------------------------------------- *
+ * | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
+ * ------------------------------------------------------------- *
+ * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
+ * ------------------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------------------- *
+ * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------------------- *
+ * | R28 | R29 | R30 | R31 | SP | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | | *
+ * ------------------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | | *
+ * ------------------------------------------------------------- *
+ * | CR | LR | PC | | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 46 | 47 | 48 | 49 | | *
+ * ------------------------------------------------------------- *
+ * | 184 | 188 | 192 | 196 | | *
+ * ------------------------------------------------------------- *
+ * | sp | size | | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
+ * ------------------------------------------------------------- *
+ * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
+ * ------------------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | F18 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
+ * ------------------------------------------------------------- *
+ * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
+ * ------------------------------------------------------------- *
+ * | F19 | F20 | F21 | F22 | F23 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
+ * ------------------------------------------------------------- *
+ * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
+ * ------------------------------------------------------------- *
+ * | F24 | F25 | F26 | F27 | F28 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
+ * ------------------------------------------------------------- *
+ * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
+ * ------------------------------------------------------------- *
+ * | F29 | F30 | F31 | fpscr | | *
+ * ------------------------------------------------------------- *
+ * *
+ * *****************************************************************/
+
+.text
+.align 2
+.globl jump_fcontext
+
+_jump_fcontext:
+ std r13, 0(r3) ; save R13
+ std r14, 8(r3) ; save R14
+ std r15, 16(r3) ; save R15
+ std r16, 24(r3) ; save R16
+ std r17, 32(r3) ; save R17
+ std r18, 40(r3) ; save R18
+ std r19, 48(r3) ; save R19
+ std r20, 56(r3) ; save R20
+ std r21, 64(r3) ; save R21
+ std r22, 72(r3) ; save R22
+ std r23, 80(r3) ; save R23
+ std r24, 88(r3) ; save R24
+ std r25, 96(r3) ; save R25
+ std r26, 104(r3) ; save R26
+ std r27, 112(r3) ; save R27
+ std r28, 120(r3) ; save R28
+ std r29, 128(r3) ; save R29
+ std r30, 136(r3) ; save R30
+ std r31, 144(r3) ; save R31
+ std r1, 152(r3) ; save SP
+
+ mfcr r0 ; load CR
+ std r0, 160(r3) ; save CR
+ mflr r0 ; load LR
+ std r0, 168(r3) ; save LR
+ std r0, 176(r3) ; save LR as PC
+
+ cmpwi cr7, r6, 0 ; test if fpu env should be preserved
+ beq cr7, l1
+
+ stfd f14, 200(r3) ; save F14
+ stfd f15, 208(r3) ; save F15
+ stfd f16, 216(r3) ; save F16
+ stfd f17, 224(r3) ; save F17
+ stfd f18, 232(r3) ; save F18
+ stfd f19, 240(r3) ; save F19
+ stfd f20, 248(r3) ; save F20
+ stfd f21, 256(r3) ; save F21
+ stfd f22, 264(r3) ; save F22
+ stfd f23, 272(r3) ; save F23
+ stfd f24, 280(r3) ; save F24
+ stfd f25, 288(r3) ; save F25
+ stfd f26, 296(r3) ; save F26
+ stfd f27, 304(r3) ; save F27
+ stfd f28, 312(r3) ; save F28
+ stfd f29, 320(r3) ; save F29
+ stfd f30, 328(r3) ; save F30
+ stfd f31, 336(r3) ; save F31
+ mffs f0 ; load FPSCR
+ stfd f0, 344(r3) ; save FPSCR
+
+ lfd f14, 200(r4) ; restore F14
+ lfd f15, 208(r4) ; restore F15
+ lfd f16, 216(r4) ; restore F16
+ lfd f17, 224(r4) ; restore F17
+ lfd f18, 232(r4) ; restore F18
+ lfd f19, 240(r4) ; restore F19
+ lfd f20, 248(r4) ; restore F20
+ lfd f21, 256(r4) ; restore F21
+ lfd f22, 264(r4) ; restore F22
+ lfd f23, 272(r4) ; restore F23
+ lfd f24, 280(r4) ; restore F24
+ lfd f25, 288(r4) ; restore F25
+ lfd f26, 296(r4) ; restore F26
+ lfd f27, 304(r4) ; restore F27
+ lfd f28, 312(r4) ; restore F28
+ lfd f29, 320(r4) ; restore F29
+ lfd f30, 328(r4) ; restore F30
+ lfd f31, 336(r4) ; restore F31
+ lfd f0, 344(r4) ; load FPSCR
+ mtfsf 0xff, f0 ; restore FPSCR
+l1:
+
+ ld r13, 0(r4) ; restore R13
+ ld r14, 8(r4) ; restore R14
+ ld r15, 16(r4) ; restore R15
+ ld r16, 24(r4) ; restore R16
+ ld r17, 32(r4) ; restore R17
+ ld r18, 40(r4) ; restore R18
+ ld r19, 48(r4) ; restore R19
+ ld r20, 56(r4) ; restore R20
+ ld r21, 64(r4) ; restore R21
+ ld r22, 72(r4) ; restore R22
+ ld r23, 80(r4) ; restore R23
+ ld r24, 88(r4) ; restore R24
+ ld r25, 96(r4) ; restore R25
+ ld r26, 104(r4) ; restore R26
+ ld r27, 112(r4) ; restore R27
+ ld r28, 120(r4) ; restore R28
+ ld r29, 128(r4) ; restore R29
+ ld r30, 136(r4) ; restore r30
+ ld r31, 144(r4) ; restore r31
+ ld r1, 152(r4) ; restore SP
+
+ ld r0, 160(r4) ; load CR
+ mtcr r0 ; restore CR
+ ld r0, 168(r4) ; load LR
+ mtlr r0 ; restore LR
+
+ mr r3, r5 ; use third arg as return value after jump
+ ; and as first arg in context function
+
+ ld r0, 176(r4) ; load PC
+ mtctr r0 ; restore CTR
+
+ bctr ; jump to context
=== added file 'libs/context/src/asm/make_combined_sysv_macho_gas.S'
--- libs/context/src/asm/make_combined_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
+++ libs/context/src/asm/make_combined_sysv_macho_gas.S 2014-01-03 17:50:32 +0000
@@ -0,0 +1,20 @@
+/*
+ Copyright Sergue E. Leontiev 2013.
+ 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)
+*/
+
+// Stub file for universal binary
+
+#if defined(__i386__)
+ #include "make_i386_sysv_macho_gas.S"
+#elif defined(__x86_64__)
+ #include "make_x86_64_sysv_macho_gas.S"
+#elif defined(__ppc__)
+ #include "make_ppc32_sysv_macho_gas.S"
+#elif defined(__ppc64__)
+ #include "make_ppc64_sysv_macho_gas.S"
+#else
+ #error "No arch's"
+#endif
=== added file 'libs/context/src/asm/make_ppc32_sysv_macho_gas.S'
--- libs/context/src/asm/make_ppc32_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
+++ libs/context/src/asm/make_ppc32_sysv_macho_gas.S 2014-01-02 21:27:23 +0000
@@ -0,0 +1,109 @@
+/*
+ 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)
+*/
+
+/*******************************************************************
+ * *
+ * ------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
+ * ------------------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
+ * ------------------------------------------------------------- *
+ * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
+ * ------------------------------------------------------------- *
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
+ * ------------------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 20 | 21 | 22 | | *
+ * ------------------------------------------------------------- *
+ * | 80 | 84 | 88 | | *
+ * ------------------------------------------------------------- *
+ * | CR | LR | PC | | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 23 | 24 | 25 | | *
+ * ------------------------------------------------------------- *
+ * | 92 | 96 | 100 | | *
+ * ------------------------------------------------------------- *
+ * | sp | size|<pad>| | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
+ * ------------------------------------------------------------- *
+ * | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | *
+ * ------------------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | F18 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | *
+ * ------------------------------------------------------------- *
+ * | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | *
+ * ------------------------------------------------------------- *
+ * | F19 | F20 | F21 | F22 | F23 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
+ * ------------------------------------------------------------- *
+ * | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
+ * ------------------------------------------------------------- *
+ * | F24 | F25 | F26 | F27 | F28 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | | *
+ * ------------------------------------------------------------- *
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | | *
+ * ------------------------------------------------------------- *
+ * | F29 | F30 | F31 | fpscr | | *
+ * ------------------------------------------------------------- *
+ * *
+ * *****************************************************************/
+
+.text
+.globl _make_fcontext
+.align 2
+_make_fcontext:
+ mflr r6 ; save return address into R6
+
+ mr r0, r3
+ subi r3, r3, 256 ; reserve space for fcontext_t at top of context stack
+
+ ; call align_stack, R3 contains address at 16 byte boundary after return
+ ; == pointer to fcontext_t and address of context stack
+ clrrwi r3, r3, 4
+
+ stw r0, 92(r3) ; save address of context stack (base) in fcontext_t
+ stw r4, 96(r3) ; save context stack size in fcontext_t
+ stw r5, 88(r3) ; save address of context function in fcontext_t
+
+ subi r0, r3, 64 ; reserve 64 bytes (linkage + parameter area), R4 % 16 == 0
+ stw r0, 76(r3) ; save address in R3 as stack pointer for context function
+
+ mflr r0 ; load LR
+ bl l1 ; jump to label 1
+l1:
+ mflr r4 ; load LR into R4
+ addi r4, r4, lo16((finish - .)+4) ; compute abs address of label finish
+ mtlr r0 ; restore LR
+ stw r4, 84(r3) ; save address of finish as return address for context function
+ ; entered after context function returns
+
+ mtlr r6 ; restore return address from R6
+
+ blr
+
+finish:
+ ; SP points to same address as SP on entry of context function
+ mflr r0 ; save return address into R0
+ stw r0, 4(r1) ; save return address on stack, set up stack frame
+ stwu r1, -16(r1) ; allocate stack space, SP % 16 == 0
+
+ li r3, 0 ; exit code is zero
+ bl __exit ; exit application
=== added file 'libs/context/src/asm/make_ppc64_sysv_macho_gas.S'
--- libs/context/src/asm/make_ppc64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
+++ libs/context/src/asm/make_ppc64_sysv_macho_gas.S 2014-01-03 18:04:45 +0000
@@ -0,0 +1,123 @@
+/*
+ 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)
+*/
+
+/*******************************************************************
+ * *
+ * ------------------------------------------------------------- *
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
+ * ------------------------------------------------------------- *
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
+ * ------------------------------------------------------------- *
+ * | R13 | R14 | R15 | R16 | R17 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
+ * ------------------------------------------------------------- *
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
+ * ------------------------------------------------------------- *
+ * | R18 | R19 | R20 | R21 | R22 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
+ * ------------------------------------------------------------- *
+ * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
+ * ------------------------------------------------------------- *
+ * | R23 | R24 | R25 | R26 | R27 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
+ * ------------------------------------------------------------- *
+ * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
+ * ------------------------------------------------------------- *
+ * | R28 | R29 | R30 | R31 | SP | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 40 | 41 | 42 | 43 | 44 | 45 | | *
+ * ------------------------------------------------------------- *
+ * | 160 | 164 | 168 | 172 | 176 | 180 | | *
+ * ------------------------------------------------------------- *
+ * | CR | LR | PC | | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 46 | 47 | 48 | 49 | | *
+ * ------------------------------------------------------------- *
+ * | 184 | 188 | 192 | 196 | | *
+ * ------------------------------------------------------------- *
+ * | sp | size | | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
+ * ------------------------------------------------------------- *
+ * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
+ * ------------------------------------------------------------- *
+ * | F14 | F15 | F16 | F17 | F18 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
+ * ------------------------------------------------------------- *
+ * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
+ * ------------------------------------------------------------- *
+ * | F19 | F20 | F21 | F22 | F23 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
+ * ------------------------------------------------------------- *
+ * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
+ * ------------------------------------------------------------- *
+ * | F24 | F25 | F26 | F27 | F28 | *
+ * ------------------------------------------------------------- *
+ * ------------------------------------------------------------- *
+ * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
+ * ------------------------------------------------------------- *
+ * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
+ * ------------------------------------------------------------- *
+ * | F29 | F30 | F31 | fpscr | | *
+ * ------------------------------------------------------------- *
+ * *
+ * *****************************************************************/
+
+.text
+.globl _make_fcontext
+_make_fcontext:
+ mflr r6 ; save return address into R6
+
+ mr r0, r3
+ subi r3, r3, 352 ; reserve space for fcontext_t at top of context stack
+
+ ; call align_stack, R3 contains address at 16 byte boundary after return
+ ; == pointer to fcontext_t and address of context stack
+ clrrdi r3, r3, 4
+
+ std r0, 184(r3) ; save address of context stack (base) in fcontext_t
+ std r4, 192(r3) ; save context stack size in fcontext_t
+ std r5, 176(r3) ; save address of context function in fcontext_t
+
+ subi r0, r3, 64 ; 64 bytes on stack for parameter area (== 8 registers)
+ std r0, 152(r3) ; save the stack base
+
+ mflr r0 ; load LR
+ bl l1 ; jump to label 1
+l1:
+ mflr r4 ; load LR into R4
+ addi r4, r4, lo16((finish - .) + 4) ; compute abs address of label finish
+ mtlr r0 ; restore LR
+ std r4, 168(r3) ; save address of finish as return address for context function
+ ; entered after context function returns
+
+ mtlr r6 ; restore return address from R6
+
+ blr
+
+finish:
+ ; SP points to same address as SP on entry of context function
+ mflr r0 ; save return address into R0
+ stw r0, 8(r1) ; save return address on stack, set up stack frame
+ stwu r1, -32(r1) ; allocate stack space, SP % 16 == 0
+
+ li r3, 0 ; set return value to zero
+ bl __exit ; exit application
+ nop
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment