source: rtems/c/src/lib/libbsp/powerpc/score603e/start/start.S @ ae55da72

4.115
Last change on this file since ae55da72 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/*
2 * This is based on the mvme-crt0.S file from libgloss/rs6000.
3 * crt0.S -- startup file for PowerPC systems.
4 *
5 * Copyright (c) 1995 Cygnus Support
6 *
7 * The authors hereby grant permission to use, copy, modify, distribute,
8 * and license this software and its documentation for any purpose, provided
9 * that existing copyright notices are retained in all copies and that this
10 * notice is included verbatim in any distributions. No written agreement,
11 * license, or royalty fee is required for any of the authorized uses.
12 * Modifications to this software may be copyrighted by their authors
13 * and need not follow the licensing terms described here, provided that
14 * the new terms are clearly indicated on the first page of each file where
15 * they apply.
16 */
17
18#include "ppc-asm.h"
19
20        .file   "start.s"
21        .section ".got2","aw"
22        .align  2
23
24.LCTOC1 = .+32768
25
26        .extern FUNC_NAME(atexit)
27        .globl  FUNC_NAME(__atexit)
28        .section ".sdata","aw"
29        .align  2
30FUNC_NAME(__atexit):                    /* tell C's eabi-ctor's we have an atexit function */
31        .long   FUNC_NAME(atexit)@fixup /* and that it is to register __do_global_dtors */
32
33        .section ".fixup","aw"
34        .align  2
35        .long   FUNC_NAME(__atexit)
36
37        .section ".got2","aw"
38.Ltable = .-.LCTOC1
39        .long   .LCTOC1                 /* address we think .LCTOC1 is loaded at */
40
41.Lbss_start = .-.LCTOC1
42        .long   _edata                 /* includes sbss and bss */
43
44.Lend = .-.LCTOC1
45        .long   _end
46
47.Lstack = .-.LCTOC1                     /* stack address if set by user */
48        .long   __stack
49
50        .text
51.Lptr:
52        .long .LCTOC1-.Laddr
53
54        .globl  _start
55        .type   _start,@function
56_start:
57        b       past_constants
58                                        /* Set MSR */
59        .long   _etext                  /* end of code space */
60        .long   _edata                  /* end of code and data space */
61
62past_constants:
63        lis     r5,0
64        mr      r4,r5
65        ori     r4,r4,0x0000            /* 0x2030  */
66        mtmsr   r4
67
68        /* The first generation board needed initialization here but the */
69        /* second does not. */
70
71        bl      .Laddr                  /* get current address */
72.Laddr:
73        mflr    r4                      /* real address of .Laddr */
74        lwz     r5,(.Lptr-.Laddr)(r4)   /* linker generated address of .LCTOC1 */
75        add     r5,r5,r4                /* correct to real pointer */
76        lwz     r4,.Ltable(r5)          /* get linker's idea of where .Laddr is */
77        subf    r4,r4,r5                /* calculate difference between where linked and current */
78
79        /* clear bss */
80        lwz     r6,.Lbss_start(r5)      /* calculate beginning of the BSS */
81        lwz     r7,.Lend(r5)            /* calculate end of the BSS */
82        add     r6,r6,r4                /* adjust pointers */
83        add     r7,r7,r4
84
85        cmplw   1,r6,r7
86        bc      4,4,.Ldone
87
88        subf    r8,r6,r7                /* number of bytes to zero */
89        srwi    r9,r8,2                 /* number of words to zero */
90        mtctr   r9
91        li      r0,0                    /* zero to clear memory */
92        addi    r6,r6,-4                /* adjust so we can use stwu */
93.Lloop:
94        stwu    r0,4(r6)                /* zero bss */
95        bdnz    .Lloop
96
97.Ldone:
98
99        lwz     r0,.Lstack(r5)          /* stack address or 0 */
100        cmplwi  1,r0,0                  /* equal to 0? */
101        bc      12,6,.Lnostack          /* use default stack if == 0 */
102        mr      sp,r0                   /* use user defined stack */
103
104.Lnostack:
105
106        lis     r13,_SDA_BASE_@ha
107        la      r13,_SDA_BASE_@l(r13)           /* Read-write small data */
108
109        /* set up initial stack frame */
110        addi    sp,sp,-4                /* make sure we don't overwrite debug mem */
111        lis     r0,0
112        stw     r0,0(sp)                /* clear back chain */
113        stwu    sp,-56(sp)              /* push another stack frame */
114
115        li      r3, 0                   /* command line */
116        /* Let her rip */
117        bl      FUNC_NAME(boot_card)
118
119        /* return value from boot_card is argument to exit */
120        bl      FUNC_NAME(exit)
121        trap
122.Lstart:
123        .size   _start,.Lstart-_start
Note: See TracBrowser for help on using the repository browser.