Deleted Added
full compact
ppc64_elf_freebsd.c (277997) ppc64_elf_freebsd.c (291598)
1/*-
2 * Copyright (c) 2001 Benno Rice <benno@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Benno Rice <benno@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c 277997 2015-01-31 19:42:08Z nwhitehorn $");
28__FBSDID("$FreeBSD: head/sys/boot/powerpc/kboot/ppc64_elf_freebsd.c 291598 2015-12-01 17:01:27Z nwhitehorn $");
29
30#define __ELF_WORD_SIZE 64
31
32#include <sys/param.h>
33#include <sys/linker.h>
34
35#include <machine/metadata.h>
36#include <machine/elf.h>

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

73 if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
74 return(EFTYPE);
75 }
76 e = (Elf_Ehdr *)&fmp->md_data;
77
78 /* Figure out where to put it */
79 trampolinebase = archsw.arch_loadaddr(LOAD_RAW, NULL, 0);
80
29
30#define __ELF_WORD_SIZE 64
31
32#include <sys/param.h>
33#include <sys/linker.h>
34
35#include <machine/metadata.h>
36#include <machine/elf.h>

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

73 if ((fmp = file_findmetadata(fp, MODINFOMD_ELFHDR)) == NULL) {
74 return(EFTYPE);
75 }
76 e = (Elf_Ehdr *)&fmp->md_data;
77
78 /* Figure out where to put it */
79 trampolinebase = archsw.arch_loadaddr(LOAD_RAW, NULL, 0);
80
81 /* Set up interesting values in function descriptor */
81 /* Set up loader trampoline */
82 trampoline = malloc(szkerneltramp);
83 memcpy(trampoline, &kerneltramp, szkerneltramp);
82 trampoline = malloc(szkerneltramp);
83 memcpy(trampoline, &kerneltramp, szkerneltramp);
84 archsw.arch_copyout(e->e_entry + elf64_relocation_offset, &entry, 8);
84 /* Parse function descriptor for ELFv1 kernels */
85 if ((e->e_flags & 3) == 2)
86 entry = e->e_entry;
87 else
88 archsw.arch_copyout(e->e_entry + elf64_relocation_offset,
89 &entry, 8);
85 trampoline[2] = entry + elf64_relocation_offset;
86 trampoline[4] = 0; /* Phys. mem offset */
87 trampoline[5] = 0; /* OF entry point */
88
89 if ((error = md_load64(fp->f_args, &mdp, &dtb)) != 0)
90 return (error);
91
92 trampoline[3] = dtb;

--- 27 unchanged lines hidden ---
90 trampoline[2] = entry + elf64_relocation_offset;
91 trampoline[4] = 0; /* Phys. mem offset */
92 trampoline[5] = 0; /* OF entry point */
93
94 if ((error = md_load64(fp->f_args, &mdp, &dtb)) != 0)
95 return (error);
96
97 trampoline[3] = dtb;

--- 27 unchanged lines hidden ---