2 * linux/arch/m32r/boot/compressed/head.S
4 * Copyright (c) 2001-2003 Hiroyuki Kondo, Hirokazu Takata,
5 * Hitoshi Yamamoto, Takeo Takahashi
6 * Copyright (c) 2004 Hirokazu Takata
10 #include <linux/linkage.h>
11 #include <asm/addrspace.h>
13 #include <asm/assembler.h>
16 * This code can be loaded anywhere, as long as output will not
19 * NOTE: This head.S should *NOT* be compiled with -fpic.
24 .global __bss_start, _ebss, end, zimage_data, zimage_len
27 ldi r0, #0x0000 /* SPI, disable EI */
34 seth r1, #high(CONFIG_MEMORY_START + 0x00400000) /* Start address */
35 add r12, r14 /* Real address */
36 sub r12, r1 /* difference */
39 seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
40 or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
43 /* Update the contents of global offset table */
59 * Clear BSS first so that there are no surprises...
61 #ifdef CONFIG_ISA_DUAL_ISSUE
62 seth r2, #high(__bss_start)
63 or3 r2, r2, #low(__bss_start)
66 or3 r3, r3, #low(_ebss)
70 ; R4 = BSS size in longwords (rounded down)
71 mv r4, r3 || ldi r1, #0
72 srli r4, #4 || addi r2, #-4
75 #ifndef CONFIG_CHIP_M32310
76 ; Touch memory for the no-write-allocating cache.
79 st r1, @+r2 || addi r4, #-1
82 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
89 stb r1, @r2 || addi r4, #-1
94 #else /* not CONFIG_ISA_DUAL_ISSUE */
95 seth r2, #high(__bss_start)
96 or3 r2, r2, #low(__bss_start)
99 or3 r3, r3, #low(_ebss)
103 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
104 ldi r1, #0 ; clear R1 for longwords store
105 addi r2, #-4 ; account for pre-inc store
106 beqz r4, .Lendloop1 ; any more to go?
108 st r1, @+r2 ; yep, zero out another longword
109 addi r4, #-1 ; decrement count
110 bnez r4, .Lloop1 ; go do some more
113 #endif /* not CONFIG_ISA_DUAL_ISSUE */
116 or3 r1, r1, #low(end)
121 * decompress the kernel
124 srli r0, 31 /* MMU is ON or OFF */
125 seth r1, #high(zimage_data)
126 or3 r1, r1, #low(zimage_data)
128 seth r2, #high(zimage_len)
129 or3 r2, r2, #low(zimage_len)
134 #if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || \
135 defined(CONFIG_CHIP_VDEC2)
138 ldi r1, 0xd0 ; invalidate i-cache, copy back d-cache
140 #elif defined(CONFIG_CHIP_M32102)
143 ldi r1, 0x0100 ; invalidate
145 #elif defined(CONFIG_CHIP_M32104)
148 ldi r1, 0x0700 ; invalidate i-cache, copy back d-cache
151 #error "put your cache flush function, please"
155 srli r0, 31 /* MMU is ON or OFF */
158 seth r1, #high(CONFIG_MEMORY_START)
163 fake_headers_as_bzImage: