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: * crti.S
17: *
18: * C startup
19: */
20:
21: .macro FUNC_START
22: .arm
23: mov ip, sp // r3 is used to align stack
24: // module 8 bytes
25: stmdb sp!, {r3-r9, sl, fp, ip, lr, pc}
26: sub fp, ip, #4
27: .endm
28:
29: .section .init
30: .balign 4
31: .global _init
32: _init:
33: FUNC_START
34: ldr sl, I_GOT
35: .L4:
36: add sl, pc, sl
37: b I_TOP
38: I_GOT: .word _GLOBAL_OFFSET_TABLE_-(.L4+8)
39: I_TOP:
40:
41: .section .fini
42: .balign 4
43: .global _fini
44: _fini:
45: FUNC_START
46: ldr sl, F_GOT
47: .L5:
48: add sl, pc ,sl
49: b F_TOP
50: F_GOT: .word _GLOBAL_OFFSET_TABLE_-(.L5+8)
51: F_TOP: