mirror of
				https://github.com/meizu-m86/kexec-tools-arm64
				synced 2025-11-04 13:56:01 +08:00 
			
		
		
		
	Make purgatory a signed char buffer
The consumer of the purgatory buffer, elf_rel_build_load() expects a signed char buffer. Signed-off-by: Simon Horman <horms@verge.net.au>
This commit is contained in:
		@@ -200,10 +200,10 @@ int do_bzImage_load(struct kexec_info *info,
 | 
			
		||||
	 * overflow takes place while applying relocations.
 | 
			
		||||
	 */
 | 
			
		||||
	if (!real_mode_entry && relocatable_kernel)
 | 
			
		||||
		elf_rel_build_load(info, &info->rhdr, (char *) purgatory, purgatory_size,
 | 
			
		||||
		elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
 | 
			
		||||
					0x3000, 0x7fffffff, -1, 0);
 | 
			
		||||
	else
 | 
			
		||||
		elf_rel_build_load(info, &info->rhdr, (char *) purgatory, purgatory_size,
 | 
			
		||||
		elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
 | 
			
		||||
					0x3000, 640*1024, -1, 0);
 | 
			
		||||
	dbgprintf("Loaded purgatory at addr 0x%lx\n", info->rhdr.rel_addr);
 | 
			
		||||
	/* The argument/parameter segment */
 | 
			
		||||
 
 | 
			
		||||
@@ -191,7 +191,7 @@ int elf_x86_load(int argc, char **argv, const char *buf, off_t len,
 | 
			
		||||
	/* Do we want arguments? */
 | 
			
		||||
	if (arg_style != ARG_STYLE_NONE) {
 | 
			
		||||
		/* Load the setup code */
 | 
			
		||||
		elf_rel_build_load(info, &info->rhdr, (char *) purgatory, purgatory_size,
 | 
			
		||||
		elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size,
 | 
			
		||||
			0, ULONG_MAX, 1, 0);
 | 
			
		||||
	}
 | 
			
		||||
	if (arg_style == ARG_STYLE_NONE) {
 | 
			
		||||
 
 | 
			
		||||
@@ -217,7 +217,7 @@ int multiboot_x86_load(int argc, char **argv, const char *buf, off_t len,
 | 
			
		||||
	elf_exec_build_load(info, &ehdr, buf, len, 0);
 | 
			
		||||
 | 
			
		||||
	/* Load the setup code */
 | 
			
		||||
	elf_rel_build_load(info, &info->rhdr, (char *) purgatory, purgatory_size, 0,
 | 
			
		||||
	elf_rel_build_load(info, &info->rhdr, purgatory, purgatory_size, 0,
 | 
			
		||||
				ULONG_MAX, 1, 0);
 | 
			
		||||
	
 | 
			
		||||
	/* The first segment will contain the multiboot headers:
 | 
			
		||||
 
 | 
			
		||||
@@ -207,7 +207,7 @@ int elf_ppc64_load(int argc, char **argv, const char *buf, off_t len,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Add v2wrap to the current image */
 | 
			
		||||
	elf_rel_build_load(info, &info->rhdr, (const char *)purgatory,
 | 
			
		||||
	elf_rel_build_load(info, &info->rhdr, purgatory,
 | 
			
		||||
				purgatory_size, 0, max_addr, 1, 0);
 | 
			
		||||
 | 
			
		||||
	/* Add a ram-disk to the current image
 | 
			
		||||
 
 | 
			
		||||
@@ -226,7 +226,7 @@ extern void arch_reuse_initrd(void);
 | 
			
		||||
 | 
			
		||||
extern int ifdown(void);
 | 
			
		||||
 | 
			
		||||
extern unsigned char purgatory[];
 | 
			
		||||
extern char purgatory[];
 | 
			
		||||
extern size_t purgatory_size;
 | 
			
		||||
 | 
			
		||||
#define BOOTLOADER "kexec"
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ int main(int argc, char **argv)
 | 
			
		||||
	int i;
 | 
			
		||||
	const char *name = argv[1];
 | 
			
		||||
	printf("#include <stddef.h>\n");
 | 
			
		||||
	printf("const unsigned char %s[] = {\n", name);
 | 
			
		||||
	printf("const char %s[] = {\n", name);
 | 
			
		||||
	i = 0;
 | 
			
		||||
	while((c = getchar()) != EOF) {
 | 
			
		||||
		if ((i % 16) != 0) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user