source: rtems/c/src/lib/libbsp/powerpc/motorola_powerpc/start/start.S @ 981b99f

4.104.114.84.95
Last change on this file since 981b99f was 981b99f, checked in by Joel Sherrill <joel.sherrill@…>, on 08/10/99 at 16:41:44

Patch from Eric Valette <valette@…> and Emmanuel Raguet
<raguet@…>:

  • the dec21140 driver code has been hardened (various bug fixed) Emmanuel,
  • bug in the mcp750 init code have been fixed (interrupt stack/initial stack initialization), BSS correctly cleared (Eric V)
  • remote debugging over TCP/IP is nearly complete (berakpoints, backtrace, variables,...) (Eric V),
  • exception handling code has also been improved in order to fully support RDBG requirements (Eric V),
  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 *  start.S :     RTEMS entry point
3 *
4 *  Copyright (C) 1999 Eric Valette. valette@crf.canon.fr
5 *
6 *  The license and distribution terms for this file may be
7 *  found in found in the file LICENSE in this distribution or at
8 *  http://www.OARcorp.com/rtems/license.html.
9 *
10 *  $Id$
11 *
12 */
13
14#include <libcpu/cpu.h>
15#include <libcpu/io.h>
16#include <rtems/score/targopts.h>
17#include <rtems/score/cpu.h>
18#include "asm.h"
19
20#define SYNC \
21        sync; \
22        isync
23
24#define KERNELBASE      0x0
25
26#define MONITOR_ENTER                   \
27        mfmsr   r10             ;       \
28        ori     r10,r10,MSR_IP  ;       \
29        mtmsr   r10             ;       \
30        li      r10,0x63        ;       \
31        sc
32                       
33        .text
34        .globl  __rtems_entry_point
35        .type   __rtems_entry_point,@function
36__rtems_entry_point:
37#ifdef DEBUG_EARLY_START
38        MONITOR_ENTER
39#endif 
40               
41/*
42 * PREP
43 * This is jumped to on prep systems right after the kernel is relocated
44 * to its proper place in memory by the boot loader.  The expected layout
45 * of the regs is:     
46 *   r3: ptr to residual data
47 *   r4: initrd_start or if no initrd then 0
48 *   r5: initrd_end - unused if r4 is 0
49 *   r6: Start of command line string
50 *   r7: End of command line string
51 *
52 */
53       
54        mr      r31,r3                  /* save parameters */
55        mr      r30,r4
56        mr      r29,r5
57        mr      r28,r6
58        mr      r27,r7
59/*
60 * Use the first pair of BAT registers to map the 1st 64MB
61 * of RAM to KERNELBASE.
62 */
63        lis     r11,KERNELBASE@h
64        ori     r11,r11,0x7fe           /* set up BAT registers for 604 */
65        li      r8,2                    /* R/W access */
66        mtspr   DBAT0L,r8               /* N.B. 6xx (not 601) have valid */
67        mtspr   DBAT0U,r11              /* bit in upper BAT register */
68        mtspr   IBAT0L,r8
69        mtspr   IBAT0U,r11
70        isync
71
72/*
73 * we now have the 1st 64M of ram mapped with the bats.
74 */
75       
76enter_C_code:
77        bl      MMUon
78        /*
79         * stack = &__rtems_end + 4096
80         */
81        addis   r9,r0, __rtems_end+(4096-CPU_MINIMUM_STACK_FRAME_SIZE)@ha
82        addi    r9,r9, __rtems_end+(4096-CPU_MINIMUM_STACK_FRAME_SIZE)@l
83        mr      r1, r9
84        bl      zero_bss
85        /*
86         * restore prep boot params
87         */
88        mr      r3,r31
89        mr      r4,r30
90        mr      r5,r29
91        mr      r6,r28
92        mr      r7,r27
93        bl      save_boot_params
94        bl      boot_card
95        bl      _return_to_ppcbug
96       
97        .globl  MMUon
98        .type   MMUon,@function
99MMUon: 
100        mfmsr   r0
101        ori     r0,r0, MSR_IP | MSR_RI | MSR_IR | MSR_DR | MSR_EE | MSR_FE0 | MSR_FE1
102        xori    r0, r0, MSR_EE | MSR_IP | MSR_FP
103        mflr    r11
104        mtsrr0  r11
105        mtsrr1  r0
106        SYNC
107        rfi
108       
109        .globl  MMUoff
110        .type   MMUoff,@function
111MMUoff:
112        mfmsr   r0
113        ori     r0,r0,MSR_IR| MSR_DR | MSR_IP
114        mflr    r11
115        xori    r0,r0,MSR_IR|MSR_DR
116        mtsrr0  r11
117        mtsrr1  r0
118        SYNC
119        rfi
120
121        .globl  _return_to_ppcbug
122        .type   _return_to_ppcbug,@function
123
124       
125_return_to_ppcbug:
126        mflr    r30
127        bl      MMUoff
128        MONITOR_ENTER
129        bl      MMUon
130        mtctr   r30
131        bctr   
Note: See TracBrowser for help on using the repository browser.