Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia64/src/start.S

    racee917 rfe7abd0  
    3232#include <mm/asid.h>
    3333
    34 #define RR_MASK (0xFFFFFFFF00000002)
    35 #define RID_SHIFT       8
    36 #define PS_SHIFT        2
     34#define RR_MASK    (0xFFFFFFFF00000002)
     35#define RID_SHIFT  8
     36#define PS_SHIFT   2
    3737
    38 #define KERNEL_TRANSLATION_I    0x0010000000000661
    39 #define KERNEL_TRANSLATION_D    0x0010000000000661
    40 #define KERNEL_TRANSLATION_VIO  0x0010000000000671
    41 #define KERNEL_TRANSLATION_IO   0x00100FFFFC000671
    42 #define KERNEL_TRANSLATION_FW   0x00100000F0000671
     38#define KERNEL_TRANSLATION_I    0x0010000000000661
     39#define KERNEL_TRANSLATION_D    0x0010000000000661
     40#define KERNEL_TRANSLATION_VIO  0x0010000000000671
     41#define KERNEL_TRANSLATION_IO   0x00100FFFFC000671
     42#define KERNEL_TRANSLATION_FW   0x00100000F0000671
    4343
    4444.section K_TEXT_START, "ax"
     
    4747
    4848stack0:
     49
     50#
     51# Kernel entry point.
     52#
     53# This is where we are passed control from the boot code.
     54# Register contents:
     55#
     56#       r2      Address of the boot code's bootinfo structure.
     57#
    4958kernel_image_start:
    5059        .auto
    51 
    52 #ifdef CONFIG_SMP
    53         # Identify self(CPU) in OS structures by ID / EID
    54 
    55         mov r9 = cr64
    56         mov r10 = 1
    57         movl r12 = 0xffffffff
    58         movl r8 = cpu_by_id_eid_list
    59         and r8 = r8, r12
    60         shr r9 = r9, 16
    61         add r8 = r8, r9
    62         st1 [r8] = r10
    63 #endif
    64 
     60       
    6561        mov psr.l = r0
    6662        srlz.i
    6763        srlz.d
    68 
     64       
    6965        # Fill TR.i and TR.d using Region Register #VRN_KERNEL
    70 
     66       
    7167        movl r8 = (VRN_KERNEL << VRN_SHIFT)
    7268        mov r9 = rr[r8]
    73 
     69       
    7470        movl r10 = (RR_MASK)
    7571        and r9 = r10, r9
    76         movl r10 = ((RID_KERNEL << RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT))
    77         or  r9 = r10, r9
    78 
     72        movl r10 = (((RID_KERNEL7) << RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT))
     73        or r9 = r10, r9
     74       
    7975        mov rr[r8] = r9
    80 
     76       
    8177        movl r8 = (VRN_KERNEL << VRN_SHIFT)
    8278        mov cr.ifa = r8
    83 
     79       
    8480        mov r11 = cr.itir
    8581        movl r10 = (KERNEL_PAGE_WIDTH << PS_SHIFT)
    8682        or r10 = r10, r11
    8783        mov cr.itir = r10
    88 
     84       
    8985        movl r10 = (KERNEL_TRANSLATION_I)
    9086        itr.i itr[r0] = r10
    9187        movl r10 = (KERNEL_TRANSLATION_D)
    9288        itr.d dtr[r0] = r10
    93 
     89       
    9490        movl r7 = 1
    9591        movl r8 = (VRN_KERNEL << VRN_SHIFT) | VIO_OFFSET
     
    9793        movl r10 = (KERNEL_TRANSLATION_VIO)
    9894        itr.d dtr[r7] = r10
    99 
     95       
    10096        mov r11 = cr.itir
    10197        movl r10 = ~0xfc
     
    104100        or r10 = r10, r11
    105101        mov cr.itir = r10
    106 
     102       
    107103        movl r7 = 2
    108104        movl r8 = (VRN_KERNEL << VRN_SHIFT) | IO_OFFSET
     
    110106        movl r10 = (KERNEL_TRANSLATION_IO)
    111107        itr.d dtr[r7] = r10
    112 
    113         # Setup mapping for fimware arrea (also SAPIC)
    114 
     108       
     109        # Setup mapping for firmware area (also SAPIC)
     110       
    115111        mov r11 = cr.itir
    116112        movl r10 = ~0xfc
     
    119115        or r10 = r10, r11
    120116        mov cr.itir = r10
    121 
     117       
    122118        movl r7 = 3
    123119        movl r8 = (VRN_KERNEL << VRN_SHIFT) | FW_OFFSET
     
    125121        movl r10 = (KERNEL_TRANSLATION_FW)
    126122        itr.d dtr[r7] = r10
    127 
     123       
     124        # Initialize DSR
     125       
     126        movl r10 = (DCR_DP_MASK | DCR_DK_MASK | DCR_DX_MASK | DCR_DR_MASK | DCR_DA_MASK | DCR_DD_MASK | DCR_LC_MASK)
     127        mov r9 = cr.dcr
     128        or r10 = r10, r9
     129        mov cr.dcr = r10
     130       
    128131        # Initialize PSR
    129 
     132       
    130133        movl r10 = (PSR_DT_MASK | PSR_RT_MASK | PSR_IT_MASK | PSR_IC_MASK)  /* Enable paging */
    131134        mov r9 = psr
    132 
     135       
    133136        or r10 = r10, r9
    134137        mov cr.ipsr = r10
     
    138141        srlz.d
    139142        srlz.i
    140 
     143       
    141144        .explicit
    142 
     145       
    143146        /*
    144147         * Return From Interrupt is the only way to
     
    147150        rfi ;;
    148151
    149 
    150152.global paging_start
    151153paging_start:
    152 
     154       
    153155        /*
    154156         * Now we are paging.
    155157         */
    156 
     158       
    157159        # Switch to register bank 1
    158160        bsw.1
    159 
    160 #ifdef CONFIG_SMP
    161         # Am I BSP or AP?
    162         movl r20 = bsp_started ;;
    163         ld8 r20 = [r20] ;;
    164         cmp.eq p3, p2 = r20, r0 ;;
    165 #else
    166         cmp.eq p3, p2 = r0, r0 ;;       /* you are BSP */
    167 #endif  /* CONFIG_SMP */
    168161       
    169162        # Initialize register stack
     
    172165        mov ar.bspstore = r8
    173166        loadrs
    174 
    175         # Initialize memory stack to some sane value
    176         movl r12 = stack0 ;;
    177         add r12 = -16, r12      /* allocate a scratch area on the stack */
    178 
     167       
     168        #
     169        # Initialize memory stack to some sane value and allocate a scratch are
     170        # on it.
     171        #
     172        movl sp = stack0 ;;
     173        add sp = -16, sp
     174       
    179175        # Initialize gp (Global Pointer) register
    180         movl r20 = (VRN_KERNEL << VRN_SHIFT);;
    181         or r20 = r20,r1;;
    182         movl r1 = _hardcoded_load_address
     176        movl gp = kernel_image_start
    183177       
    184         /*
    185          * Initialize hardcoded_* variables. Do only BSP
    186          */
    187 (p3)    movl r14 = _hardcoded_ktext_size
    188 (p3)    movl r15 = _hardcoded_kdata_size
    189 (p3)    movl r16 = _hardcoded_load_address ;;
    190 (p3)    addl r17 = @gprel(hardcoded_ktext_size), gp
    191 (p3)    addl r18 = @gprel(hardcoded_kdata_size), gp
    192 (p3)    addl r19 = @gprel(hardcoded_load_address), gp
    193 (p3)    addl r21 = @gprel(bootinfo), gp
    194         ;;
    195 (p3)    st8 [r17] = r14
    196 (p3)    st8 [r18] = r15
    197 (p3)    st8 [r19] = r16
    198 (p3)    st8 [r21] = r20
    199 
     178        #       
     179        # Initialize bootinfo on BSP.
     180        #
     181        movl r20 = (VRN_KERNEL << VRN_SHIFT) ;;
     182        or r20 = r20, r2 ;;
     183        addl r21 = @gprel(bootinfo), gp ;;
     184        st8 [r21] = r20
     185       
    200186        ssm (1 << 19) ;; /* Disable f32 - f127 */
    201187        srlz.i
    202188        srlz.d ;;
    203 
    204 #ifdef CONFIG_SMP
    205 (p2)    movl r18 = main_ap ;;
    206 (p2)    mov b1 = r18 ;;
    207 (p2)    br.call.sptk.many b0 = b1
    208 
    209         # Mark that BSP is on
    210         mov r20 = 1 ;;
    211         movl r21 = bsp_started ;;
    212         st8 [r21] = r20 ;;
    213 #endif
    214 
     189       
    215190        br.call.sptk.many b0 = arch_pre_main
    216 
    217         movl r18 = main_bsp ;;
    218         mov b1 = r18 ;;
    219         br.call.sptk.many b0 = b1
    220 
     1910:
     192        br.call.sptk.many b0 = main_bsp
    2211930:
    222194        br 0b
    223 
    224 #ifdef CONFIG_SMP
    225 
    226 .align 4096
    227 kernel_image_ap_start:
    228         .auto
    229 
    230         # Identify self(CPU) in OS structures by ID / EID
    231 
    232         mov r9 = cr64
    233         mov r10 = 1
    234         movl r12 = 0xffffffff
    235         movl r8 = cpu_by_id_eid_list
    236         and r8 = r8, r12
    237         shr r9 = r9, 16
    238         add r8 = r8, r9
    239         st1 [r8] = r10
    240        
    241         # Wait for wakeup synchro signal (#3 in cpu_by_id_eid_list)
    242        
    243 kernel_image_ap_start_loop:
    244         movl r11 = kernel_image_ap_start_loop
    245         and r11 = r11, r12
    246         mov b1 = r11
    247 
    248         ld1 r20 = [r8] ;;
    249         movl r21 = 3 ;;
    250         cmp.eq p2, p3 = r20, r21 ;;
    251 (p3)    br.call.sptk.many b0 = b1
    252 
    253         movl r11 = kernel_image_start
    254         and r11 = r11, r12
    255         mov b1 = r11
    256         br.call.sptk.many b0 = b1
    257 
    258 .align 16
    259 .global bsp_started
    260 bsp_started:
    261 .space 8
    262 
    263 .align 4096
    264 .global cpu_by_id_eid_list
    265 cpu_by_id_eid_list:
    266 .space 65536
    267 
    268 #endif  /* CONFIG_SMP */
Note: See TracChangeset for help on using the changeset viewer.