Changeset 3debedec in mainline for arch/ppc32/src/start.S


Ignore:
Timestamp:
2006-02-16T20:26:14Z (19 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ba52899
Parents:
2a46e10
Message:

Made powerpc to get on PearPC to the version print when compiled with -O1:

  • create proper memory zones
  • switch to real mode on boot

TODO

  • kernel relocation during boot
  • autodetection of framebuffer settings (PCI?) - now includes hardcoded settings for PearPc.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/ppc32/src/start.S

    r2a46e10 r3debedec  
    2828
    2929#include <arch/asm/macro.h>
     30#include <arch/asm/spr.h>
    3031
    3132.section K_TEXT_START
     
    3334.global kernel_image_start
    3435
     36.org 0x0
     37/* 256 bytes of some data */
     38/* exception table - must use 'ba' instructions for branches,
     39 * because it is elsewhere than the linker thinks
     40 */
     41.space 4096
     42
    3543kernel_image_start:
     44        /* Initialize OFW, might be needed before relocate_kernel? */
    3645        lis r4, ofw@ha
    3746        addi r4, r4, ofw@l
     
    3948       
    4049        bl ofw_init
     50        bl preboot_read_config
     51
     52        bl relocate_kernel
     53__after_reloc:
     54        /* Set stack to some more meaningful value */
     55        /* TODO: This is hardcoded for PearPC, must be changed later */
     56        lis r1, 0x70
     57        b main_bsp
    4158       
    42         b main_bsp
     59relocate_kernel:
     60        /* TODO: We _know_ that pearpc loads it to 8MB, and
     61         * but it should be really generic
     62         */
     63        lis r4, 0x80 /* r4 is where data was loaded - 8MB */
     64       
     65        bl to_real_mode
     66        /* Now we are in real mode, copy first block and jump to it,
     67         * we are running in the loaded kernel now
     68         * We still have in r3 physical load kernel address
     69         */
     70       
     71        b __after_reloc /* We know in pearpc we are ok, so return,
     72                         * otherwise we should relocate kernel
     73                         * here
     74                         */
     75
     76       
     77
     78       
     79/* Turn off page translation
     80 * - assume that physical-loaded address is in r4
     81 */
     82to_real_mode:
     83        mflr r0
     84       
     85        lis   r5, ktext_start@ha // Expected start of kernel
     86        addi r5, r5, ktext_start@l
     87       
     88        add  r0, r4, r0         
     89        sub  r0, r0, r5         // r0 now contains physical return address
     90       
     91        mfmsr r3
     92        andis. r3, r3, (~MSR_DR | MSR_IR) >> 16
     93        mtspr SPRN_SRR0, r0
     94        mtspr SPRN_SRR1, r3
     95        sync                    // Really needed? RFI should do it as well?
     96        RFI
     97
Note: See TracChangeset for help on using the changeset viewer.