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 */
57 /* XXX: resolve plt */
60 * Clear BSS first so that there are no surprises...
62 #ifdef CONFIG_ISA_DUAL_ISSUE
63 seth r2, #high(__bss_start)
64 or3 r2, r2, #low(__bss_start)
67 or3 r3, r3, #low(_ebss)
71 ; R4 = BSS size in longwords (rounded down)
72 mv r4, r3 || ldi r1, #0
73 srli r4, #4 || addi r2, #-4
76 #ifndef CONFIG_CHIP_M32310
77 ; Touch memory for the no-write-allocating cache.
80 st r1, @+r2 || addi r4, #-1
83 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
90 stb r1, @r2 || addi r4, #-1
95 #else /* not CONFIG_ISA_DUAL_ISSUE */
96 seth r2, #high(__bss_start)
97 or3 r2, r2, #low(__bss_start)
100 or3 r3, r3, #low(_ebss)
104 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
105 ldi r1, #0 ; clear R1 for longwords store
106 addi r2, #-4 ; account for pre-inc store
107 beqz r4, .Lendloop1 ; any more to go?
109 st r1, @+r2 ; yep, zero out another longword
110 addi r4, #-1 ; decrement count
111 bnez r4, .Lloop1 ; go do some more
114 #endif /* not CONFIG_ISA_DUAL_ISSUE */
117 or3 r1, r1, #low(end)
122 * decompress the kernel
125 srli r0, 31 /* MMU is ON or OFF */
126 seth r1, #high(zimage_data)
127 or3 r1, r1, #low(zimage_data)
129 seth r2, #high(zimage_len)
130 or3 r2, r2, #low(zimage_len)
135 #if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || 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: