Changeset View
Changeset View
Standalone View
Standalone View
stand/i386/libi386/bootinfo64.c
Show First 20 Lines • Show All 176 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* - The 'boothowto' argument is constructed | * - The 'boothowto' argument is constructed | ||||
* - The 'bootdev' argument is constructed | * - The 'bootdev' argument is constructed | ||||
* - The 'bootinfo' struct is constructed, and copied into the kernel space. | * - The 'bootinfo' struct is constructed, and copied into the kernel space. | ||||
* - The kernel environment is copied into kernel space. | * - The kernel environment is copied into kernel space. | ||||
* - Module metadata are formatted and placed in kernel space. | * - Module metadata are formatted and placed in kernel space. | ||||
*/ | */ | ||||
int | int | ||||
bi_load64(char *args, vm_offset_t addr, vm_offset_t *modulep, | bi_load64(char *args, vm_offset_t *modulep, | ||||
vm_offset_t *kernendp, int add_smap) | vm_offset_t *kernendp, int add_smap) | ||||
{ | { | ||||
struct preloaded_file *xp, *kfp; | struct preloaded_file *xp, *kfp; | ||||
struct i386_devdesc *rootdev; | struct i386_devdesc *rootdev; | ||||
struct file_metadata *md; | struct file_metadata *md; | ||||
uint64_t kernend; | uint64_t kernend; | ||||
uint64_t envp; | uint64_t envp; | ||||
uint64_t module; | uint64_t module; | ||||
uint64_t addr; | |||||
vm_offset_t size; | vm_offset_t size; | ||||
char *rootdevname; | char *rootdevname; | ||||
int howto; | int howto; | ||||
if (!bi_checkcpu()) { | if (!bi_checkcpu()) { | ||||
printf("CPU doesn't support long mode\n"); | printf("CPU doesn't support long mode\n"); | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
Show All 10 Lines | return (EINVAL); | ||||
if (rootdev == NULL) { /* bad $rootdev/$currdev */ | if (rootdev == NULL) { /* bad $rootdev/$currdev */ | ||||
printf("can't determine root device\n"); | printf("can't determine root device\n"); | ||||
return(EINVAL); | return(EINVAL); | ||||
} | } | ||||
/* Try reading the /etc/fstab file to select the root device */ | /* Try reading the /etc/fstab file to select the root device */ | ||||
getrootmount(i386_fmtdev((void *)rootdev)); | getrootmount(i386_fmtdev((void *)rootdev)); | ||||
if (addr == 0) { | addr = 0; | ||||
/* find the last module in the chain */ | /* find the last module in the chain */ | ||||
for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { | for (xp = file_findfile(NULL, NULL); xp != NULL; xp = xp->f_next) { | ||||
if (addr < (xp->f_addr + xp->f_size)) | if (addr < (xp->f_addr + xp->f_size)) | ||||
addr = xp->f_addr + xp->f_size; | addr = xp->f_addr + xp->f_size; | ||||
} | |||||
} | } | ||||
/* pad to a page boundary */ | /* pad to a page boundary */ | ||||
addr = roundup(addr, PAGE_SIZE); | addr = roundup(addr, PAGE_SIZE); | ||||
addr = build_font_module(addr); | addr = build_font_module(addr); | ||||
/* place the metadata before anything */ | /* place the metadata before anything */ | ||||
module = *modulep = addr; | module = *modulep = addr; | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |