elf_64.c (c95baf12f5077419db01313ab61c2aac007d40cd) elf_64.c (19031275a5881233b4fc31b7dee68bf0b0758bbc)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Load ELF vmlinux file for the kexec_file_load syscall.
4 *
5 * Copyright (C) 2004 Adam Litke (agl@us.ibm.com)
6 * Copyright (C) 2004 IBM Corp.
7 * Copyright (C) 2005 R Sharada (sharada@in.ibm.com)
8 * Copyright (C) 2006 Mohan Kumar M (mohan@in.ibm.com)

--- 74 unchanged lines hidden (view full) ---

83 }
84 ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
85 if (ret < 0) {
86 pr_err("Error setting up the new device tree.\n");
87 ret = -EINVAL;
88 goto out;
89 }
90
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Load ELF vmlinux file for the kexec_file_load syscall.
4 *
5 * Copyright (C) 2004 Adam Litke (agl@us.ibm.com)
6 * Copyright (C) 2004 IBM Corp.
7 * Copyright (C) 2005 R Sharada (sharada@in.ibm.com)
8 * Copyright (C) 2006 Mohan Kumar M (mohan@in.ibm.com)

--- 74 unchanged lines hidden (view full) ---

83 }
84 ret = fdt_open_into(initial_boot_params, fdt, fdt_size);
85 if (ret < 0) {
86 pr_err("Error setting up the new device tree.\n");
87 ret = -EINVAL;
88 goto out;
89 }
90
91 ret = setup_new_fdt(image, fdt, initrd_load_addr, initrd_len, cmdline);
91 ret = setup_new_fdt_ppc64(image, fdt, initrd_load_addr,
92 initrd_len, cmdline);
92 if (ret)
93 goto out;
94
95 fdt_pack(fdt);
96
97 kbuf.buffer = fdt;
98 kbuf.bufsz = kbuf.memsz = fdt_size;
99 kbuf.buf_align = PAGE_SIZE;
100 kbuf.top_down = true;
101 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
102 ret = kexec_add_buffer(&kbuf);
103 if (ret)
104 goto out;
105 fdt_load_addr = kbuf.mem;
106
107 pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr);
108
109 slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset;
93 if (ret)
94 goto out;
95
96 fdt_pack(fdt);
97
98 kbuf.buffer = fdt;
99 kbuf.bufsz = kbuf.memsz = fdt_size;
100 kbuf.buf_align = PAGE_SIZE;
101 kbuf.top_down = true;
102 kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
103 ret = kexec_add_buffer(&kbuf);
104 if (ret)
105 goto out;
106 fdt_load_addr = kbuf.mem;
107
108 pr_debug("Loaded device tree at 0x%lx\n", fdt_load_addr);
109
110 slave_code = elf_info.buffer + elf_info.proghdrs[0].p_offset;
110 ret = setup_purgatory(image, slave_code, fdt, kernel_load_addr,
111 fdt_load_addr);
111 ret = setup_purgatory_ppc64(image, slave_code, fdt, kernel_load_addr,
112 fdt_load_addr);
112 if (ret)
113 pr_err("Error setting up the purgatory.\n");
114
115out:
116 kexec_free_elf_info(&elf_info);
117
118 /* Make kimage_file_post_load_cleanup free the fdt buffer for us. */
119 return ret ? ERR_PTR(ret) : fdt;
120}
121
122const struct kexec_file_ops kexec_elf64_ops = {
123 .probe = kexec_elf_probe,
124 .load = elf64_load,
125};
113 if (ret)
114 pr_err("Error setting up the purgatory.\n");
115
116out:
117 kexec_free_elf_info(&elf_info);
118
119 /* Make kimage_file_post_load_cleanup free the fdt buffer for us. */
120 return ret ? ERR_PTR(ret) : fdt;
121}
122
123const struct kexec_file_ops kexec_elf64_ops = {
124 .probe = kexec_elf_probe,
125 .load = elf64_load,
126};