bootinfo64.c (bca9c87b6104219af35ae5ea4a6af098a1631bca) | bootinfo64.c (5d1531d9d4e7d1b1b706ab23ac3f864416e87522) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@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 --- 27 unchanged lines hidden (view full) --- 36#include <machine/psl.h> 37#include <machine/specialreg.h> 38 39#include "bootstrap.h" 40#include "modinfo.h" 41#include "libuserboot.h" 42 43/* | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@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 --- 27 unchanged lines hidden (view full) --- 36#include <machine/psl.h> 37#include <machine/specialreg.h> 38 39#include "bootstrap.h" 40#include "modinfo.h" 41#include "libuserboot.h" 42 43/* |
44 * We have 8 byte alignment for 64-bit targets. This code is compiled as 32-bit 45 * code... 46 */ 47#define MOD_ALIGN(l) roundup(l, sizeof(uint64_t)) 48 49static vm_offset_t 50bi_copymodules64(vm_offset_t addr) 51{ 52 struct preloaded_file *fp; 53 struct file_metadata *md; 54 int c; 55 uint64_t v; 56 57 c = addr != 0; 58 /* start with the first module on the list, should be the kernel */ 59 for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) { 60 61 MOD_NAME(addr, fp->f_name, c); /* this field must come first */ 62 MOD_TYPE(addr, fp->f_type, c); 63 if (fp->f_args) 64 MOD_ARGS(addr, fp->f_args, c); 65 v = fp->f_addr; 66 MOD_ADDR(addr, v, c); 67 v = fp->f_size; 68 MOD_SIZE(addr, v, c); 69 for (md = fp->f_metadata; md != NULL; md = md->md_next) 70 if (!(md->md_type & MODINFOMD_NOCOPY)) 71 MOD_METADATA(addr, md, c); 72 } 73 MOD_END(addr, c); 74 return(addr); 75} 76 77/* | |
78 * Check to see if this CPU supports long mode. 79 */ 80static int 81bi_checkcpu(void) 82{ 83#if 0 84 char *cpu_vendor; 85 int vendor[3]; --- 99 unchanged lines hidden (view full) --- 185 kernend = 0; /* fill it in later */ 186 file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); 187 file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp); 188 file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); 189 bios_addsmapdata(kfp); 190 191 /* Figure out the size and location of the metadata */ 192 *modulep = addr; | 44 * Check to see if this CPU supports long mode. 45 */ 46static int 47bi_checkcpu(void) 48{ 49#if 0 50 char *cpu_vendor; 51 int vendor[3]; --- 99 unchanged lines hidden (view full) --- 151 kernend = 0; /* fill it in later */ 152 file_addmetadata(kfp, MODINFOMD_HOWTO, sizeof howto, &howto); 153 file_addmetadata(kfp, MODINFOMD_ENVP, sizeof envp, &envp); 154 file_addmetadata(kfp, MODINFOMD_KERNEND, sizeof kernend, &kernend); 155 bios_addsmapdata(kfp); 156 157 /* Figure out the size and location of the metadata */ 158 *modulep = addr; |
193 size = bi_copymodules64(0); | 159 size = md_copymodules(0, true); |
194 kernend = roundup(addr + size, PAGE_SIZE); 195 *kernendp = kernend; 196 197 /* patch MODINFOMD_KERNEND */ 198 md = file_findmetadata(kfp, MODINFOMD_KERNEND); 199 bcopy(&kernend, md->md_data, sizeof kernend); 200 201 /* copy module list and metadata */ | 160 kernend = roundup(addr + size, PAGE_SIZE); 161 *kernendp = kernend; 162 163 /* patch MODINFOMD_KERNEND */ 164 md = file_findmetadata(kfp, MODINFOMD_KERNEND); 165 bcopy(&kernend, md->md_data, sizeof kernend); 166 167 /* copy module list and metadata */ |
202 (void)bi_copymodules64(addr); | 168 (void)md_copymodules(addr, true); |
203 204 return(0); 205} | 169 170 return(0); 171} |