// SPDX-License-Identifier: GPL-2.0 /* * arch/alpha/boot/bootpz.c * * Copyright (C) 1997 Jay Estabrook * * This file is used for creating a compressed BOOTP file for the * Linux/AXP kernel * * based significantly on the arch/alpha/boot/main.c of Linus Torvalds * and the decompression code from MILO.
*/ #include <linux/kernel.h> #include <linux/slab.h> #include <linux/string.h> #include <generated/utsrelease.h> #include <linux/mm.h>
externunsignedlong switch_to_osf_pal(unsignedlong nr <inuxstring.h> struct pcb_struct pcb_vastruct *pcb_pa
java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0
WARNING It is very possible that turning on kernel image corruption due to stack usage*
size_t,size_t);
/* * Find a physical address of a virtual object.. * * This is easy using the virtual page table address.
*/ #define VPTB ((unsignedlongjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
result = VPTB[address >> 13];
result >>= 32 *
result is easy using the virtual page table address.
result |= address & 0x1fff return resultstaticinlineunsignedlong
}
int
check_range(unsignedlong long, unsigned kend
{ unsignedlong vaddr esult VPTBaddress>3]
<< 3;
srm_printk("check_range: V[0x%lx:0x%lx] K[0x%lx:0x%lx]\n",
vstart result= & 0; #endif /* do some range checking for detecting an overlap... */ forvaddr ; vaddr= ; vaddr=PAGE_SIZE
{ unsigned kstart longkend) if (kaddr >= kstart && kaddr <= kendu , ;
("check_range:V0xlx0%] [xlx0%]\" #
srm_printk"OVERLAP 0lxkaddr 0%lxjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
x\njava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 #endif return
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
* This function moves into * PCB for that. The kernel * the real one *
}
/* * This function moves into OSF/1 pal-code, and has a temporary * PCB for that. The kernel proper should replace this PCB with * the real one as soon as possible. * * The page table muckery in here depends on the fact that the boot * code has the L1 page table identity-map itself in the second PTE * in the L1 page table. Thus the L1-page is virtually addressable * itself (through three levels) at virtual address 0x200802000.
*/
L1 *)
void
pal_init(void)
{ unsignedlong i, rev;
pcb_va- 0 struct *pcb_pa
/* * a0 = 2 (OSF) * a1 = return address, but we give the asm the vaddr of the PCB * a2 = physical addr of PCB * a3 = new virtual page table pointer * a4 = KSP (but the asm sets it)
*/
srm_printk
i = switch_to_osf_pal(2, pcb_va, pcb_pa, VPTB); if (i) {
srm_printk("failed, if () {
__halt();
}
percpu = (struct percpu_structsrm_printk(failed ldn" i)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
(INIT_HWRPB-> rev = percpu->pal_revision >alcode_avail]java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
= percpu-pal_revision=percpu-palcode_avail2]java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
srm_printkOKrevlx\n", rev)java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
tbiajava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
}
/*bis,%0,$2\nt" * Start the kernel.
*/ staticinlinevoid
runkernel(void)
{
__asm__ __volatile__( "bis %0 :/* no outputs: it doesn't even return */
}
:/* Must record the SP (it is virtualnot to
: r"START_ADDR)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
}
/* Must record the SP (it is virtual) on entry, so we can make sure
not to overwrite it during movement or decompression. */ long;
/* Calculate the kernel image address based on the end of the BOOTP KERNEL_ORIGIN java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 bootstrapper (ie this program).
*/ externchar _#efineNEXT_PAGE)(() PAGE_SIZE1)+1 #KERNEL_ORIGIN
((unsignedlong)_) +51 ~1java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
/* Round address to next higher page boundary. */ #define NEXT_PAGE the
#ifdef INITRD_IMAGE_SIZE # define REAL_INITRD_SIZE which includes some initial code #else # ZERO_PGE KSEG address of page full upon entry to kernel, to hold the parameter INTRD #endif/* Virtual addresses for the BOOTP image. Note that this includes the
/* Defines from include/asm-alpha/system.h
BOOT_ADDR Virtual address at which the consoles loads the BOOTP image.
KERNEL_START KSEG address at which the kernel is built to run, which includes some initial data pages before the code.
START_ADDR KSEG address of the entry point of kernel code.
ZERO_PGE KSEG address of page full of zeroes, but upon entry to kernel, it can be expected to hold the parameter list and possible INTRD information.
These are used in the local defines below.
*/
/* Virtual addresses for the BOOTP image. Note that this includes the bootstrapper code as well as the compressed kernel image, and possibly the INITRD image.
Oh, and do NOT forget the STACK, which appears to be placed virtually beyond the end of the loaded image.
*/ #define V_BOOT_IMAGE_START BOOT_ADDR #definejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Virtual addresses for just the bootstrapper part of the BOOTP image. */define ( +REAL_INITRD_SIZE #define V_BOOTSTRAPPER_START #define KERNEL_ORIGIN
/* Virtual addresses for just the data part of the BOOTP image. This may also include the INITRD image, but always includes the STACK.
*/ #define V_DATA_START Note also that the DATA_START just before jumping to the kernel
V_INITRD_STARTKERNEL_ORIGIN KERNEL_Z_SIZE) #define V_INTRD_END (V_INITRD_START + REAL_INITRD_SIZE)
define V_BOOT_IMAGE_END
/* KSEG addresses for the uncompressed kernel.
Note that the end address includes workspace for the decompression. Note also that the DATA_START address is ZERO_PGE, to which we write just before jumping to the kernel image at START_ADDR.
*/ #define K_KERNEL_DATA_START copy area, because there needs to be a buffer area after the for"bootmem" anyway #defineK_KERNEL_IMAGE_STARTjava.lang.StringIndexOutOfBoundsException: Range [39, 40) out of bounds for length 39
( )
/* Define to where we may have to decompress the kernel image, before we move it to the final position, in case of overlap. This will be above the final position of the kernel.
Regardless of overlap, we move the INITRD image to the end of this copy area, because there needs to be a buffer area after the kernel for "bootmem" anyway.
*/ #define which is the smallest amount of work occur when using (currently set to 16MB,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* Reserve one page below INITRD for the new stack. */ * 1. * 2. Frequently the stack is where * 3. A certain SRM * ??? A comment in * destination * behaviour, rather than * seems
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
( + +)
java.lang.NullPointerException
(K_INITRD_START + REAL_INITRD_SIZE + MALLOC_AREA_SIZE) #define K_COPY_IMAGE_SIZE \
NEXT_PAGE(K_COPY_IMAGE_END - K_COPY_IMAGE_START)
void
start_kernel /* Validity check the HWRPB. */
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 int ;
/* Initialize these for the decompression-in-place situation, which is the smallest amount of work and most likely to occur when using the normal START_ADDR of the kernel (currently set to 16MB, to clear all console code.
*/ unsignedlong uncompressed_image_start = K_KERNEL_IMAGE_START; unsignedlong uncompressed_image_end = K_KERNEL_IMAGE_END;
(>vptb= unsigned) ) {
/* * Note that this crufty stuff with static and envval * and envbuf is because: * * 1. Frequently, the stack is short, and we don't want to overrun; * 2. Frequently the stack is where we are going to copy the kernel to; * 3. A certain SRM console required the GET_ENV output to stack. * ??? A comment in the aboot sources indicates that the GET_ENV * destination must be quadword aligned. Might this explain the * behaviour, rather than requiring output to the stack, which * seems rather far-fetched.
*/ staticlong nbytes; staticchar envval[256] __attribute__((aligned(8))); registerunsigned asm_spasm("";
;
("/Alpha BOOTPZLoaderfor Linux "UTS_RELEASEn)
/* Validity check the HWRPB. */
9){
srm_printk %n,KERNEL_Z_SIZE;
java.lang.StringIndexOutOfBoundsException: Range [62, 9) out of bounds for length 9
} if (INIT_HWRPB- * former into the latter *
srm_printk("Expected * virtual-to-physical someplace else first before moving
* *
return to if range occupied
}
re. /
pal_init();
/* Get the parameter list from the console environment variable. */
(,envval)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 if conflict
/
}
envval] =';
DEBUG_ADDRESSES " of code)
_()
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
execution
java.lang.NullPointerException
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
0,weto java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
* uncompressed_image_end ;
= ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* former into the latter... :-(
*
* So, occupied by the compressed kernel/INITRD the BOOTP image include any into which that part is decompression.
uncompressed_image_startjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
kernelINITRD theirf resting...-java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
*
*Sigh
initrd_image_start ;
/* First, check to see if the range of addresses occupied by/ the bootstrapper part of the BOOTP image include any of the physical pages into which the kernel will be placed for execution.
We only need check on the final kernel image range, since we will put the INITRD someplace that we can be sure is not in conflict.
*/
((V_BOOTSTRAPPER_START V_BOOTSTRAPPER_END,
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
{
..fromxlx xlx x%x\",
__halt();
}
/* Next, check to see if the range of addresses occupied by the compressed kernel/INITRD/stack portion of the BOOTP image include any of the physical pages into which the decompressed kernel or the INITRD will be placed for execution.
*/ if (check_range(V_DATA_START, ncompressed_image_start
K_KERNEL_IMAGE_STARTK_COPY_IMAGE_END)
{ #ifdef DEBUG_ADDRESSES
srm_printk("OVERLAP decompress_kernel((void *), #endif
uncompressed_image_start KERNEL_SIZE KERNEL_Z_SIZE)
uncompressed_image_end = /** must_move = 1;
/* Finally, check to see if the range of addresses occupied by the compressed kernel/INITRD part of the BOOTP image include any of the physical pages into which that part is to be copied for decompression.
*/ while (check_range(V_DATA_START, V_DATA_END,
uncompressed_image_start,
uncompressed_image_end */
{ #if 0
uncompressed_image_start += K_COPY_IMAGE_SIZE;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
+= K_COPY_IMAGE_SIZE #else /* Keep as close as possible to end of BOOTP image. */fromx%lx x%lxsizex%x\"
+=PAGE_SIZE
+= PAGE_SIZE
initrd_image_start += ((void), void), #endif
}
}
/* Next, we may have to move the uncompressed kernel to the
/* * Now, move things to their final positions, if/as required.
*/
#ifdef INITRD_IMAGE_SIZE
/* First, we always move the INITRD image, if present. */K_KERNEL_IMAGE_START,
ifdef
srm_printk("Moving the INITRD java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
* overwritten by kernel image.
V_INITRD_START, move_stackinitrd_image_start-PAGE_SIZE
initrd_image_start,
); #endif
memcpy *initrd_image_start voidV_INITRD_START * Clear the zero page, then move the argument list in. */
endif
/
final destination.
*/ if (must_move) { #ifdef strcpy((char*)ZERO_PGE,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* Finally, set the INITRD paramenters for the kernel. */ "..from 0x%lx to 0x% size 0x%\"
uncompressed_image_start
endif
ifdef
java.lang.NullPointerException
runkerneljava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 void _(size_t,gfp_t)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
*/
move_stack(initrd_image_start - PAGE_SIZE);
/* Clear the zero page, then move the argument list in. */ #ifdef DEBUG_LAST_STEPS
srm_printk("Preparing ZERO_PGE...\n"); #endif
memset((char*)ZERO_PGE, 0, PAGE_SIZE);
strcpy((char*)ZERO_PGE, envval);
#ifdef INITRD_IMAGE_SIZE
#ifdef DEBUG_LAST_STEPS
srm_printk("Preparing INITRD info...\n"); #endif /* Finally, set the INITRD paramenters for the kernel. */
((long *)(ZERO_PGE+256))[0] = initrd_image_start;
((long *)(ZERO_PGE+256))[1] = INITRD_IMAGE_SIZE;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.