Changeset 46c20c8 in mainline for boot/arch/ppc32/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/ppc32/src/asm.S

    rfb150d78 r46c20c8  
    2727#
    2828
    29 #include "asm.h"
    30 #include "regname.h"
    31 #include "ofwarch.h"
     29#include <arch/arch.h>
     30#include <arch/regname.h>
    3231
    3332.macro SMC_COHERENCY addr
     
    5958.endm
    6059
     60.global start
     61.global halt
     62.global jump_to_kernel
     63.global real_mode
     64
     65.section BOOTSTRAP, "ax"
     66
     67start:
     68        lis r4, ofw_cif@ha
     69        addi r4, r4, ofw_cif@l
     70        stw r5, 0(r4)
     71       
     72        bl ofw_init
     73        b bootstrap
     74
    6175.text
    62 
    63 .global halt
    64 .global memcpy
    65 .global jump_to_kernel
    66 .global balloc_base
    6776
    6877halt:
    6978        b halt
    7079
    71 memcpy:
    72         srwi. r7, r5, 3
    73         addi r6, r3, -4
    74         addi r4, r4, -4
    75         beq 2f
    76        
    77         andi. r0, r6, 3
    78         mtctr r7
    79         bne 5f
    80        
    81         1:
    82                 lwz r7, 4(r4)
    83                 lwzu r8, 8(r4)
    84                 stw r7, 4(r6)
    85                 stwu r8, 8(r6)
    86                 bdnz 1b
    87                
    88                 andi. r5, r5, 7
    89        
    90         2:
    91                 cmplwi 0, r5, 4
    92                 blt 3f
    93                
    94                 lwzu r0, 4(r4)
    95                 addi r5, r5, -4
    96                 stwu r0, 4(r6)
    97        
    98         3:
    99                 cmpwi 0, r5, 0
    100                 beqlr
    101                 mtctr r5
    102                 addi r4, r4, 3
    103                 addi r6, r6, 3
    104        
    105         4:
    106                 lbzu r0, 1(r4)
    107                 stbu r0, 1(r6)
    108                 bdnz 4b
    109                 blr
    110        
    111         5:
    112                 subfic r0, r0, 4
    113                 mtctr r0
    114        
    115         6:
    116                 lbz r7, 4(r4)
    117                 addi r4, r4, 1
    118                 stb r7, 4(r6)
    119                 addi r6, r6, 1
    120                 bdnz 6b
    121                 subf r5, r0, r5
    122                 rlwinm. r7, r5, 32-3, 3, 31
    123                 beq 2b
    124                 mtctr r7
    125                 b 1b
    126 
    12780jump_to_kernel:
    12881       
    129         # r3 = bootinfo (pa)
    130         # r4 = bootinfo_size
    131         # r5 = trans (pa)
    132         # r6 = bytes to copy
    133         # r7 = real_mode (pa)
     82        # arguments:
     83        # r3 = bootinfo (physical address)
     84        # r4 = translate table (physical address)
     85        # r5 = pages to translate
     86        # r6 = real mode meeting point (physical address)
    13487       
    13588        # disable interrupts
     
    13992        mtmsr r31
    14093       
    141         # set real_mode meeting point address
    142        
    143         mtspr srr0, r7
    144        
    145         # jumps to real_mode
     94        # set real mode meeting point physical address
     95       
     96        mtspr srr0, r6
     97       
     98        # jump to real_mode
    14699       
    147100        mfmsr r31
     
    155108        rfi
    156109
     110.section REALMODE, "ax"
     111
    157112.align PAGE_WIDTH
    158 balloc_base:
    159         .fill BALLOC_MAX_SIZE
    160 
    161 .section REALMODE, "ax"
    162 
    163 .align PAGE_WIDTH
    164 .global real_mode
    165113real_mode:
    166114       
    167         # copy kernel to proper location
    168         #
    169         # r3 = bootinfo (pa)
    170         # r4 = bootinfo_size
    171         # r5 = trans (pa)
    172         # r6 = bytes to copy
     115        # arguments:
     116        # r3 = bootinfo (physical address)
     117        # r4 = translate table (physical address)
     118        # r5 = pages to translate
     119       
     120        # move the images of components to the proper
     121        # location using the translate table
    173122       
    174123        li r31, PAGE_SIZE >> 2
     
    177126        page_copy:
    178127               
    179                 cmpwi r6, 0
     128                cmpwi r5, 0
    180129                beq copy_end
    181130               
    182                 # copy page
    183                
    184131                mtctr r31
    185                 lwz r29, 0(r5)
     132                lwz r29, 0(r4)
    186133               
    187134                copy_loop:
     
    194141                        addi r29, r29, 4
    195142                        addi r30, r30, 4
    196                         subi r6, r6, 4
    197                        
    198                         cmpwi r6, 0
    199                         beq copy_end
    200143                       
    201144                        bdnz copy_loop
    202                        
    203                 addi r5, r5, 4
     145               
     146                addi r4, r4, 4
     147                subi r5, r5, 1
    204148                b page_copy
    205149       
     
    266210        # on top of memory, size 64 KB
    267211       
    268         lwz r31, 0(r3)                # r31 = memory size
     212        lwz r31, 4(r3)                # r31 = memory size
    269213       
    270214        lis r30, 65536@h
     
    303247        # create BAT identity mapping
    304248       
    305         lwz r31, 0(r3)                # r31 = memory size
     249        lwz r31, 4(r3)                # r31 = memory size
    306250       
    307251        lis r29, 0x0002
     
    354298        #
    355299        # pc = PA2KA(BOOT_OFFSET)
    356         # r3 = bootinfo (pa)
     300        # r3 = bootinfo (physical address)
    357301        # sprg0 = BOOT_OFFSET
    358302        # sprg3 = physical memory size
    359         # sp = 0 (pa)
     303        # sp = 0 (enforces the usage of sprg0 as exception stack)
    360304       
    361305        lis r31, PA2KA(BOOT_OFFSET)@ha
     
    367311        mtsprg0 r31
    368312       
    369         lwz r31, 0(r3)
     313        # bootinfo starts with a 64 bit integer containing
     314        # the physical memory size, get the lower 4 bytes
     315       
     316        lwz r31, 4(r3)
    370317        mtsprg3 r31
    371318       
     
    379326        isync
    380327        rfi
    381 
    382 .align PAGE_WIDTH
    383 .global trans
    384 trans:
    385         .rept TRANS_SIZE
    386         .int 0
    387         .endr
Note: See TracChangeset for help on using the changeset viewer.