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/config.h>
11 #include <linux/linkage.h>
12 #include <asm/addrspace.h>
14 #include <asm/assembler.h>
17 * This code can be loaded anywhere, as long as output will not
20 * NOTE: This head.S should *NOT* be compiled with -fpic.
25 .global __bss_start, _ebss, end, zimage_data, zimage_len
28 ldi r0, #0x0000 /* SPI, disable EI */
35 seth r1, #high(CONFIG_MEMORY_START + 0x00400000) /* Start address */
36 add r12, r14 /* Real address */
37 sub r12, r1 /* difference */
40 seth r3, #high(_GLOBAL_OFFSET_TABLE_+8)
41 or3 r3, r3, #low(_GLOBAL_OFFSET_TABLE_+12)
44 /* Update the contents of global offset table */
58 /* XXX: resolve plt */
61 * Clear BSS first so that there are no surprises...
63 #ifdef CONFIG_ISA_DUAL_ISSUE
64 seth r2, #high(__bss_start)
65 or3 r2, r2, #low(__bss_start)
68 or3 r3, r3, #low(_ebss)
72 ; R4 = BSS size in longwords (rounded down)
73 mv r4, r3 || ldi r1, #0
74 srli r4, #4 || addi r2, #-4
77 #ifndef CONFIG_CHIP_M32310
78 ; Touch memory for the no-write-allocating cache.
81 st r1, @+r2 || addi r4, #-1
84 st r1, @+r2 || cmpeq r1, r4 ; R4 = 0?
91 stb r1, @r2 || addi r4, #-1
96 #else /* not CONFIG_ISA_DUAL_ISSUE */
97 seth r2, #high(__bss_start)
98 or3 r2, r2, #low(__bss_start)
100 seth r3, #high(_ebss)
101 or3 r3, r3, #low(_ebss)
105 srli r4, #2 ; R4 = BSS size in longwords (rounded down)
106 ldi r1, #0 ; clear R1 for longwords store
107 addi r2, #-4 ; account for pre-inc store
108 beqz r4, .Lendloop1 ; any more to go?
110 st r1, @+r2 ; yep, zero out another longword
111 addi r4, #-1 ; decrement count
112 bnez r4, .Lloop1 ; go do some more
115 #endif /* not CONFIG_ISA_DUAL_ISSUE */
118 or3 r1, r1, #low(end)
123 * decompress the kernel
126 srli r0, 31 /* MMU is ON or OFF */
127 seth r1, #high(zimage_data)
128 or3 r1, r1, #low(zimage_data)
130 seth r2, #high(zimage_len)
131 or3 r2, r2, #low(zimage_len)
136 #if defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_VDEC2)
139 ldi r1, 0xd0 ; invalidate i-cache, copy back d-cache
141 #elif defined(CONFIG_CHIP_M32102)
144 ldi r1, 0x0100 ; invalidate
146 #elif defined(CONFIG_CHIP_M32104)
149 ldi r1, 0x0700 ; invalidate i-cache, copy back d-cache
152 #error "put your cache flush function, please"
156 srli r0, 31 /* MMU is ON or OFF */
159 seth r1, #high(CONFIG_MEMORY_START)
164 fake_headers_as_bzImage: