Lines 78-88
static pml4_entry_t *PT4;
Link Here
|
78 |
static pdp_entry_t *PT3; |
78 |
static pdp_entry_t *PT3; |
79 |
static pd_entry_t *PT2; |
79 |
static pd_entry_t *PT2; |
80 |
|
80 |
|
81 |
static void (*trampoline)(uint64_t stack, void *copy_finish, uint64_t kernend, |
81 |
static void (*trampoline)(uint64_t stack, uint64_t kernend, |
82 |
uint64_t modulep, pml4_entry_t *pagetable, uint64_t entry); |
82 |
uint64_t modulep, pml4_entry_t *pagetable, uint64_t entry, |
|
|
83 |
uint64_t copy_dst, uint64_t copy_src, uint64_t copy_src_end); |
83 |
|
84 |
|
84 |
extern uintptr_t amd64_tramp; |
85 |
extern uintptr_t amd64_tramp_inline; |
85 |
extern uint32_t amd64_tramp_size; |
86 |
extern uint32_t amd64_tramp_inline_size; |
86 |
|
87 |
|
87 |
/* |
88 |
/* |
88 |
* There is an ELF kernel and one or more ELF modules loaded. |
89 |
* There is an ELF kernel and one or more ELF modules loaded. |
Lines 95-100
elf64_exec(struct preloaded_file *fp)
Link Here
|
95 |
struct file_metadata *md; |
96 |
struct file_metadata *md; |
96 |
Elf_Ehdr *ehdr; |
97 |
Elf_Ehdr *ehdr; |
97 |
vm_offset_t modulep, kernend, trampcode, trampstack; |
98 |
vm_offset_t modulep, kernend, trampcode, trampstack; |
|
|
99 |
uint64_t copy_dst, copy_src, copy_src_end; |
98 |
int err, i; |
100 |
int err, i; |
99 |
ACPI_TABLE_RSDP *rsdp; |
101 |
ACPI_TABLE_RSDP *rsdp; |
100 |
char buf[24]; |
102 |
char buf[24]; |
Lines 153-159
elf64_exec(struct preloaded_file *fp)
Link Here
|
153 |
(EFI_PHYSICAL_ADDRESS *)&trampcode); |
155 |
(EFI_PHYSICAL_ADDRESS *)&trampcode); |
154 |
bzero((void *)trampcode, EFI_PAGE_SIZE); |
156 |
bzero((void *)trampcode, EFI_PAGE_SIZE); |
155 |
trampstack = trampcode + EFI_PAGE_SIZE - 8; |
157 |
trampstack = trampcode + EFI_PAGE_SIZE - 8; |
156 |
bcopy((void *)&amd64_tramp, (void *)trampcode, amd64_tramp_size); |
158 |
bcopy((void *)&amd64_tramp_inline, (void *)trampcode, amd64_tramp_inline_size); |
157 |
trampoline = (void *)trampcode; |
159 |
trampoline = (void *)trampcode; |
158 |
|
160 |
|
159 |
PT4 = (pml4_entry_t *)0x0000000040000000; |
161 |
PT4 = (pml4_entry_t *)0x0000000040000000; |
Lines 194-201
elf64_exec(struct preloaded_file *fp)
Link Here
|
194 |
|
196 |
|
195 |
dev_cleanup(); |
197 |
dev_cleanup(); |
196 |
|
198 |
|
197 |
trampoline(trampstack, efi_copy_finish, kernend, modulep, PT4, |
199 |
efi_copy_get_locations(©_dst, ©_src, ©_src_end); |
198 |
ehdr->e_entry); |
200 |
|
|
|
201 |
trampoline(trampstack, kernend, modulep, PT4, |
202 |
ehdr->e_entry, copy_dst, copy_src, copy_src_end); |
199 |
|
203 |
|
200 |
panic("exec returned"); |
204 |
panic("exec returned"); |
201 |
} |
205 |
} |