MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / arch / nios2nommu / boot / compressed / head.S
blobaccadd0fd4eb767726c34a07cc4ac8dd0da15d2d
1 /*
2  *  linux/arch/nios2nommu/boot/compressed/head.S
3  *
4  */
6         .text
7         .set noat
8 #include <asm/asm-offsets.h>
9 #include <asm/asm-macros.h>
11         /*
12          * This code can be loaded anywhere, as long as output will not
13          * overlap it.
14          *
15          */
17         .global _start
18 _start:
19         // disable interrupt
20         wrctl   status, r0
21         // flush the instruction cache  
22         movia r1,NIOS2_ICACHE_SIZE
23         movi r2,NIOS2_ICACHE_LINE_SIZE
24 text_init:
25         initi r1
26         sub r1, r1, r2
27         bgt r1, zero, text_init
28         // then flush the pipeline
29         flushp
30         // flush the data cache 
31         movia r1,NIOS2_DCACHE_SIZE
32         movi r2,NIOS2_DCACHE_LINE_SIZE
33 data_init:
34         initd (r1)
35         sub r1, r1, r2
36         bgt r1, zero, data_init
37         //------------------------------------------------------
38         // Zero out the .bss segment (uninitialized common data)
39         //
40         movia   r2,__bss_start          // presume nothing is between
41         movia   r1,_end                 // the .bss and _end.
43         stb     r0,0(r2)
44         addi    r2,r2,1
45         bne     r1,r2,1b
46         // set up the stack pointer, some where higher than _end. The stack space must be greater than 32K for decompress.
47         movia   sp, 0x10000
48         add     sp,sp,r1
49         // save args passed from u-boot
50         addi    sp,sp,-16
51         stw     r4,0(sp)
52         stw     r5,4(sp)
53         stw     r6,8(sp)
54         stw     r7,12(sp)
56  * decompress the kernel
57  */
58         call    decompress_kernel
59         
60 flush_cache:
61         // flush all cache after loading
62         // flush the data cache 
63         movia r1,NIOS2_DCACHE_SIZE
64         movi r2,NIOS2_DCACHE_LINE_SIZE
65 data_flush:
66         flushd (r1)
67         sub r1, r1, r2
68         bgt r1, zero, data_flush
69         // flush the instruction cache
70         movia r1,NIOS2_ICACHE_SIZE
71         movi r2,NIOS2_ICACHE_LINE_SIZE
72 text_flush:
73         flushi r1
74         sub r1, r1, r2
75         bgt r1, zero, text_flush
76         // then flush the pipeline
77         flushp
78         // pass saved args to kernel
79         ldw     r4,0(sp)
80         ldw     r5,4(sp)
81         ldw     r6,8(sp)
82         ldw     r7,12(sp)
83         movia r1,LINUX_SDRAM_START      
84         jmp     r1
86         .balign 512
87 fake_headers_as_bzImage:
88         .short  0
89         .ascii  "HdrS"
90         .short  0x0202
91         .short  0
92         .short  0
93         .byte   0x00, 0x10
94         .short  0
95         .byte   0
96         .byte   1
97         .byte   0x00, 0x80
98         .long   0
99         .long   0