1: /*
2: *----------------------------------------------------------------------
3: * T-Kernel 2.0 Software Package
4: *
5: * Copyright 2011 by Ken Sakamura.
6: * This software is distributed under the latest version of T-License 2.x.
7: *----------------------------------------------------------------------
8: *
9: * Released by T-Engine Forum(http://www.t-engine.org/) at 2011/05/17.
10: * Modified by TRON Forum(http://www.tron.org/) at 2015/06/01.
11: *
12: *----------------------------------------------------------------------
13: */
14:
15: /*
16: * @(#)asmstartup.S (crttk/EM1-D512)
17: *
18: * Driver/manager startup
19: */
20:
21: #include <machine.h>
22: #include <tk/asm.h>
23:
24: .text
25: .balign 4
26: .globl Csym(_C_startup)
27: .type Csym(_C_startup), %function
28: Csym(_C_startup):
29: cmp r0, #0
30: blt l_noinit // Initialization sequence is performed only when ac >= 0
31:
32: ldr r4, =__data_org // When data area does not need to be moved,
33: ldr r5, =__data_start // OS loads
34: cmp r4, r5
35: beq l_noinit
36:
37: ldr r6, =_edata // initialize data area
38: cmp r5, r6
39: bhs nocopy_data
40: copy_data:
41: ldr ip, [r4], #4
42: str ip, [r5], #4
43: cmp r5, r6
44: blo copy_data
45: nocopy_data:
46:
47: ldr ip, =0 // clear bss area
48: ldr r4, =__bss_start
49: ldr r5, =_end
50: cmp r4, r5
51: bhs nobss
52: clrbss:
53: str ip, [r4], #4
54: cmp r4, r5
55: blo clrbss
56: nobss:
57:
58: l_noinit:
59: b Csym(_P_startup)