metadata.c (bca9c87b6104219af35ae5ea4a6af098a1631bca) | metadata.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 --- 79 unchanged lines hidden (view full) --- 88 archsw.arch_copyin("", addr, 1); 89 addr++; 90 } 91 archsw.arch_copyin("", addr, 1); 92 addr++; 93 return(addr); 94} 95 | 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 --- 79 unchanged lines hidden (view full) --- 88 archsw.arch_copyin("", addr, 1); 89 addr++; 90 } 91 archsw.arch_copyin("", addr, 1); 92 addr++; 93 return(addr); 94} 95 |
96static int align; 97#define MOD_ALIGN(l) roundup(l, align) 98 99static vm_offset_t 100md_copymodules(vm_offset_t addr, int kern64) 101{ 102 struct preloaded_file *fp; 103 struct file_metadata *md; 104 uint64_t scratch64; 105 uint32_t scratch32; 106 int c; 107 108 c = addr != 0; 109 /* start with the first module on the list, should be the kernel */ 110 for (fp = file_findfile(NULL, NULL); fp != NULL; fp = fp->f_next) { 111 112 MOD_NAME(addr, fp->f_name, c); /* this field must come first */ 113 MOD_TYPE(addr, fp->f_type, c); 114 if (fp->f_args) 115 MOD_ARGS(addr, fp->f_args, c); 116 if (kern64) { 117 scratch64 = fp->f_addr; 118 MOD_ADDR(addr, scratch64, c); 119 scratch64 = fp->f_size; 120 MOD_SIZE(addr, scratch64, c); 121 } else { 122 scratch32 = fp->f_addr; 123#ifdef __arm__ 124 scratch32 -= __elfN(relocation_offset); 125#endif 126 MOD_ADDR(addr, scratch32, c); 127 MOD_SIZE(addr, fp->f_size, c); 128 } 129 for (md = fp->f_metadata; md != NULL; md = md->md_next) { 130 if (!(md->md_type & MODINFOMD_NOCOPY)) { 131 MOD_METADATA(addr, md, c); 132 } 133 } 134 } 135 MOD_END(addr, c); 136 return(addr); 137} 138 | |
139/* 140 * Load the information expected by a kernel. 141 * 142 * - The 'boothowto' argument is constructed 143 * - The 'bootdev' argument is constructed 144 * - The kernel environment is copied into kernel space. 145 * - Module metadata are formatted and placed in kernel space. 146 */ --- 158 unchanged lines hidden --- | 96/* 97 * Load the information expected by a kernel. 98 * 99 * - The 'boothowto' argument is constructed 100 * - The 'bootdev' argument is constructed 101 * - The kernel environment is copied into kernel space. 102 * - Module metadata are formatted and placed in kernel space. 103 */ --- 158 unchanged lines hidden --- |