Changeset View
Changeset View
Standalone View
Standalone View
head/stand/efi/loader/arch/amd64/elf64_freebsd.c
Show First 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | elf64_exec(struct preloaded_file *fp) | ||||
/* | /* | ||||
* This is kinda brutal, but every single 1GB VM memory segment points | * This is kinda brutal, but every single 1GB VM memory segment points | ||||
* to the same first 1GB of physical memory. But it is more than | * to the same first 1GB of physical memory. But it is more than | ||||
* adequate. | * adequate. | ||||
*/ | */ | ||||
for (i = 0; i < 512; i++) { | for (i = 0; i < 512; i++) { | ||||
/* Each slot of the L4 pages points to the same L3 page. */ | /* Each slot of the L4 pages points to the same L3 page. */ | ||||
PT4[i] = (pml4_entry_t)PT3; | PT4[i] = (pml4_entry_t)PT3; | ||||
PT4[i] |= PG_V | PG_RW | PG_U; | PT4[i] |= PG_V | PG_RW; | ||||
/* Each slot of the L3 pages points to the same L2 page. */ | /* Each slot of the L3 pages points to the same L2 page. */ | ||||
PT3[i] = (pdp_entry_t)PT2; | PT3[i] = (pdp_entry_t)PT2; | ||||
PT3[i] |= PG_V | PG_RW | PG_U; | PT3[i] |= PG_V | PG_RW; | ||||
/* The L2 page slots are mapped with 2MB pages for 1GB. */ | /* The L2 page slots are mapped with 2MB pages for 1GB. */ | ||||
PT2[i] = i * (2 * 1024 * 1024); | PT2[i] = i * (2 * 1024 * 1024); | ||||
PT2[i] |= PG_V | PG_RW | PG_PS | PG_U; | PT2[i] |= PG_V | PG_RW | PG_PS; | ||||
} | } | ||||
printf("Start @ 0x%lx ...\n", ehdr->e_entry); | printf("Start @ 0x%lx ...\n", ehdr->e_entry); | ||||
efi_time_fini(); | efi_time_fini(); | ||||
err = bi_load(fp->f_args, &modulep, &kernend); | err = bi_load(fp->f_args, &modulep, &kernend); | ||||
if (err != 0) { | if (err != 0) { | ||||
efi_time_init(); | efi_time_init(); | ||||
Show All 17 Lines |