ChorusOS 4.0 Porting Guide

MPC8xx PowerPC Bootstrap Implementation Framework

The _start() routine initializes the CPU to the state required by the PowerPC BKI (see "PowerPC BKI"). Example 3-12 applies to the PowerPC MPC8xx micro-controller family. To put the CPU in the state required by the MPC8xx PowerPC BKI, the routine goes through the following steps:

  1. Clears all bits in the MSR register except the ME and RI bits, which are set, and:

    • Disables all external interrupts (MSR[EE])

    • Disables all instruction and data translations (MSR[IR], MSR[DR])

    • Disables FPU instructions (MSR[FP])

    • Puts the processor into Supervisor privilege state (MSR[PR])

    • Enables machine-check exceptions (MSR[ME)

    • Pust the processor in a recoverable exception state (MSR[RI])

  2. Resets instruction and data MMU control registers to clear any TLB reservation. Invalidates the TLB entries and resets, disables and/or invalidates all MMU registers.

  3. The L1 data cache is assumed to be disabled.


Example 3-12 start()

_start:
                               /* Setup init value for MSR */
                addi    r9, r0, (MSR_ME+MSR_RI)
                mtmsr   r9
                               /* Clear reservation of TLB entries */
                lis     r9, 0x0
                mtspr   mi_ctr, r9
                mtspr   md_ctr, r9
                mtspr   m_casid, r9
                mtspr   md_ap, r9
                tlbia          /* invalidate all TLB entries */

                               /* setup stack for boot */
                LoadAddr(r1, stackPtr)  
                bl      start
        loop:
                b       loop   /* Never here */