source: mainline/boot/arch/arm32/src/asm.S@ 12b0d51

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 12b0d51 was 4872160, checked in by Martin Decky <martin@…>, 15 years ago

new boot infrastructure

  • more code and metadata unification
  • import of up-to-date implementations from the kernel
  • the boot loaders should behave more similarly on all platforms
  • support for deflate compressed (LZ77) boot components
    • this again allows feasible boot images to be created on mips32
  • IA64 is still not booting
    • the broken forked GNU EFI library has been removed, a replacement of the functionality is on its way
  • Property mode set to 100644
File size: 2.5 KB
Line 
1#
2# Copyright (c) 2007 Michal Kebrt
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions
7# are met:
8#
9# - Redistributions of source code must retain the above copyright
10# notice, this list of conditions and the following disclaimer.
11# - Redistributions in binary form must reproduce the above copyright
12# notice, this list of conditions and the following disclaimer in the
13# documentation and/or other materials provided with the distribution.
14# - The name of the author may not be used to endorse or promote products
15# derived from this software without specific prior written permission.
16#
17# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28
29#include <arch/arch.h>
30
31.section BOOTSTRAP
32
33.global start
34.global boot_pt
35.global boot_stack
36.global halt
37.global memcpy
38.global jump_to_kernel
39
40start:
41 ldr sp, =boot_stack
42 b bootstrap
43
44.section BOOTPT
45boot_pt:
46 .space PTL0_ENTRIES * PTL0_ENTRY_SIZE
47
48.section BOOTSTACK
49 .space 4096
50boot_stack:
51
52.text
53
54halt:
55 b halt
56
57memcpy:
58 add r3, r1, #3
59 bic r3, r3, #3
60 cmp r1, r3
61 stmdb sp!, {r4, r5, lr}
62 mov r5, r0
63 beq 4f
64
65 1:
66 cmp r2, #0
67 movne ip, #0
68 beq 3f
69
70 2:
71 ldrb r3, [ip, r1]
72 strb r3, [ip, r0]
73 add ip, ip, #1
74 cmp ip, r2
75 bne 2b
76
77 3:
78 mov r0, r5
79 ldmia sp!, {r4, r5, pc}
80
81 4:
82 add r3, r0, #3
83 bic r3, r3, #3
84 cmp r0, r3
85 bne 1b
86 movs r4, r2, lsr #2
87 moveq lr, r4
88 beq 6f
89 mov lr, #0
90 mov ip, lr
91
92 5:
93 ldr r3, [ip, r1]
94 add lr, lr, #1
95 cmp lr, r4
96 str r3, [ip, r0]
97 add ip, ip, #4
98 bne 5b
99
100 6:
101 ands r4, r2, #3
102 beq 3b
103 mov r3, lr, lsl #2
104 add r0, r3, r0
105 add ip, r3, r1
106 mov r2, #0
107
108 7:
109 ldrb r3, [r2, ip]
110 strb r3, [r2, r0]
111 add r2, r2, #1
112 cmp r2, r4
113 bne 7b
114 b 3b
115
116jump_to_kernel:
117 #
118 # TODO
119 # Make sure that the I-cache, D-cache and memory are mutually coherent
120 # before passing control to the copied code.
121 #
122 bx r0
Note: See TracBrowser for help on using the repository browser.