1 | /* |
---|
2 | * crt0.S -- startup file for D30V systems. |
---|
3 | * |
---|
4 | * Copyright (c) 1997 Cygnus Support |
---|
5 | * |
---|
6 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
7 | * and license this software and its documentation for any purpose, provided |
---|
8 | * that existing copyright notices are retained in all copies and that this |
---|
9 | * notice is included verbatim in any distributions. No written agreement, |
---|
10 | * license, or royalty fee is required for any of the authorized uses. |
---|
11 | * Modifications to this software may be copyrighted by their authors |
---|
12 | * and need not follow the licensing terms described here, provided that |
---|
13 | * the new terms are clearly indicated on the first page of each file where |
---|
14 | * they apply. |
---|
15 | */ |
---|
16 | |
---|
17 | .file "crt0.S" |
---|
18 | .text |
---|
19 | .globl _start |
---|
20 | .extern main |
---|
21 | .extern exit |
---|
22 | .extern __stack |
---|
23 | .extern __sbss_start |
---|
24 | .extern __sbss_end |
---|
25 | .extern __ebss_start |
---|
26 | .extern __ebss_end |
---|
27 | .extern __bss_start |
---|
28 | .extern __bss_end |
---|
29 | .extern memset |
---|
30 | .type _start,@function |
---|
31 | |
---|
32 | _start: or.l sp,r0,__stack |
---|
33 | |
---|
34 | /* Zero the .sbss area */ |
---|
35 | or.l r2,r0,__sbss_start |
---|
36 | or.l r4,r0,__sbss_end |
---|
37 | sub r4,r4,r2 || or.s r3,r0,0 |
---|
38 | bsrtnz.l r4,(memset) |
---|
39 | |
---|
40 | /* Zero the .ebss area */ |
---|
41 | or.l r2,r0,__ebss_start |
---|
42 | or.l r4,r0,__ebss_end |
---|
43 | sub r4,r4,r2 || or.s r3,r0,0 |
---|
44 | bsrtnz.l r4,(memset) |
---|
45 | |
---|
46 | /* Zero the .bss area */ |
---|
47 | or.l r2,r0,__bss_start |
---|
48 | or.l r4,r0,__bss_end |
---|
49 | sub r4,r4,r2 || or.s r3,r0,0 |
---|
50 | bsrtnz.l r4,(memset) |
---|
51 | |
---|
52 | or.s r2,r0,0 || or.s r3,r0,0 |
---|
53 | or r4,r0,0 || nop |
---|
54 | jsr.l (main) |
---|
55 | jsr.l (exit) |
---|
56 | .size _start,.-_start |
---|