Changeset 2262044 in mainline


Ignore:
Timestamp:
2005-11-06T15:38:13Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
894498c
Parents:
2c457e8
Message:

ia64 work.
Heavyweight handler should be complete up to the point where it switches back to interrupted RSE context.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/ia64/src/ivt.S

    r2c457e8 r2262044  
    2828
    2929
    30 /*
     30/** Heavyweight interrupt handler
     31 *
    3132 * This macro roughly follows steps from 1 to 19 described in
    3233 * Intel Itanium Architecture Software Developer's Manual, Chapter 3.4.2.
    3334 *
     35 * HEAVYWEIGHT_HANDLER macro must cram into 16 bundles (48 instructions).
     36 * This goal is achieved by using procedure calls after RSE becomes operational.
     37 *
    3438 * Some steps are skipped (enabling and disabling interrupts).
    3539 * Some steps are not fully supported yet (e.g. interruptions
    36  * from user space and floating-point context).
     40 * from userspace and floating-point context).
    3741 */
    3842.macro HEAVYWEIGHT_HANDLER offs handler
    3943    .org IVT + \offs
    40         SAVE_INTERRUPTED_CONTEXT                /* steps 1 - 9 */
    41         br.call.sptk.many rp = \handler         /* steps 10 - 11 */
    42         br restore_interrupted_context          /* steps 12 - 19 */
    43 .endm
    44 
    45 .macro SAVE_INTERRUPTED_CONTEXT
     44
    4645    /* 1. copy interrupt registers into bank 0 */
    4746        mov r24 = cr.iip
     
    5453        mov r29 = pr ;;
    5554       
    56         /* 3. switch to kernel memory stack */
     55    /* 3. switch to kernel memory stack */
    5756        /* TODO: support interruptions from userspace */
    5857        /* assume kernel stack */
     
    6059    /* 4. allocate memory stack for registers saved in bank 0 */
    6160        st8 [r12] = r29, -8 ;;  /* save predicate registers */
    62         st8 [r12] = r28, -8 ;;  /* save cr.ifa */
     61
     62        st8 [r12] = r24, -8 ;;  /* save cr.iip */
     63        st8 [r12] = r25, -8 ;;  /* save cr.ipsr */
     64        st8 [r12] = r26, -8 ;;  /* save cr.iipa */
    6365        st8 [r12] = r27, -8 ;;  /* save cr.isr */
    64         st8 [r12] = r26, -8 ;;  /* save cr.iipa */
    65         st8 [r12] = r25, -8 ;;  /* save cr.ipsr */
    66         st8 [r12] = r24, -8 ;;  /* save cr.iip */
    67        
    68     /* 5. RSE switch */
     66        st8 [r12] = r28, -8 ;;  /* save cr.ifa */               
     67
     68    /* 5. RSE switch from interrupted context */
    6969        .auto
    7070        mov r24 = ar.rsc
     
    9595        .explicit
    9696       
     97    /* the rest of the save-handler can be kept outside IVT */
     98
     99        movl r24 = \handler
     100        mov r25 = b0
     101        br.call.sptk.many rp = heavyweight_handler_inner
     1020:      mov b0 = r25   
     103
     104        { br heavyweight_handler_finalize }
     105.endm
     106
     107.global heavyweight_handler_inner
     108heavyweight_handler_inner:
     109        /*
     110         * From this point, the rest of the interrupted context
     111         * will be preserved in stacked registers and backing store.
     112         */
     113        alloc loc0 = ar.pfs, 0, 46, 0, 0 ;;
     114       
     115        /* copy handler address (r24 from bank 0 will be invisible soon) */
     116        mov loc1 = r24
     117
    97118    /* 6. switch to bank 1 and reenable PSR.ic */
    98119        ssm 0x2000
     
    101122       
    102123    /* 7. preserve branch and application registers */
     124        mov loc2 = ar.unat
     125        mov loc3 = ar.lc
     126        mov loc4 = ar.ec
     127        mov loc5 = ar.ccv
     128        mov loc6 = ar.csd
     129        mov loc7 = ar.ssd
     130       
     131        mov loc8 = b0
     132        mov loc9 = b1
     133        mov loc10 = b2
     134        mov loc11 = b3
     135        mov loc12 = b4
     136        mov loc13 = b5
     137        mov loc14 = b6
     138        mov loc15 = b7
    103139       
    104140    /* 8. preserve general and floating-point registers */
    105141        /* TODO: save floating-point context */
    106        
     142        mov loc16 = r1
     143        mov loc17 = r2
     144        mov loc18 = r3
     145        mov loc19 = r4
     146        mov loc20 = r5
     147        mov loc21 = r6
     148        mov loc22 = r7
     149        mov loc23 = r8
     150        mov loc24 = r9
     151        mov loc25 = r10
     152        mov loc26 = r11
     153        /* skip r12 (stack pointer) */
     154        mov loc27 = r13
     155        mov loc28 = r14
     156        mov loc29 = r15
     157        mov loc30 = r16
     158        mov loc31 = r17
     159        mov loc32 = r18
     160        mov loc33 = r19
     161        mov loc34 = r20
     162        mov loc35 = r21
     163        mov loc36 = r22
     164        mov loc37 = r23
     165        mov loc38 = r24
     166        mov loc39 = r25
     167        mov loc40 = r26
     168        mov loc41 = r27
     169        mov loc42 = r28
     170        mov loc43 = r29
     171        mov loc44 = r30
     172        mov loc45 = r31
     173   
    107174    /* 9. skipped (will not enable interrupts) */
    108 .endm
    109 
    110 .macro RESTORE_INTERRUPTED_CONTEXT
     175
     176    /* 10. call handler */
     177        mov b1 = loc1
     178        br.call.sptk.many b0 = b1
     179
     180    /* 11. return from handler */
     1810:
     182       
    111183    /* 12. skipped (will not disable interrupts) */
    112        
     184
    113185    /* 13. restore general and floating-point registers */
    114186        /* TODO: restore floating-point context */
     187        mov r1 = loc16
     188        mov r2 = loc17
     189        mov r3 = loc18
     190        mov r4 = loc19
     191        mov r5 = loc20
     192        mov r6 = loc21
     193        mov r7 = loc22
     194        mov r8 = loc23
     195        mov r9 = loc24
     196        mov r10 = loc25
     197        mov r11 = loc26
     198        /* skip r12 (stack pointer) */
     199        mov r13 = loc27
     200        mov r14 = loc28
     201        mov r15 = loc29
     202        mov r16 = loc30
     203        mov r17 = loc31
     204        mov r18 = loc32
     205        mov r19 = loc33
     206        mov r20 = loc34
     207        mov r21 = loc35
     208        mov r22 = loc36
     209        mov r23 = loc37
     210        mov r24 = loc38
     211        mov r25 = loc39
     212        mov r26 = loc40
     213        mov r27 = loc41
     214        mov r28 = loc42
     215        mov r29 = loc43
     216        mov r30 = loc44
     217        mov r31 = loc45
    115218       
    116219    /* 14. restore branch and application registers */
     220        mov ar.unat = loc2
     221        mov ar.lc = loc3
     222        mov ar.ec = loc4
     223        mov ar.ccv = loc5
     224        mov ar.csd = loc6
     225        mov ar.ssd = loc7
     226       
     227        mov b0 = loc8
     228        mov b1 = loc9
     229        mov b2 = loc10
     230        mov b3 = loc11
     231        mov b4 = loc12
     232        mov b5 = loc13
     233        mov b6 = loc14
     234        mov b7 = loc15
    117235       
    118236    /* 15. disable PSR.ic and switch to bank 0 */
     
    120238        bsw.0 ;;
    121239        srlz.d
    122        
    123     /* 16. RSE switch */
     240
     241        mov ar.pfs = loc0
     242        br.ret.sptk.many rp
     243
     244.global heavyweight_handler_finalize
     245heavyweight_handler_finalize:
     246    /* 16. RSE switch to interrupted context */
    124247       
    125248    /* 17. restore interruption state from memory stack */
     
    129252    /* 19. return from interruption */
    130253        rfi
    131 .endm
    132 
    133 .global restore_interrupted_context
    134 restore_interrupted_context:
    135         RESTORE_INTERRUPTED_CONTEXT
    136         /* not reached */
     254
     255
     256
    137257
    138258dump_gregs:
Note: See TracChangeset for help on using the changeset viewer.