3 #include <xtensa/config/specreg.h>
4 #include <xtensa/config/core.h>
5 #include <xtensa/cacheasm.h>
8 * RB-Data: RedBoot data/bss
12 * The Linux-Kernel image including the loader must be loaded
13 * to a position so that the kernel and the boot parameters
14 * can fit in the space before the load address.
15 * ______________________________________________________
16 * |_RB-Data_|_P_|__________|_L_|___Linux-Kernel___|______|
19 * ______________________________________________________
20 * |___Linux-Kernel___|_P_|_L_|___________________________|
22 * The loader copies the parameter to the position that will
23 * be the end of the kernel and itself to the end of the
27 /* Make sure we have enough space for the 'uncompressor' */
29 #define STACK_SIZE 32768
30 #define HEAP_SIZE (131072*4)
33 # a3: Size of parameter list
38 /* this must be the first byte of the loader! */
40 entry sp, 32 # we do not intend to return
46 .begin literal_prefix .text
48 /* put literals in here! */
53 /* 'reset' window registers */
69 /* copy the loader to its address
70 * Note: The loader itself is a very small piece, so we assume we
71 * don't partially overlap. We also assume (even more important)
72 * that the kernel image is out of the way. Usually, when the
73 * load address of this image is not at an arbitrary address,
74 * but aligned to some 10K's we shouldn't overlap.
77 /* Note: The assembler cannot relax "addi a0, a0, ..." to an
78 l32r, so we load to a4 first. */
80 addi a4, a0, __start - __start_a0
85 # a0: address where this code has been loaded
86 # a4: compiled address of __start
87 # a5: compiled end address
106 /* We have to flush and invalidate the caches here before we jump. */
108 #if XCHAL_DCACHE_IS_WRITEBACK
109 dcache_writeback_all a5, a6
111 icache_invalidate_all a5, a6
119 /* RedBoot is now at the end of the memory, so we don't have
120 * to copy the parameter list. Keep the code around; in case
121 * we need it again. */
124 # a2: start address of parameter list
125 # a3: length of parameter list
128 /* copy the parameter list out of the way */
130 movi a6, _param_start
140 /* clear BSS section */
150 movi a1, _stack + STACK_SIZE
153 /* Uncompress the kernel */
159 movi a3, __image_load
164 # a8(a4) Load address of the image
166 movi a6, _image_start
176 # a7 maximum size of destination
189 # a6 destination start
190 # a7 maximum size of destination
193 # a10 destination end
209 /* jump to the kernel */
211 #if XCHAL_DCACHE_IS_WRITEBACK
212 dcache_writeback_all a5, a6
214 icache_invalidate_all a5, a6
217 movi a3, boot_initrd_start
218 movi a4, boot_initrd_end
224 # a2 Boot parameter list
225 # a3 initrd_start (virtual load address)
226 # a4 initrd_end (virtual load address)
228 movi a0, _image_start
238 .long _heap + HEAP_SIZE
240 .comm _stack, STACK_SIZE
241 .comm _heap, HEAP_SIZE