12 #include <linux/kernel.h>
13 #include <linux/slab.h>
14 #include <linux/string.h>
15 #include <generated/utsrelease.h>
20 #include <asm/pgtable.h>
28 #define MALLOC_AREA_SIZE 0x200000
40 #undef DEBUG_CHECK_RANGE
41 #undef DEBUG_ADDRESSES
42 #undef DEBUG_LAST_STEPS
49 size_t ksize,
size_t kzsize);
51 extern void move_stack(
unsigned long new_stack);
61 #define VPTB ((unsigned long *) 0x200000000)
63 static inline unsigned long
68 result =
VPTB[address >> 13];
71 result |= address & 0x1fff;
77 unsigned long kstart,
unsigned long kend)
79 unsigned long vaddr, kaddr;
81 #ifdef DEBUG_CHECK_RANGE
82 srm_printk(
"check_range: V[0x%lx:0x%lx] K[0x%lx:0x%lx]\n",
83 vstart, vend, kstart, kend);
89 if (kaddr >= kstart && kaddr <= kend)
91 #ifdef DEBUG_CHECK_RANGE
94 vaddr, kaddr, kstart, kend);
113 #define L1 ((unsigned long *) 0x200802000)
118 unsigned long i,
rev;
125 pcb_va->ptbr =
L1[1] >> 32;
132 pcb_pa = (
struct pcb_struct *)find_pa((
unsigned long)pcb_va);
179 #define KERNEL_ORIGIN \
180 ((((unsigned long)&_end) + 511) & ~511)
183 #define NEXT_PAGE(a) (((a) | (PAGE_SIZE - 1)) + 1)
185 #ifdef INITRD_IMAGE_SIZE
186 # define REAL_INITRD_SIZE INITRD_IMAGE_SIZE
188 # define REAL_INITRD_SIZE 0
218 #define V_BOOT_IMAGE_START BOOT_ADDR
219 #define V_BOOT_IMAGE_END SP_on_entry
222 #define V_BOOTSTRAPPER_START BOOT_ADDR
223 #define V_BOOTSTRAPPER_END KERNEL_ORIGIN
229 #define V_DATA_START KERNEL_ORIGIN
230 #define V_INITRD_START (KERNEL_ORIGIN + KERNEL_Z_SIZE)
231 #define V_INTRD_END (V_INITRD_START + REAL_INITRD_SIZE)
232 #define V_DATA_END V_BOOT_IMAGE_END
240 #define K_KERNEL_DATA_START ZERO_PGE
241 #define K_KERNEL_IMAGE_START START_ADDR
242 #define K_KERNEL_IMAGE_END (START_ADDR + KERNEL_SIZE)
252 #define K_COPY_IMAGE_START NEXT_PAGE(K_KERNEL_IMAGE_END)
254 #define K_INITRD_START \
255 NEXT_PAGE(K_COPY_IMAGE_START + KERNEL_SIZE + PAGE_SIZE)
256 #define K_COPY_IMAGE_END \
257 (K_INITRD_START + REAL_INITRD_SIZE + MALLOC_AREA_SIZE)
258 #define K_COPY_IMAGE_SIZE \
259 NEXT_PAGE(K_COPY_IMAGE_END - K_COPY_IMAGE_START)
290 register unsigned long asm_sp
asm(
"30");
292 SP_on_entry = asm_sp;
294 srm_printk(
"Linux/Alpha BOOTPZ Loader for Linux " UTS_RELEASE
"\n");
313 if (nbytes < 0 || nbytes >=
sizeof(envval)) {
318 #ifdef DEBUG_ADDRESSES
321 srm_printk(
"KERNEL_SIZE 0x%x\n", KERNEL_SIZE);
322 srm_printk(
"KERNEL_Z_SIZE 0x%x\n", KERNEL_Z_SIZE);
351 srm_printk(
"FATAL ERROR: overlap of bootstrapper code\n");
364 #ifdef DEBUG_ADDRESSES
365 srm_printk(
"OVERLAP: cannot decompress in place\n");
378 uncompressed_image_start,
379 uncompressed_image_end))
394 srm_printk(
"Starting to load the kernel with args '%s'\n", envval);
396 #ifdef DEBUG_ADDRESSES
398 "...from 0x%lx to 0x%lx size 0x%x\n",
400 uncompressed_image_start,
405 KERNEL_SIZE, KERNEL_Z_SIZE);
411 #ifdef INITRD_IMAGE_SIZE
414 #ifdef DEBUG_ADDRESSES
416 " from 0x%lx to 0x%lx size 0x%x\n",
430 #ifdef DEBUG_ADDRESSES
431 srm_printk(
"Moving the uncompressed kernel...\n"
432 "...from 0x%lx to 0x%lx size 0x%x\n",
433 uncompressed_image_start,
435 (
unsigned)KERNEL_SIZE);
444 (
void *)uncompressed_image_start, KERNEL_SIZE);
448 #ifdef DEBUG_LAST_STEPS
454 #ifdef INITRD_IMAGE_SIZE
456 #ifdef DEBUG_LAST_STEPS
460 ((
long *)(
ZERO_PGE+256))[0] = initrd_image_start;
461 ((
long *)(
ZERO_PGE+256))[1] = INITRD_IMAGE_SIZE;
465 #ifdef DEBUG_LAST_STEPS