This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / arch / m32r / boot / compressed / head.S
1 /*
2  *  linux/arch/m32r/boot/compressed/head.S
3  *
4  *  Copyright (c) 2001-2003     Hiroyuki Kondo, Hirokazu Takata,
5  *                              Hitoshi Yamamoto, Takeo Takahashi
6  *  Copyright (c) 2004          Hirokazu Takata
7  */
8
9         .text
10 #include <linux/config.h>
11 #include <linux/linkage.h>
12 #include <asm/addrspace.h>
13 #include <asm/page.h>
14 #include <asm/assembler.h>
15
16         .global startup
17         __ALIGN
18 startup:
19         ldi     r0, #0x0000                     /* SPI, disable EI */
20         mvtc    r0, psw
21
22 /*
23  * Clear BSS first so that there are no surprises...
24  */
25 #ifdef CONFIG_ISA_DUAL_ISSUE
26
27         LDIMM   (r2, __bss_start)
28         LDIMM   (r3, _end)
29         sub     r3, r2          ; BSS size in bytes
30         ; R4 = BSS size in longwords (rounded down)
31         mv      r4, r3              ||  ldi     r1, #0
32         srli    r4, #4              ||  addi    r2, #-4
33         beqz    r4, .Lendloop1
34 .Lloop1:
35 #ifndef CONFIG_CHIP_M32310
36         ; Touch memory for the no-write-allocating cache.
37         ld      r0, @(4,r2)
38 #endif
39         st      r1, @+r2            ||  addi    r4, #-1
40         st      r1, @+r2
41         st      r1, @+r2
42         st      r1, @+r2            ||  cmpeq   r1, r4  ; R4 = 0?
43         bnc     .Lloop1
44 .Lendloop1:
45         and3    r4, r3, #15
46         addi    r2, #4
47         beqz    r4, .Lendloop2
48 .Lloop2:
49         stb     r1, @r2             ||  addi    r4, #-1
50         addi    r2, #1
51         bnez    r4, .Lloop2
52 .Lendloop2:
53
54 #else /* not CONFIG_ISA_DUAL_ISSUE */
55
56         LDIMM   (r2, __bss_start)
57         LDIMM   (r3, _end)
58         sub     r3, r2          ; BSS size in bytes
59         mv      r4, r3
60         srli    r4, #2          ; R4 = BSS size in longwords (rounded down)
61         ldi     r1, #0          ; clear R1 for longwords store
62         addi    r2, #-4         ; account for pre-inc store
63         beqz    r4, .Lendloop1  ; any more to go?
64 .Lloop1:
65         st      r1, @+r2        ; yep, zero out another longword
66         addi    r4, #-1         ; decrement count
67         bnez    r4, .Lloop1     ; go do some more
68 .Lendloop1:
69         and3    r4, r3, #3      ; get no. of remaining BSS bytes to clear
70         addi    r2, #4          ; account for pre-inc store
71         beqz    r4, .Lendloop2  ; any more to go?
72 .Lloop2:
73         stb     r1, @r2         ; yep, zero out another byte
74         addi    r2, #1          ; bump address
75         addi    r4, #-1         ; decrement count
76         bnez    r4, .Lloop2     ; go do some more
77 .Lendloop2:
78
79 #endif /* not CONFIG_ISA_DUAL_ISSUE */
80
81         seth    r0, #shigh(stack_start)
82         ld      sp, @(r0, low(stack_start))     /* set stack point */
83
84 /*
85  * decompress the kernel
86  */
87         bl      decompress_kernel
88
89 #if defined(CONFIG_CHIP_M32700)
90         /* Cache flush */
91         ldi     r0, -1
92         ldi     r1, 0xd0        ; invalidate i-cache, copy back d-cache
93         stb     r1, @r0
94 #else
95 #error "put your cache flush function, please"
96 #endif
97         seth    r0, #high(CONFIG_MEMORY_START)
98         or3     r0, r0, #0x2000
99         jmp     r0
100
101         .balign 512
102 fake_headers_as_bzImage:
103         .short  0
104         .ascii  "HdrS"
105         .short  0x0202
106         .short  0
107         .short  0
108         .byte   0x00, 0x10
109         .short  0
110         .byte   0
111         .byte   1
112         .byte   0x00, 0x80
113         .long   0
114         .long   0
115