Changeset 46c20c8 in mainline for boot/arch/sparc64/src/asm.S


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

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

    rfb150d78 r46c20c8  
    11#
    22# Copyright (c) 2006 Martin Decky
    3 # Copyright (c) 2006 Jakub Jermar 
     3# Copyright (c) 2006 Jakub Jermar
    44# All rights reserved.
    55#
     
    2828#
    2929
    30 #include <stack.h>
    31 #include <register.h>
     30#include <arch/arch.h>
     31
     32#define ICACHE_SIZE       8192
     33#define ICACHE_LINE_SIZE  32
     34#define ICACHE_SET_BIT    (1 << 13)
     35#define ASI_ICACHE_TAG    0x67
    3236
    3337.register %g2, #scratch
    3438.register %g3, #scratch
     39.register %g6, #scratch
     40.register %g7, #scratch
     41
     42.global start
     43.global halt
     44.global jump_to_kernel
     45
     46.section BOOTSTRAP, "ax"
     47
     48start:
     49        ba %xcc, 1f
     50        nop
     51
     52/*
     53 * This header forces SILO to load the image at 0x4000.
     54 * More precisely, SILO will think this is an old version of Linux.
     55 */
     56.ascii "HdrS"
     57.word 0
     58.half 0
     59.half 0
     60.half 0
     61.half 0
     62.word 0
     63.word 0
     64
     65.align 8
     661:
     67        ! Disable interrupts and disable address masking.
     68       
     69        wrpr %g0, PSTATE_PRIV_BIT, %pstate
     70       
     71        wrpr %g0, NWINDOWS - 2, %cansave   ! Set maximum saveable windows
     72        wrpr %g0, 0, %canrestore           ! Get rid of windows we will never need again
     73        wrpr %g0, 0, %otherwin             ! Make sure the window state is consistent
     74        wrpr %g0, NWINDOWS - 1, %cleanwin  ! Prevent needless clean_window traps for kernel
     75       
     76        set initial_stack, %sp
     77        add %sp, -STACK_BIAS, %sp
     78       
     79        set ofw_cif, %l0
     80       
     81        ! Initialize OpenFirmware
     82       
     83        call ofw_init
     84        stx %o4, [%l0]
     85       
     86        ba %xcc, bootstrap
     87        nop
     88
     89.align STACK_ALIGNMENT
     90        .space STACK_SIZE
     91initial_stack:
     92        .space STACK_WINDOW_SAVE_AREA_SIZE
    3593
    3694.text
    37 
    38 .global halt
    39 .global memcpy
    40 .global jump_to_kernel
    4195
    4296halt:
     
    4498        nop
    4599
    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
    108 
    109100jump_to_kernel:
    110101        /*
    111          * We have copied code and now we need to guarantee cache coherence.
     102         * Guarantee cache coherence:
    112103         * 1. Make sure that the code we have moved has drained to main memory.
    113104         * 2. Invalidate I-cache.
     
    118109         * US3 processors have a write-invalidate cache, so explicitly
    119110         * 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).
     111         * or not is decided according to the value of the 3rd argument
     112         * (subarch).
    122113         */
    123         cmp %i4, 3
     114        cmp %o2, SUBARCH_US3
    124115        be %xcc, 1f
    125116        nop
     
    137128        flush %i7
    138129       
    139         mov %o0, %l1
    140         mov %o1, %o0
    141         mov %o2, %o1
    142         mov %o3, %o2
    143         jmp %l1       ! jump to kernel
     130        ! Jump to kernel
     131        jmp %o3
    144132        nop
    145 
    146 #define ICACHE_SIZE       8192
    147 #define ICACHE_LINE_SIZE  32
    148 #define ICACHE_SET_BIT    (1 << 13)
    149 #define ASI_ICACHE_TAG    0x67
    150133
    151134# Flush I-cache
     
    162145        membar #Sync
    163146        retl
     147       
    164148        ! SF Erratum #51
     149       
    165150        nop
    166151
     
    171156        ldx [%l0], %l0
    172157       
    173         rdpr  %pstate, %l1
    174         and  %l1, ~PSTATE_AM_BIT, %l2
    175         wrpr  %l2, 0, %pstate
     158        rdpr %pstate, %l1
     159        and %l1, ~PSTATE_AM_BIT, %l2
     160        wrpr %l2, 0, %pstate
    176161       
    177162        jmpl %l0, %o7
Note: See TracChangeset for help on using the changeset viewer.