arch/s390/kernel/machine_kexec_file.c

Source file repositories/reference/linux-study-clean/arch/s390/kernel/machine_kexec_file.c

File Facts

System
Linux kernel
Corpus path
arch/s390/kernel/machine_kexec_file.c
Extension
.c
Size
9317 bytes
Lines
392
Domain
Architecture Layer
Bucket
arch/s390
Inferred role
Architecture Layer: implementation source
Status
source implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

if (sym->st_shndx == SHN_UNDEF) {
			pr_err("Undefined symbol: %s\n", name);
			return -ENOEXEC;
		}

		if (sym->st_shndx == SHN_COMMON) {
			pr_err("symbol '%s' in common section\n", name);
			return -ENOEXEC;
		}

		if (sym->st_shndx >= pi->ehdr->e_shnum &&
		    sym->st_shndx != SHN_ABS) {
			pr_err("Invalid section %d for symbol %s\n",
			       sym->st_shndx, name);
			return -ENOEXEC;
		}

		loc = pi->purgatory_buf;
		loc += section->sh_offset;
		loc += relas[i].r_offset;

		val = sym->st_value;
		if (sym->st_shndx != SHN_ABS)
			val += pi->sechdrs[sym->st_shndx].sh_addr;
		val += relas[i].r_addend;

		addr = section->sh_addr + relas[i].r_offset;

		r_type = ELF64_R_TYPE(relas[i].r_info);

		if (r_type == R_390_PLT32DBL)
			r_type = R_390_PC32DBL;

		ret = arch_kexec_do_relocs(r_type, loc, val, addr);
		if (ret) {
			pr_err("Unknown rela relocation: %d\n", r_type);
			return -ENOEXEC;
		}
	}
	return 0;
}

int arch_kimage_file_post_load_cleanup(struct kimage *image)
{
	vfree(image->arch.ipl_buf);
	image->arch.ipl_buf = NULL;

	return kexec_image_post_load_cleanup_default(image);
}

Annotation

Implementation Notes