bootinfo32.c (8b19d28d68a396b0263e3c13a559a31f70eb3b1d) | bootinfo32.c (bca9c87b6104219af35ae5ea4a6af098a1631bca) |
---|---|
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 --- 20 unchanged lines hidden (view full) --- 29 30#include <stand.h> 31#include <sys/param.h> 32#include <sys/reboot.h> 33#include <sys/linker.h> 34#include <machine/bootinfo.h> 35#include <machine/metadata.h> 36#include "bootstrap.h" | 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 --- 20 unchanged lines hidden (view full) --- 29 30#include <stand.h> 31#include <sys/param.h> 32#include <sys/reboot.h> 33#include <sys/linker.h> 34#include <machine/bootinfo.h> 35#include <machine/metadata.h> 36#include "bootstrap.h" |
37#include "modinfo.h" |
|
37#include "libi386.h" 38#include "btxv86.h" 39 40#ifdef LOADER_GELI_SUPPORT 41#include "geliboot.h" 42#endif 43 44static struct bootinfo bi; 45 46/* | 38#include "libi386.h" 39#include "btxv86.h" 40 41#ifdef LOADER_GELI_SUPPORT 42#include "geliboot.h" 43#endif 44 45static struct bootinfo bi; 46 47/* |
47 * Copy module-related data into the load area, where it can be 48 * used as a directory for loaded modules. 49 * 50 * Module data is presented in a self-describing format. Each datum 51 * is preceded by a 32-bit identifier and a 32-bit size field. 52 * 53 * Currently, the following data are saved: 54 * 55 * MOD_NAME (variable) module name (string) 56 * MOD_TYPE (variable) module type (string) 57 * MOD_ARGS (variable) module parameters (string) 58 * MOD_ADDR sizeof(vm_offset_t) module load address 59 * MOD_SIZE sizeof(size_t) module size 60 * MOD_METADATA (variable) type-specific metadata | 48 * We have 4 byte alignment for 32-bit targets. This code is compiled as 32-bit 49 * code... |
61 */ 62#define MOD_ALIGN(l) roundup(l, sizeof(u_long)) | 50 */ 51#define MOD_ALIGN(l) roundup(l, sizeof(u_long)) |
63#define COPY32(v, a, c) { \ 64 uint32_t x = (v); \ 65 if (c) \ 66 archsw.arch_copyin(&x, a, sizeof(x)); \ 67 a += sizeof(x); \ 68} | |
69 | 52 |
70#define MOD_STR(t, a, s, c) { \ 71 COPY32(t, a, c); \ 72 COPY32(strlen(s) + 1, a, c); \ 73 if (c) \ 74 archsw.arch_copyin(s, a, strlen(s) + 1); \ 75 a += MOD_ALIGN(strlen(s) + 1); \ 76} 77 78#define MOD_NAME(a, s, c) MOD_STR(MODINFO_NAME, a, s, c) 79#define MOD_TYPE(a, s, c) MOD_STR(MODINFO_TYPE, a, s, c) 80#define MOD_ARGS(a, s, c) MOD_STR(MODINFO_ARGS, a, s, c) 81 82#define MOD_VAR(t, a, s, c) { \ 83 COPY32(t, a, c); \ 84 COPY32(sizeof(s), a, c); \ 85 if (c) \ 86 archsw.arch_copyin(&s, a, sizeof(s)); \ 87 a += MOD_ALIGN(sizeof(s)); \ 88} 89 90#define MOD_ADDR(a, s, c) MOD_VAR(MODINFO_ADDR, a, s, c) 91#define MOD_SIZE(a, s, c) MOD_VAR(MODINFO_SIZE, a, s, c) 92 93#define MOD_METADATA(a, mm, c) { \ 94 COPY32(MODINFO_METADATA | mm->md_type, a, c); \ 95 COPY32(mm->md_size, a, c); \ 96 if (c) \ 97 archsw.arch_copyin(mm->md_data, a, mm->md_size); \ 98 a += MOD_ALIGN(mm->md_size); \ 99} 100 101#define MOD_END(a, c) { \ 102 COPY32(MODINFO_END, a, c); \ 103 COPY32(0, a, c); \ 104} 105 | |
106static vm_offset_t 107bi_copymodules32(vm_offset_t addr) 108{ 109 struct preloaded_file *fp; 110 struct file_metadata *md; 111 int c; 112 113 c = addr != 0; --- 169 unchanged lines hidden --- | 53static vm_offset_t 54bi_copymodules32(vm_offset_t addr) 55{ 56 struct preloaded_file *fp; 57 struct file_metadata *md; 58 int c; 59 60 c = addr != 0; --- 169 unchanged lines hidden --- |