Ticket #8266: patch_macosx_context_ppc_v2.patch

File patch_macosx_context_ppc_v2.patch, 36.6 KB (added by marco.serantoni@…, 9 years ago)

i missed jump_combined_sysv_macho_gas.S , sorry

  • libs/context/build/Jamfile.v2

    === modified file 'libs/context/build/Jamfile.v2'
     
    188188     <binary-format>elf
    189189   ;
    190190
     191alias asm_context_sources
     192   : [ make asm/make_ppc32_sysv_macho_gas.o : asm/make_ppc32_sysv_macho_gas.S : @gas ]
     193     [ make asm/jump_ppc32_sysv_macho_gas.o : asm/jump_ppc32_sysv_macho_gas.S : @gas ]
     194   : <address-model>32
     195     <architecture>power
     196     <binary-format>mach-o
     197     <target-os>darwin
     198   ;
     199
    191200# POWERPC_64
    192201alias asm_context_sources
    193202   : asm/make_ppc64_sysv_elf_gas.S
     
    215224     <binary-format>elf
    216225   ;
    217226
     227alias asm_context_sources
     228   : [ make asm/make_ppc64_sysv_macho_gas.o : asm/make_ppc64_sysv_macho_gas.S : @gas ]
     229     [ make asm/jump_ppc64_sysv_macho_gas.o : asm/jump_ppc64_sysv_macho_gas.S : @gas ]
     230   : <address-model>64
     231     <architecture>power
     232     <binary-format>mach-o
     233     <target-os>darwin
     234   ;
     235
    218236# SPARC
    219237alias asm_context_sources
    220238   : asm/make_sparc_sysv_elf_gas.S
     
    414432   ;
    415433
    416434alias asm_context_sources
     435   : asm/make_i386_x86_64_sysv_macho_gas.S
     436     asm/jump_i386_x86_64_sysv_macho_gas.S
     437   : <address-model>32_64
     438     <architecture>x86
     439     <binary-format>mach-o
     440     <target-os>darwin
     441     <toolset>darwin
     442   ;
     443
     444alias asm_context_sources
     445   : [ make asm/make_i386_x86_64_sysv_macho_gas.o : asm/make_i386_x86_64_sysv_macho_gas.S : @gas ]
     446     [ make asm/jump_i386_x86_64_sysv_macho_gas.o : asm/jump_i386_x86_64_sysv_macho_gas.S : @gas ]
     447   : <address-model>32_64
     448     <architecture>x86
     449     <binary-format>mach-o
     450     <target-os>darwin
     451   ;
     452
     453alias asm_context_sources
    417454   : asm/make_x86_64_ms_pe_masm.asm
    418455     asm/jump_x86_64_ms_pe_masm.asm
    419456     dummy.cpp
     
    424461     <toolset>intel
    425462   ;
    426463
     464#COMBINED
     465
     466alias asm_context_sources
     467   : asm/make_combined_sysv_macho_gas.S
     468     asm/jump_combined_sysv_macho_gas.S
     469   : <architecture>combined
     470     <binary-format>mach-o
     471     <target-os>darwin
     472     <toolset>darwin
     473   ;
     474
     475alias asm_context_sources
     476   : [ make asm/make_combined_sysv_macho_gas.o : asm/make_combined_sysv_macho_gas.S : @gas ]
     477     [ make asm/jump_combined_sysv_macho_gas.o : asm/jump_combined_sysv_macho_gas.S : @gas ]
     478   : <architecture>combined
     479     <binary-format>mach-o
     480     <target-os>darwin
     481   ;
     482
    427483alias asm_context_sources
    428484   : asm/make_x86_64_ms_pe_masm.asm
    429485     asm/jump_x86_64_ms_pe_masm.asm
  • libs/context/build/architecture.jam

    === modified file 'libs/context/build/architecture.jam'
     
    7171        {
    7272            return <architecture>x86 ;
    7373        }
     74        else if [ configure.builds /boost/architecture//ppc : $(properties) : ppc ]
     75        {
     76            return <architecture>ppc ;
     77        }
     78        else if [ configure.builds /boost/architecture//combined : $(properties) : combined ]
     79        {
     80            return <architecture>combined ;
     81        }
    7482    }
    7583}
    7684
  • libs/context/src/asm/jump_combined_sysv_macho_gas.S

    === added file 'libs/context/src/asm/jump_combined_sysv_macho_gas.S'
     
     1/*
     2            Copyright Sergue E. Leontiev 2013.
     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
     8// Stub file for universal binary
     9
     10#if defined(__i386__)
     11    #include "jump_i386_sysv_macho_gas.S"
     12#elif defined(__x86_64__)
     13    #include "jump_x86_64_sysv_macho_gas.S"
     14#elif defined(__ppc__)
     15    #include "jump_ppc32_sysv_macho_gas.S"
     16#elif defined(__ppc64__)
     17    #include "jump_ppc64_sysv_macho_gas.S"
     18#else
     19    #error "No arch's"
     20#endif
  • libs/context/src/asm/jump_ppc32_sysv_macho_gas.S

    === added file 'libs/context/src/asm/jump_ppc32_sysv_macho_gas.S'
     
     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
     8/*******************************************************************
     9 *                                                                 *
     10 *  -------------------------------------------------------------  *
     11 *  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  *
     12 *  -------------------------------------------------------------  *
     13 *  |  0  |  4  |  8  |  12 |  16 |  20 |  24 |  28 |  32 |  36 |  *
     14 *  -------------------------------------------------------------  *
     15 *  | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 |  *
     16 *  -------------------------------------------------------------  *
     17 *  -------------------------------------------------------------  *
     18 *  |  10 |  11 |  12 |  13 |  14 |  15 |  16 |  17 |  18 |  19 |  *
     19 *  -------------------------------------------------------------  *
     20 *  |  40 |  44 |  48 |  52 |  56 |  60 |  64 |  68 |  72 |  76 |  *
     21 *  -------------------------------------------------------------  *
     22 *  | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 |  SP |  *
     23 *  -------------------------------------------------------------  *
     24 *  -------------------------------------------------------------  *
     25 *  |  20 |  21 |  22 |                                         |  *
     26 *  -------------------------------------------------------------  *
     27 *  |  80 |  84 |  88 |                                         |  *
     28 *  -------------------------------------------------------------  *
     29 *  |  CR |  LR |  PC |                                         |  *
     30 *  -------------------------------------------------------------  *
     31 *  -------------------------------------------------------------  *
     32 *  |  23 |  24 |  25 |                                         |  *
     33 *  -------------------------------------------------------------  *
     34 *  |  92 |  96 | 100 |                                         |  *
     35 *  -------------------------------------------------------------  *
     36 *  |  sp | size|<pad>|                                         |  *
     37 *  -------------------------------------------------------------  *
     38 *  -------------------------------------------------------------  *
     39 *  |  26 |  27 |  28 |  29 |  30 |  31 |  32 |  33 |  34 |  35 |  *
     40 *  -------------------------------------------------------------  *
     41 *  | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 |  *
     42 *  -------------------------------------------------------------  *
     43 *  |    F14    |    F15    |    F16    |    F17    |    F18    |  *
     44 *  -------------------------------------------------------------  *
     45 *  -------------------------------------------------------------  *
     46 *  |  36 |  37 |  38 |  39 |  40 |  41 |  42 |  43 |  44 |  45 |  *
     47 *  -------------------------------------------------------------  *
     48 *  | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 |  *
     49 *  -------------------------------------------------------------  *
     50 *  |    F19    |    F20    |    F21    |    F22    |    F23    |  *
     51 *  -------------------------------------------------------------  *
     52 *  -------------------------------------------------------------  *
     53 *  |  46 |  47 |  48 |  49 |  50 |  51 |  52 |  53 |  54 |  55 |  *
     54 *  -------------------------------------------------------------  *
     55 *  | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 |  *
     56 *  -------------------------------------------------------------  *
     57 *  |    F24    |    F25    |    F26    |    F27    |    F28    |  *
     58 *  -------------------------------------------------------------  *
     59 *  -------------------------------------------------------------  *
     60 *  |  56 |  57 |  58 |  59 |  60 |  61 |  62 |  63 |           |  *
     61 *  -------------------------------------------------------------  *
     62 *  | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 |           |  *
     63 *  -------------------------------------------------------------  *
     64 *  |    F29    |    F30    |    F31    |   fpscr   |           |  *
     65 *  -------------------------------------------------------------  *
     66 *                                                                 *
     67 * *****************************************************************/
     68
     69.machine ppc
     70
     71.text
     72.globl _jump_fcontext
     73.align 2
     74_jump_fcontext:
     75    stw     r13,  0(r3)       ; save R13
     76    stw     r14,  4(r3)       ; save R14
     77    stw     r15,  8(r3)       ; save R15
     78    stw     r16,  12(r3)      ; save R16
     79    stw     r17,  16(r3)      ; save R17
     80    stw     r18,  20(r3)      ; save R18
     81    stw     r19,  24(r3)      ; save R19
     82    stw     r20,  28(r3)      ; save R20
     83    stw     r21,  32(r3)      ; save R21
     84    stw     r22,  36(r3)      ; save R22
     85    stw     r23,  40(r3)      ; save R23
     86    stw     r24,  44(r3)      ; save R24
     87    stw     r25,  48(r3)      ; save R25
     88    stw     r26,  52(r3)      ; save R26
     89    stw     r27,  56(r3)      ; save R27
     90    stw     r28,  60(r3)      ; save R28
     91    stw     r29,  64(r3)      ; save R29
     92    stw     r30,  68(r3)      ; save R30
     93    stw     r31,  72(r3)      ; save R31
     94    stw     r1,   76(r3)      ; save SP
     95
     96    mfcr    r0                 ; load CR
     97    stw     r0,   80(r3)      ; save CR
     98    mflr    r0                 ; load LR
     99    stw     r0,   84(r3)      ; save LR
     100    stw     r0,   88(r3)      ; save LR as PC
     101
     102    cmpwi   cr7,   r6,  0      ; test if fpu env should be preserved
     103    beq     cr7,   l1
     104
     105    stfd    f14,  104(r3)     ; save F14
     106    stfd    f15,  112(r3)     ; save F15
     107    stfd    f16,  120(r3)     ; save F16
     108    stfd    f17,  128(r3)     ; save F17
     109    stfd    f18,  136(r3)     ; save F18
     110    stfd    f19,  144(r3)     ; save F19
     111    stfd    f20,  152(r3)     ; save F20
     112    stfd    f21,  160(r3)     ; save F21
     113    stfd    f22,  168(r3)     ; save F22
     114    stfd    f23,  176(r3)     ; save F23
     115    stfd    f24,  184(r3)     ; save F24
     116    stfd    f25,  192(r3)     ; save F25
     117    stfd    f26,  200(r3)     ; save F26
     118    stfd    f27,  208(r3)     ; save F27
     119    stfd    f28,  216(r3)     ; save F28
     120    stfd    f29,  224(r3)     ; save F29
     121    stfd    f30,  232(r3)     ; save F30
     122    stfd    f31,  240(r3)     ; save F31
     123    mffs    f0                 ; load FPSCR
     124    stfd    f0,   248(r3)     ; save FPSCR
     125
     126    lfd     f14,  104(r4)     ; restore F14
     127    lfd     f15,  112(r4)     ; restore F15
     128    lfd     f16,  120(r4)     ; restore F16
     129    lfd     f17,  128(r4)     ; restore F17
     130    lfd     f18,  136(r4)     ; restore F18
     131    lfd     f19,  144(r4)     ; restore F19
     132    lfd     f20,  152(r4)     ; restore F20
     133    lfd     f21,  160(r4)     ; restore F21
     134    lfd     f22,  168(r4)     ; restore F22
     135    lfd     f23,  176(r4)     ; restore F23
     136    lfd     f24,  184(r4)     ; restore F24
     137    lfd     f25,  192(r4)     ; restore F25
     138    lfd     f26,  200(r4)     ; restore F26
     139    lfd     f27,  208(r4)     ; restore F27
     140    lfd     f28,  216(r4)     ; restore F28
     141    lfd     f29,  224(r4)     ; restore F29
     142    lfd     f30,  232(r4)     ; restore F30
     143    lfd     f31,  240(r4)     ; restore F31
     144    lfd     f0,   248(r4)     ; load FPSCR
     145    mtfsf   0xff,  f0          ; restore FPSCR
     146l1:
     147
     148    lwz     r13,  0(r4)       ; restore R13
     149    lwz     r14,  4(r4)       ; restore R14
     150    lwz     r15,  8(r4)       ; restore R15
     151    lwz     r16,  12(r4)      ; restore R16
     152    lwz     r17,  16(r4)      ; restore R17
     153    lwz     r18,  20(r4)      ; restore R18
     154    lwz     r19,  24(r4)      ; restore R19
     155    lwz     r20,  28(r4)      ; restore R20
     156    lwz     r21,  32(r4)      ; restore R21
     157    lwz     r22,  36(r4)      ; restore R22
     158    lwz     r23,  40(r4)      ; restore R23
     159    lwz     r24,  44(r4)      ; restore R24
     160    lwz     r25,  48(r4)      ; restore R25
     161    lwz     r26,  52(r4)      ; restore R26
     162    lwz     r27,  56(r4)      ; restore R27
     163    lwz     r28,  60(r4)      ; restore R28
     164    lwz     r29,  64(r4)      ; restore R29
     165    lwz     r30,  68(r4)      ; restore R30
     166    lwz     r31,  72(r4)      ; restore R31
     167    lwz     r1,   76(r4)      ; restore SP
     168
     169    lwz     r0,   80(r4)      ; load CR
     170    mtcr    r0                 ; restore CR
     171    lwz     r0,   84(r4)      ; load LR
     172    mtlr    r0                 ; restore LR
     173
     174    mr      r3,   r5          ; use third arg as return value after jump
     175                                ; and as first arg in context function
     176
     177    lwz     r0,   88(r4)      ; load PC
     178    mtctr   r0                 ; restore CTR
     179
     180    bctr                        ; jump to context
  • libs/context/src/asm/jump_ppc64_sysv_macho_gas.S

    === added file 'libs/context/src/asm/jump_ppc64_sysv_macho_gas.S'
     
     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
     8/*******************************************************************
     9 *                                                                 *
     10 *  -------------------------------------------------------------  *
     11 *  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  *
     12 *  -------------------------------------------------------------  *
     13 *  |  0  |  4  |   8 |  12 |  16 |  20 |  24 |  28 |  32 |  36 |  *
     14 *  -------------------------------------------------------------  *
     15 *  |    R13    |    R14    |    R15    |    R16    |    R17    |  *
     16 *  -------------------------------------------------------------  *
     17 *  -------------------------------------------------------------  *
     18 *  |  10 |  11 |  12 |  13 |  14 |  15 |  16 |  17 |  18 |  19 |  *
     19 *  -------------------------------------------------------------  *
     20 *  |  40 |  44 |  48 |  52 |  56 |  60 |  64 |  68 |  72 |  76 |  *
     21 *  -------------------------------------------------------------  *
     22 *  |    R18    |    R19    |    R20    |    R21    |    R22    |  *
     23 *  -------------------------------------------------------------  *
     24 *  -------------------------------------------------------------  *
     25 *  |  20 |  21 |  22 |  23 |  24 |  25 |  26 |  27 |  28 |  29 |  *
     26 *  -------------------------------------------------------------  *
     27 *  |  80 |  84 |  88 |  92 |  96 | 100 | 104 | 108 | 112 | 116 |  *
     28 *  -------------------------------------------------------------  *
     29 *  |    R23    |    R24    |    R25    |    R26    |    R27    |  *
     30 *  -------------------------------------------------------------  *
     31 *  -------------------------------------------------------------  *
     32 *  |  30 |  31 |  32 |  33 |  34 |  35 |  36 |  37 |  38 |  39 |  *
     33 *  -------------------------------------------------------------  *
     34 *  | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 |  *
     35 *  -------------------------------------------------------------  *
     36 *  |    R28    |    R29    |    R30    |    R31    |     SP    |  *
     37 *  -------------------------------------------------------------  *
     38 *  -------------------------------------------------------------  *
     39 *  |  40 |  41 |  42 |  43 |  44 |  45 |                       |  *
     40 *  -------------------------------------------------------------  *
     41 *  | 160 | 164 | 168 | 172 | 176 | 180 |                       |  *
     42 *  -------------------------------------------------------------  *
     43 *  |    CR     |    LR     |     PC    |                       |  *
     44 *  -------------------------------------------------------------  *
     45 *  -------------------------------------------------------------  *
     46 *  |  46 |  47 |  48 |  49 |                                   |  *
     47 *  -------------------------------------------------------------  *
     48 *  | 184 | 188 | 192 | 196 |                                   |  *
     49 *  -------------------------------------------------------------  *
     50 *  |    sp     |    size   |                                   |  *
     51 *  -------------------------------------------------------------  *
     52 *  -------------------------------------------------------------  *
     53 *  |  50 |  51 |  52 |  53 |  54 |  55 |  56 |  57 |  58 |  59 |  *
     54 *  -------------------------------------------------------------  *
     55 *  | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 |  *
     56 *  -------------------------------------------------------------  *
     57 *  |    F14    |    F15    |    F16    |    F17    |    F18    |  *
     58 *  -------------------------------------------------------------  *
     59 *  -------------------------------------------------------------  *
     60 *  |  60 |  61 |  62 |  63 |  64 |  65 |  66 |  67 |  68 |  69 |  *
     61 *  -------------------------------------------------------------  *
     62 *  | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 |  *
     63 *  -------------------------------------------------------------  *
     64 *  |    F19    |    F20    |    F21    |    F22    |    F23    |  *
     65 *  -------------------------------------------------------------  *
     66 *  -------------------------------------------------------------  *
     67 *  |  70 |  71 |  72 |  73 |  74 |  75 |  76 |  77 |  78 |  79 |  *
     68 *  -------------------------------------------------------------  *
     69 *  | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 |  *
     70 *  -------------------------------------------------------------  *
     71 *  |    F24    |    F25    |    F26    |    F27    |    F28    |  *
     72 *  -------------------------------------------------------------  *
     73 *  -------------------------------------------------------------  *
     74 *  |  80 |  81 |  82 |  83 |  84 |  85 |  86 |  87 |           |  *
     75 *  -------------------------------------------------------------  *
     76 *  | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 |           |  *
     77 *  -------------------------------------------------------------  *
     78 *  |    F29    |    F30    |    F31    |   fpscr   |           |  *
     79 *  -------------------------------------------------------------  *
     80 *                                                                 *
     81 * *****************************************************************/
     82
     83.text
     84.align 2
     85.globl jump_fcontext
     86
     87_jump_fcontext:
     88    std     r13,  0(r3)       ; save R13
     89    std     r14,  8(r3)       ; save R14
     90    std     r15,  16(r3)      ; save R15
     91    std     r16,  24(r3)      ; save R16
     92    std     r17,  32(r3)      ; save R17
     93    std     r18,  40(r3)      ; save R18
     94    std     r19,  48(r3)      ; save R19
     95    std     r20,  56(r3)      ; save R20
     96    std     r21,  64(r3)      ; save R21
     97    std     r22,  72(r3)      ; save R22
     98    std     r23,  80(r3)      ; save R23
     99    std     r24,  88(r3)      ; save R24
     100    std     r25,  96(r3)      ; save R25
     101    std     r26,  104(r3)     ; save R26
     102    std     r27,  112(r3)     ; save R27
     103    std     r28,  120(r3)     ; save R28
     104    std     r29,  128(r3)     ; save R29
     105    std     r30,  136(r3)     ; save R30
     106    std     r31,  144(r3)     ; save R31
     107    std     r1,   152(r3)     ; save SP
     108
     109    mfcr    r0                 ; load CR
     110    std     r0,   160(r3)     ; save CR
     111    mflr    r0                 ; load LR
     112    std     r0,   168(r3)     ; save LR
     113    std     r0,   176(r3)     ; save LR as PC
     114
     115    cmpwi   cr7,   r6,  0      ; test if fpu env should be preserved
     116    beq     cr7,   l1
     117
     118    stfd    f14,  200(r3)     ; save F14
     119    stfd    f15,  208(r3)     ; save F15
     120    stfd    f16,  216(r3)     ; save F16
     121    stfd    f17,  224(r3)     ; save F17
     122    stfd    f18,  232(r3)     ; save F18
     123    stfd    f19,  240(r3)     ; save F19
     124    stfd    f20,  248(r3)     ; save F20
     125    stfd    f21,  256(r3)     ; save F21
     126    stfd    f22,  264(r3)     ; save F22
     127    stfd    f23,  272(r3)     ; save F23
     128    stfd    f24,  280(r3)     ; save F24
     129    stfd    f25,  288(r3)     ; save F25
     130    stfd    f26,  296(r3)     ; save F26
     131    stfd    f27,  304(r3)     ; save F27
     132    stfd    f28,  312(r3)     ; save F28
     133    stfd    f29,  320(r3)     ; save F29
     134    stfd    f30,  328(r3)     ; save F30
     135    stfd    f31,  336(r3)     ; save F31
     136    mffs    f0                 ; load FPSCR
     137    stfd    f0,   344(r3)     ; save FPSCR
     138
     139    lfd     f14,  200(r4)     ; restore F14
     140    lfd     f15,  208(r4)     ; restore F15
     141    lfd     f16,  216(r4)     ; restore F16
     142    lfd     f17,  224(r4)     ; restore F17
     143    lfd     f18,  232(r4)     ; restore F18
     144    lfd     f19,  240(r4)     ; restore F19
     145    lfd     f20,  248(r4)     ; restore F20
     146    lfd     f21,  256(r4)     ; restore F21
     147    lfd     f22,  264(r4)     ; restore F22
     148    lfd     f23,  272(r4)     ; restore F23
     149    lfd     f24,  280(r4)     ; restore F24
     150    lfd     f25,  288(r4)     ; restore F25
     151    lfd     f26,  296(r4)     ; restore F26
     152    lfd     f27,  304(r4)     ; restore F27
     153    lfd     f28,  312(r4)     ; restore F28
     154    lfd     f29,  320(r4)     ; restore F29
     155    lfd     f30,  328(r4)     ; restore F30
     156    lfd     f31,  336(r4)     ; restore F31
     157    lfd     f0,   344(r4)     ; load FPSCR
     158    mtfsf   0xff,  f0          ; restore FPSCR
     159l1:
     160
     161    ld      r13,  0(r4)       ; restore R13
     162    ld      r14,  8(r4)       ; restore R14
     163    ld      r15,  16(r4)      ; restore R15
     164    ld      r16,  24(r4)      ; restore R16
     165    ld      r17,  32(r4)      ; restore R17
     166    ld      r18,  40(r4)      ; restore R18
     167    ld      r19,  48(r4)      ; restore R19
     168    ld      r20,  56(r4)      ; restore R20
     169    ld      r21,  64(r4)      ; restore R21
     170    ld      r22,  72(r4)      ; restore R22
     171    ld      r23,  80(r4)      ; restore R23
     172    ld      r24,  88(r4)      ; restore R24
     173    ld      r25,  96(r4)      ; restore R25
     174    ld      r26,  104(r4)     ; restore R26
     175    ld      r27,  112(r4)     ; restore R27
     176    ld      r28,  120(r4)     ; restore R28
     177    ld      r29,  128(r4)     ; restore R29
     178    ld      r30,  136(r4)     ; restore r30
     179    ld      r31,  144(r4)     ; restore r31
     180    ld      r1,   152(r4)     ; restore SP
     181
     182    ld      r0,   160(r4)     ; load CR
     183    mtcr    r0                 ; restore CR
     184    ld      r0,   168(r4)     ; load LR
     185    mtlr    r0                 ; restore LR
     186
     187    mr      r3,   r5          ; use third arg as return value after jump
     188                                ; and as first arg in context function
     189
     190    ld      r0,   176(r4)     ; load PC
     191    mtctr   r0                 ; restore CTR
     192
     193    bctr                        ; jump to context
  • libs/context/src/asm/make_combined_sysv_macho_gas.S

    === added file 'libs/context/src/asm/make_combined_sysv_macho_gas.S'
     
     1/*
     2            Copyright Sergue E. Leontiev 2013.
     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
     8// Stub file for universal binary
     9
     10#if defined(__i386__)
     11    #include "make_i386_sysv_macho_gas.S"
     12#elif defined(__x86_64__)
     13    #include "make_x86_64_sysv_macho_gas.S"
     14#elif defined(__ppc__)
     15    #include "make_ppc32_sysv_macho_gas.S"
     16#elif defined(__ppc64__)
     17    #include "make_ppc64_sysv_macho_gas.S"
     18#else
     19    #error "No arch's"
     20#endif
  • libs/context/src/asm/make_ppc32_sysv_macho_gas.S

    === added file 'libs/context/src/asm/make_ppc32_sysv_macho_gas.S'
     
     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
     8/*******************************************************************
     9 *                                                                 *
     10 *  -------------------------------------------------------------  *
     11 *  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  *
     12 *  -------------------------------------------------------------  *
     13 *  |  0  |  4  |  8  |  12 |  16 |  20 |  24 |  28 |  32 |  36 |  *
     14 *  -------------------------------------------------------------  *
     15 *  | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 |  *
     16 *  -------------------------------------------------------------  *
     17 *  -------------------------------------------------------------  *
     18 *  |  10 |  11 |  12 |  13 |  14 |  15 |  16 |  17 |  18 |  19 |  *
     19 *  -------------------------------------------------------------  *
     20 *  |  40 |  44 |  48 |  52 |  56 |  60 |  64 |  68 |  72 |  76 |  *
     21 *  -------------------------------------------------------------  *
     22 *  | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 |  SP |  *
     23 *  -------------------------------------------------------------  *
     24 *  -------------------------------------------------------------  *
     25 *  |  20 |  21 |  22 |                                         |  *
     26 *  -------------------------------------------------------------  *
     27 *  |  80 |  84 |  88 |                                         |  *
     28 *  -------------------------------------------------------------  *
     29 *  |  CR |  LR |  PC |                                         |  *
     30 *  -------------------------------------------------------------  *
     31 *  -------------------------------------------------------------  *
     32 *  |  23 |  24 |  25 |                                         |  *
     33 *  -------------------------------------------------------------  *
     34 *  |  92 |  96 | 100 |                                         |  *
     35 *  -------------------------------------------------------------  *
     36 *  |  sp | size|<pad>|                                         |  *
     37 *  -------------------------------------------------------------  *
     38 *  -------------------------------------------------------------  *
     39 *  |  26 |  27 |  28 |  29 |  30 |  31 |  32 |  33 |  34 |  35 |  *
     40 *  -------------------------------------------------------------  *
     41 *  | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 |  *
     42 *  -------------------------------------------------------------  *
     43 *  |    F14    |    F15    |    F16    |    F17    |    F18    |  *
     44 *  -------------------------------------------------------------  *
     45 *  -------------------------------------------------------------  *
     46 *  |  36 |  37 |  38 |  39 |  40 |  41 |  42 |  43 |  44 |  45 |  *
     47 *  -------------------------------------------------------------  *
     48 *  | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 |  *
     49 *  -------------------------------------------------------------  *
     50 *  |    F19    |    F20    |    F21    |    F22    |    F23    |  *
     51 *  -------------------------------------------------------------  *
     52 *  -------------------------------------------------------------  *
     53 *  |  46 |  47 |  48 |  49 |  50 |  51 |  52 |  53 |  54 |  55 |  *
     54 *  -------------------------------------------------------------  *
     55 *  | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 |  *
     56 *  -------------------------------------------------------------  *
     57 *  |    F24    |    F25    |    F26    |    F27    |    F28    |  *
     58 *  -------------------------------------------------------------  *
     59 *  -------------------------------------------------------------  *
     60 *  |  56 |  57 |  58 |  59 |  60 |  61 |  62 |  63 |           |  *
     61 *  -------------------------------------------------------------  *
     62 *  | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 |           |  *
     63 *  -------------------------------------------------------------  *
     64 *  |    F29    |    F30    |    F31    |   fpscr   |           |  *
     65 *  -------------------------------------------------------------  *
     66 *                                                                 *
     67 * *****************************************************************/
     68
     69.text
     70.globl _make_fcontext
     71.align 2
     72_make_fcontext:
     73    mflr    r6                 ; save return address into R6
     74
     75    mr      r0, r3
     76    subi    r3, r3, 256       ; reserve space for fcontext_t at top of context stack
     77
     78    ; call align_stack, R3 contains address at 16 byte boundary after return
     79    ; == pointer to fcontext_t and address of context stack
     80    clrrwi  r3, r3, 4
     81
     82    stw     r0, 92(r3)        ; save address of context stack (base) in fcontext_t
     83    stw     r4, 96(r3)        ; save context stack size in fcontext_t
     84    stw     r5, 88(r3)        ; save address of context function in fcontext_t
     85
     86    subi    r0, r3, 64        ; reserve 64 bytes (linkage + parameter area), R4 % 16 == 0
     87    stw     r0, 76(r3)        ; save address in R3 as stack pointer for context function
     88
     89    mflr    r0                 ; load LR
     90    bl      l1                  ; jump to label 1
     91l1:
     92    mflr    r4                      ; load LR into R4
     93    addi    r4, r4, lo16((finish - .)+4)          ; compute abs address of label finish
     94    mtlr    r0                      ; restore LR
     95    stw     r4, 84(r3)             ; save address of finish as return address for context function
     96                                     ; entered after context function returns
     97
     98    mtlr    r6                 ; restore return address from R6
     99
     100    blr
     101
     102finish:
     103    ; SP points to same address as SP on entry of context function
     104    mflr    r0                 ; save return address into R0
     105    stw     r0, 4(r1)         ; save return address on stack, set up stack frame
     106    stwu    r1, -16(r1)       ; allocate stack space, SP % 16 == 0
     107
     108    li      r3,  0             ; exit code is zero
     109    bl      __exit           ; exit application
  • libs/context/src/asm/make_ppc64_sysv_macho_gas.S

    === added file 'libs/context/src/asm/make_ppc64_sysv_macho_gas.S'
     
     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
     8/*******************************************************************
     9 *                                                                 *
     10 *  -------------------------------------------------------------  *
     11 *  |  0  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  *
     12 *  -------------------------------------------------------------  *
     13 *  |  0  |  4  |   8 |  12 |  16 |  20 |  24 |  28 |  32 |  36 |  *
     14 *  -------------------------------------------------------------  *
     15 *  |    R13    |    R14    |    R15    |    R16    |    R17    |  *
     16 *  -------------------------------------------------------------  *
     17 *  -------------------------------------------------------------  *
     18 *  |  10 |  11 |  12 |  13 |  14 |  15 |  16 |  17 |  18 |  19 |  *
     19 *  -------------------------------------------------------------  *
     20 *  |  40 |  44 |  48 |  52 |  56 |  60 |  64 |  68 |  72 |  76 |  *
     21 *  -------------------------------------------------------------  *
     22 *  |    R18    |    R19    |    R20    |    R21    |    R22    |  *
     23 *  -------------------------------------------------------------  *
     24 *  -------------------------------------------------------------  *
     25 *  |  20 |  21 |  22 |  23 |  24 |  25 |  26 |  27 |  28 |  29 |  *
     26 *  -------------------------------------------------------------  *
     27 *  |  80 |  84 |  88 |  92 |  96 | 100 | 104 | 108 | 112 | 116 |  *
     28 *  -------------------------------------------------------------  *
     29 *  |    R23    |    R24    |    R25    |    R26    |    R27    |  *
     30 *  -------------------------------------------------------------  *
     31 *  -------------------------------------------------------------  *
     32 *  |  30 |  31 |  32 |  33 |  34 |  35 |  36 |  37 |  38 |  39 |  *
     33 *  -------------------------------------------------------------  *
     34 *  | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 |  *
     35 *  -------------------------------------------------------------  *
     36 *  |    R28    |    R29    |    R30    |    R31    |     SP    |  *
     37 *  -------------------------------------------------------------  *
     38 *  -------------------------------------------------------------  *
     39 *  |  40 |  41 |  42 |  43 |  44 |  45 |                       |  *
     40 *  -------------------------------------------------------------  *
     41 *  | 160 | 164 | 168 | 172 | 176 | 180 |                       |  *
     42 *  -------------------------------------------------------------  *
     43 *  |    CR     |    LR     |     PC    |                       |  *
     44 *  -------------------------------------------------------------  *
     45 *  -------------------------------------------------------------  *
     46 *  |  46 |  47 |  48 |  49 |                                   |  *
     47 *  -------------------------------------------------------------  *
     48 *  | 184 | 188 | 192 | 196 |                                   |  *
     49 *  -------------------------------------------------------------  *
     50 *  |    sp     |    size   |                                   |  *
     51 *  -------------------------------------------------------------  *
     52 *  -------------------------------------------------------------  *
     53 *  |  50 |  51 |  52 |  53 |  54 |  55 |  56 |  57 |  58 |  59 |  *
     54 *  -------------------------------------------------------------  *
     55 *  | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 |  *
     56 *  -------------------------------------------------------------  *
     57 *  |    F14    |    F15    |    F16    |    F17    |    F18    |  *
     58 *  -------------------------------------------------------------  *
     59 *  -------------------------------------------------------------  *
     60 *  |  60 |  61 |  62 |  63 |  64 |  65 |  66 |  67 |  68 |  69 |  *
     61 *  -------------------------------------------------------------  *
     62 *  | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 |  *
     63 *  -------------------------------------------------------------  *
     64 *  |    F19    |    F20    |    F21    |    F22    |    F23    |  *
     65 *  -------------------------------------------------------------  *
     66 *  -------------------------------------------------------------  *
     67 *  |  70 |  71 |  72 |  73 |  74 |  75 |  76 |  77 |  78 |  79 |  *
     68 *  -------------------------------------------------------------  *
     69 *  | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 |  *
     70 *  -------------------------------------------------------------  *
     71 *  |    F24    |    F25    |    F26    |    F27    |    F28    |  *
     72 *  -------------------------------------------------------------  *
     73 *  -------------------------------------------------------------  *
     74 *  |  80 |  81 |  82 |  83 |  84 |  85 |  86 |  87 |           |  *
     75 *  -------------------------------------------------------------  *
     76 *  | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 |           |  *
     77 *  -------------------------------------------------------------  *
     78 *  |    F29    |    F30    |    F31    |   fpscr   |           |  *
     79 *  -------------------------------------------------------------  *
     80 *                                                                 *
     81 * *****************************************************************/
     82
     83.text
     84.globl _make_fcontext
     85_make_fcontext:
     86    mflr    r6                 ; save return address into R6
     87
     88    mr      r0, r3
     89    subi    r3, r3, 352       ; reserve space for fcontext_t at top of context stack
     90
     91    ; call align_stack, R3 contains address at 16 byte boundary after return
     92    ; == pointer to fcontext_t and address of context stack
     93    clrrdi  r3, r3, 4
     94
     95    std     r0, 184(r3)       ; save address of context stack (base) in fcontext_t
     96    std     r4, 192(r3)       ; save context stack size in fcontext_t
     97    std     r5, 176(r3)       ; save address of context function in fcontext_t
     98
     99    subi    r0, r3, 64        ; 64 bytes on stack for parameter area (== 8 registers)
     100    std     r0, 152(r3)       ; save the stack base
     101
     102    mflr    r0                 ; load LR
     103    bl      l1                  ; jump to label 1
     104l1:
     105    mflr    r4                      ; load LR into R4
     106    addi    r4, r4,  lo16((finish - .) + 4)    ; compute abs address of label finish
     107    mtlr    r0                      ; restore LR
     108    std     r4, 168(r3)            ; save address of finish as return address for context function
     109                                     ; entered after context function returns
     110
     111    mtlr    r6                 ; restore return address from R6
     112
     113    blr
     114
     115finish:
     116    ; SP points to same address as SP on entry of context function
     117    mflr    r0                 ; save return address into R0
     118    stw     r0, 8(r1)         ; save return address on stack, set up stack frame
     119    stwu    r1, -32(r1)       ; allocate stack space, SP % 16 == 0
     120
     121    li      r3,  0             ; set return value to zero
     122    bl      __exit               ; exit application
     123    nop