Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/sparc64/loader/asm.S

    re731b0d ra1a83e5e  
    3131#include <register.h>
    3232
    33 .register %g2, #scratch
    34 .register %g3, #scratch
     33.register       %g2, #scratch
     34.register       %g3, #scratch
    3535
    3636.text
     
    4343        ba %xcc, halt
    4444        nop
     45       
     46memcpy:
     47        mov     %o0, %o3                ! save dst
     48        add     %o1, 7, %g1
     49        and     %g1, -8, %g1
     50        cmp     %o1, %g1
     51        be,pn   %xcc, 3f
     52        add     %o0, 7, %g1
     53        mov     0, %g3
     540:
     55        brz,pn  %o2, 2f
     56        mov     0, %g2
     571:
     58        ldub    [%g3 + %o1], %g1
     59        add     %g2, 1, %g2
     60        cmp     %o2, %g2
     61        stb     %g1, [%g3 + %o0]
     62        bne,pt  %xcc, 1b
     63        mov     %g2, %g3
     642:
     65        jmp     %o7 + 8                 ! exit point
     66        mov     %o3, %o0
     673:
     68        and     %g1, -8, %g1
     69        cmp     %o0, %g1
     70        bne,pt  %xcc, 0b
     71        mov     0, %g3
     72        srlx    %o2, 3, %g4
     73        brz,pn  %g4, 5f
     74        mov     0, %g5
     754:
     76        sllx    %g3, 3, %g2
     77        add     %g5, 1, %g3
     78        ldx     [%o1 + %g2], %g1
     79        mov     %g3, %g5
     80        cmp     %g4, %g3
     81        bne,pt  %xcc, 4b
     82        stx     %g1, [%o0 + %g2]
     835:
     84        and     %o2, 7, %o2
     85        brz,pn  %o2, 2b
     86        sllx    %g4, 3, %g1
     87        mov     0, %g2
     88        add     %g1, %o0, %o0
     89        add     %g1, %o1, %g4
     90        mov     0, %g3
     916:
     92        ldub    [%g2 + %g4], %g1
     93        stb     %g1, [%g2 + %o0]
     94        add     %g3, 1, %g2
     95        cmp     %o2, %g2
     96        bne,pt  %xcc, 6b
     97        mov     %g2, %g3
    4598
    46 memcpy:
    47         mov %o0, %o3      ! save dst
    48         add %o1, 7, %g1
    49         and %g1, -8, %g1
    50         cmp %o1, %g1
    51         be,pn %xcc, 3f
    52         add %o0, 7, %g1
    53         mov 0, %g3
    54        
    55         0:
    56                 brz,pn %o2, 2f
    57                 mov 0, %g2
    58        
    59         1:
    60                 ldub [%g3 + %o1], %g1
    61                 add %g2, 1, %g2
    62                 cmp %o2, %g2
    63                 stb %g1, [%g3 + %o0]
    64                 bne,pt %xcc, 1b
    65                 mov %g2, %g3
    66        
    67         2:
    68                 jmp %o7 + 8   ! exit point
    69                 mov %o3, %o0
    70        
    71         3:
    72                 and %g1, -8, %g1
    73                 cmp %o0, %g1
    74                 bne,pt %xcc, 0b
    75                 mov 0, %g3
    76                 srlx %o2, 3, %g4
    77                 brz,pn %g4, 5f
    78                 mov 0, %g5
    79        
    80         4:
    81                 sllx %g3, 3, %g2
    82                 add %g5, 1, %g3
    83                 ldx [%o1 + %g2], %g1
    84                 mov %g3, %g5
    85                 cmp %g4, %g3
    86                 bne,pt %xcc, 4b
    87                 stx %g1, [%o0 + %g2]
    88        
    89         5:
    90                 and %o2, 7, %o2
    91                 brz,pn %o2, 2b
    92                 sllx %g4, 3, %g1
    93                 mov 0, %g2
    94                 add %g1, %o0, %o0
    95                 add %g1, %o1, %g4
    96                 mov 0, %g3
    97        
    98         6:
    99                 ldub [%g2 + %g4], %g1
    100                 stb %g1, [%g2 + %o0]
    101                 add %g3, 1, %g2
    102                 cmp %o2, %g2
    103                 bne,pt %xcc, 6b
    104                 mov %g2, %g3
    105        
    106         jmp %o7 + 8   ! exit point
    107         mov %o3, %o0
     99        jmp     %o7 + 8                 ! exit point
     100        mov     %o3, %o0
    108101
    109102jump_to_kernel:
     
    114107         * 3. Flush instruction pipeline.
    115108         */
    116        
     109
    117110        /*
    118111         * US3 processors have a write-invalidate cache, so explicitly
    119112         * invalidating it is not required. Whether to invalidate I-cache
    120          * or not is decided according to the value of the 5th argument
    121          * (subarchitecture).
     113         * or not is decided according to the value of the global
     114         * "subarchitecture" variable (set in the bootstrap).
    122115         */
    123         cmp %i4, 3
     116        set subarchitecture, %g2
     117        ldub [%g2], %g2
     118        cmp %g2, 3
    124119        be %xcc, 1f
    125120        nop
    126        
    127         0:
    128                 call icache_flush
    129                 nop
    130        
    131         1:
    132                 membar #StoreStore
     1210:
     122        call icache_flush
     123        nop
     1241:
     125        membar #StoreStore
    133126       
    134127        /*
    135128         * Flush the instruction pipeline.
    136129         */
    137         flush %i7
    138        
     130        flush   %i7
     131
    139132        mov %o0, %l1
    140133        mov %o1, %o0
    141134        mov %o2, %o1
    142135        mov %o3, %o2
    143         jmp %l1       ! jump to kernel
     136        jmp %l1                         ! jump to kernel
    144137        nop
    145138
    146 #define ICACHE_SIZE       8192
    147 #define ICACHE_LINE_SIZE  32
    148 #define ICACHE_SET_BIT    (1 << 13)
    149 #define ASI_ICACHE_TAG    0x67
     139#define ICACHE_SIZE             8192
     140#define ICACHE_LINE_SIZE        32
     141#define ICACHE_SET_BIT          (1 << 13)
     142#define ASI_ICACHE_TAG          0x67
    150143
    151144# Flush I-cache
    152145icache_flush:
    153         set ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
    154         stxa %g0, [%g1] ASI_ICACHE_TAG
    155        
    156         0:
    157                 membar #Sync
    158                 subcc %g1, ICACHE_LINE_SIZE, %g1
    159                 bnz,pt %xcc, 0b
    160        
    161         stxa %g0, [%g1] ASI_ICACHE_TAG
    162         membar #Sync
     146        set     ((ICACHE_SIZE - ICACHE_LINE_SIZE) | ICACHE_SET_BIT), %g1
     147        stxa    %g0, [%g1] ASI_ICACHE_TAG
     1480:      membar  #Sync
     149        subcc   %g1, ICACHE_LINE_SIZE, %g1
     150        bnz,pt  %xcc, 0b
     151        stxa    %g0, [%g1] ASI_ICACHE_TAG
     152        membar  #Sync
    163153        retl
    164154        ! SF Erratum #51
    165155        nop
    166 
    167156.global ofw
    168157ofw:
     
    170159        set ofw_cif, %l0
    171160        ldx [%l0], %l0
    172        
     161
    173162        rdpr  %pstate, %l1
    174163        and  %l1, ~PSTATE_AM_BIT, %l2
    175164        wrpr  %l2, 0, %pstate
    176        
     165   
    177166        jmpl %l0, %o7
    178167        mov %i0, %o0
    179        
     168
    180169        wrpr %l1, 0, %pstate
    181        
     170
    182171        ret
    183172        restore %o0, 0, %o0
Note: See TracChangeset for help on using the changeset viewer.