mirror of
https://github.com/freebsd/freebsd-src
synced 2024-11-05 18:22:52 +00:00
Remove some debugging code.
Do a much better job of DWIM with partial device specifications. Fix the module metadata build process, which was completely broken. Use a larger read buffer when copying large objects in; this improves performance marginally and will avoid flushning any small caches we might choose to implement.
This commit is contained in:
parent
6ba0dd2cfc
commit
cab57be9ae
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40107
6 changed files with 187 additions and 104 deletions
|
@ -23,7 +23,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: aout_freebsd.c,v 1.8 1998/10/02 16:32:45 msmith Exp $
|
* $Id: aout_freebsd.c,v 1.9 1998/10/02 20:53:16 msmith Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -72,10 +72,6 @@ aout_exec(struct loaded_module *mp)
|
||||||
bi->bi_symtab = mp->m_addr + ehdr->a_text + ehdr->a_data + ehdr->a_bss;
|
bi->bi_symtab = mp->m_addr + ehdr->a_text + ehdr->a_data + ehdr->a_bss;
|
||||||
bi->bi_esymtab = bi->bi_symtab + sizeof(ehdr->a_syms) + ehdr->a_syms;
|
bi->bi_esymtab = bi->bi_symtab + sizeof(ehdr->a_syms) + ehdr->a_syms;
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
printf("Start @ 0x%lx ...\n", entry);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop);
|
__exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop);
|
||||||
|
|
||||||
panic("exec returned");
|
panic("exec returned");
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: biosdisk.c,v 1.10 1998/10/04 09:12:15 msmith Exp $
|
* $Id: biosdisk.c,v 1.11 1998/10/06 07:27:05 msmith Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -63,7 +63,6 @@
|
||||||
# define DEBUG(fmt, args...)
|
# define DEBUG(fmt, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct open_disk {
|
struct open_disk {
|
||||||
int od_dkunit; /* disk unit number */
|
int od_dkunit; /* disk unit number */
|
||||||
int od_unit; /* BIOS unit number */
|
int od_unit; /* BIOS unit number */
|
||||||
|
@ -117,6 +116,7 @@ struct devsw biosdisk = {
|
||||||
|
|
||||||
static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev);
|
static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev);
|
||||||
static void bd_closedisk(struct open_disk *od);
|
static void bd_closedisk(struct open_disk *od);
|
||||||
|
static int bd_bestslice(struct dos_partition *dptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Translate between BIOS device numbers and our private unit numbers.
|
* Translate between BIOS device numbers and our private unit numbers.
|
||||||
|
@ -234,6 +234,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
|
||||||
int sector, slice, i;
|
int sector, slice, i;
|
||||||
int error;
|
int error;
|
||||||
u_char buf[BUFSIZE];
|
u_char buf[BUFSIZE];
|
||||||
|
daddr_t pref_slice[4];
|
||||||
|
|
||||||
if (dev->d_kind.biosdisk.unit >= nbdinfo) {
|
if (dev->d_kind.biosdisk.unit >= nbdinfo) {
|
||||||
DEBUG("attempt to open nonexistent disk");
|
DEBUG("attempt to open nonexistent disk");
|
||||||
|
@ -295,36 +296,34 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
|
||||||
dptr = &od->od_parttab[0];
|
dptr = &od->od_parttab[0];
|
||||||
od->od_flags |= BD_PARTTABOK;
|
od->od_flags |= BD_PARTTABOK;
|
||||||
|
|
||||||
/*
|
/* Try to auto-detect the best slice; this should always give a slice number */
|
||||||
* XXX No support here for 'extended' slices
|
if (dev->d_kind.biosdisk.slice < 1)
|
||||||
*/
|
dev->d_kind.biosdisk.slice = bd_bestslice(dptr);
|
||||||
if (dev->d_kind.biosdisk.slice < 1) {
|
|
||||||
/*
|
|
||||||
* Looking for an unsliced disk, check for the historically
|
|
||||||
* bogus MBR.
|
|
||||||
*/
|
|
||||||
if ((dptr[3].dp_typ != DOSPTYP_386BSD) ||
|
|
||||||
(dptr[3].dp_start != 0) ||
|
|
||||||
(dptr[3].dp_size != 50000)) {
|
|
||||||
error = ENOENT;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
sector = 0;
|
|
||||||
DEBUG("disk is dedicated");
|
|
||||||
|
|
||||||
} else {
|
switch (dev->d_kind.biosdisk.slice) {
|
||||||
/*
|
case -1:
|
||||||
* Accept the supplied slice number unequivocally (we may be looking
|
error = ENOENT;
|
||||||
* for a DOS partition) if we can handle it.
|
goto out;
|
||||||
*/
|
case 0:
|
||||||
if (dev->d_kind.biosdisk.slice > NDOSPART) {
|
goto unsliced;
|
||||||
error = ENOENT;
|
default:
|
||||||
goto out;
|
break;
|
||||||
}
|
|
||||||
dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */
|
|
||||||
sector = dptr->dp_start;
|
|
||||||
DEBUG("slice entry %d at %d, %d sectors", dev->d_kind.biosdisk.slice - 1, sector, dptr->dp_size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Accept the supplied slice number unequivocally (we may be looking
|
||||||
|
* at a DOS partition).
|
||||||
|
*/
|
||||||
|
dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */
|
||||||
|
sector = dptr->dp_start;
|
||||||
|
DEBUG("slice entry %d at %d, %d sectors", dev->d_kind.biosdisk.slice - 1, sector, dptr->dp_size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition
|
||||||
|
*/
|
||||||
|
if ((dptr->dp_typ == DOSPTYP_386BSD) && (dev->d_kind.biosdisk.partition < 0))
|
||||||
|
dev->d_kind.biosdisk.partition = 0;
|
||||||
|
|
||||||
unsliced:
|
unsliced:
|
||||||
/*
|
/*
|
||||||
* Now we have the slice offset, look for the partition in the disklabel if we have
|
* Now we have the slice offset, look for the partition in the disklabel if we have
|
||||||
|
@ -378,6 +377,73 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search for a slice with the following preferences:
|
||||||
|
*
|
||||||
|
* 1: Active FreeBSD slice
|
||||||
|
* 2: Non-active FreeBSD slice
|
||||||
|
* 3: Active FAT/FAT32 slice
|
||||||
|
* 4: non-active FAT/FAT32 slice
|
||||||
|
*/
|
||||||
|
#define PREF_FBSD_ACT 0
|
||||||
|
#define PREF_FBSD 1
|
||||||
|
#define PREF_DOS_ACT 2
|
||||||
|
#define PREF_DOS 3
|
||||||
|
#define PREF_NONE 4
|
||||||
|
|
||||||
|
static int
|
||||||
|
bd_bestslice(struct dos_partition *dptr)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int preflevel, pref;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check for the historically bogus MBR found on true dedicated disks
|
||||||
|
*/
|
||||||
|
if ((dptr[3].dp_typ == DOSPTYP_386BSD) &&
|
||||||
|
(dptr[3].dp_start == 0) &&
|
||||||
|
(dptr[3].dp_size == 50000))
|
||||||
|
return(0);
|
||||||
|
|
||||||
|
preflevel = PREF_NONE;
|
||||||
|
pref = -1;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* XXX No support here for 'extended' slices
|
||||||
|
*/
|
||||||
|
for (i = 0; i < NDOSPART; i++) {
|
||||||
|
switch(dptr[i].dp_typ) {
|
||||||
|
case DOSPTYP_386BSD: /* FreeBSD */
|
||||||
|
if ((dptr[i].dp_flag & 0x80) && (preflevel > PREF_FBSD_ACT)) {
|
||||||
|
pref = i;
|
||||||
|
preflevel = PREF_FBSD_ACT;
|
||||||
|
} else if (preflevel > PREF_FBSD) {
|
||||||
|
pref = i;
|
||||||
|
preflevel = PREF_FBSD;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x04: /* DOS/Windows */
|
||||||
|
case 0x06:
|
||||||
|
case 0x0b:
|
||||||
|
case 0x0c:
|
||||||
|
case 0x0e:
|
||||||
|
case 0x63:
|
||||||
|
if ((dptr[i].dp_flag & 0x80) && (preflevel > PREF_DOS_ACT)) {
|
||||||
|
pref = i;
|
||||||
|
preflevel = PREF_DOS_ACT;
|
||||||
|
} else if (preflevel > PREF_DOS) {
|
||||||
|
pref = i;
|
||||||
|
preflevel = PREF_DOS;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(pref + 1); /* slices numbered 1-4 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bd_close(struct open_file *f)
|
bd_close(struct open_file *f)
|
||||||
{
|
{
|
||||||
|
@ -576,8 +642,10 @@ bd_getdev(struct i386_devdesc *dev)
|
||||||
struct open_disk *od;
|
struct open_disk *od;
|
||||||
int biosdev;
|
int biosdev;
|
||||||
int major;
|
int major;
|
||||||
|
int rootdev;
|
||||||
|
|
||||||
biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
|
biosdev = bd_unit2bios(dev->d_kind.biosdisk.unit);
|
||||||
|
DEBUG("unit %d BIOS device %d", dev->d_kind.biosdisk.unit, biosdev);
|
||||||
if (biosdev == -1) /* not a BIOS device */
|
if (biosdev == -1) /* not a BIOS device */
|
||||||
return(-1);
|
return(-1);
|
||||||
if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */
|
if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */
|
||||||
|
@ -602,9 +670,28 @@ bd_getdev(struct i386_devdesc *dev)
|
||||||
major = WDMAJOR;
|
major = WDMAJOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return(MAKEBOOTDEV(major,
|
rootdev = MAKEBOOTDEV(major,
|
||||||
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
|
(dev->d_kind.biosdisk.slice + 1) >> 4, /* XXX slices may be wrong here */
|
||||||
(dev->d_kind.biosdisk.slice + 1) & 0xf,
|
(dev->d_kind.biosdisk.slice + 1) & 0xf,
|
||||||
biosdev & 0x7f, /* XXX allow/compute shift for da when wd present */
|
biosdev & 0x7f, /* XXX allow/compute shift for da when wd present */
|
||||||
dev->d_kind.biosdisk.partition));
|
dev->d_kind.biosdisk.partition);
|
||||||
|
DEBUG("dev is 0x%x\n", rootdev);
|
||||||
|
return(rootdev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Fix (dev) so that it refers to the 'real' disk/slice/partition that it implies.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
bd_fixupdev(struct i386_devdesc *dev)
|
||||||
|
{
|
||||||
|
struct open_disk *od;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Open the disk. This will fix up the slice and partition fields.
|
||||||
|
*/
|
||||||
|
if (bd_opendisk(&od, dev) != 0)
|
||||||
|
return(ENOENT);
|
||||||
|
|
||||||
|
bd_closedisk(od);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: bootinfo.c,v 1.9 1998/10/07 02:39:05 msmith Exp $
|
* $Id: bootinfo.c,v 1.10 1998/10/07 10:55:46 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stand.h>
|
#include <stand.h>
|
||||||
|
@ -155,21 +155,25 @@ bi_copyenv(vm_offset_t addr)
|
||||||
* MOD_SIZE sizeof(size_t) module size
|
* MOD_SIZE sizeof(size_t) module size
|
||||||
* MOD_METADATA (variable) type-specific metadata
|
* MOD_METADATA (variable) type-specific metadata
|
||||||
*/
|
*/
|
||||||
#define MOD_STR(t, a, s) { \
|
#define COPY32(v, a) { \
|
||||||
u_int32_t ident = (t << 16) + strlen(s) + 1; \
|
u_int32_t x = (v); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
i386_copyin(&x, a, sizeof(x)); \
|
||||||
a += sizeof(ident); \
|
a += sizeof(x); \
|
||||||
i386_copyin(s, a, strlen(s) + 1); \
|
}
|
||||||
a += strlen(s) + 1; \
|
|
||||||
|
#define MOD_STR(t, a, s) { \
|
||||||
|
COPY32(t, a); \
|
||||||
|
COPY32(strlen(s) + 1, a); \
|
||||||
|
i386_copyin(s, a, strlen(s) + 1); \
|
||||||
|
a += strlen(s) + 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
|
#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
|
||||||
#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
|
#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
|
||||||
|
|
||||||
#define MOD_VAR(t, a, s) { \
|
#define MOD_VAR(t, a, s) { \
|
||||||
u_int32_t ident = (t << 16) + sizeof(s); \
|
COPY32(t, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(sizeof(s), a); \
|
||||||
a += sizeof(ident); \
|
|
||||||
i386_copyin(&s, a, sizeof(s)); \
|
i386_copyin(&s, a, sizeof(s)); \
|
||||||
a += sizeof(s); \
|
a += sizeof(s); \
|
||||||
}
|
}
|
||||||
|
@ -177,20 +181,16 @@ bi_copyenv(vm_offset_t addr)
|
||||||
#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
|
#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
|
||||||
#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
|
#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
|
||||||
|
|
||||||
#define MOD_METADATA(a, mm) { \
|
#define MOD_METADATA(a, mm) { \
|
||||||
u_int32_t ident = ((MODINFO_METADATA | mm->md_type) << 16) + mm->md_size; \
|
COPY32(MODINFO_METADATA | mm->md_type, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(mm->md_size, a); \
|
||||||
a += sizeof(ident); \
|
i386_copyin(mm->md_data, a, mm->md_size); \
|
||||||
i386_copyin(mm->md_data, a, mm->md_size); \
|
a += mm->md_size; \
|
||||||
a += mm->md_size; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_END(a) { \
|
#define MOD_END(a) { \
|
||||||
u_int32_t ident = 0; \
|
COPY32(MODINFO_END, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(0, a); \
|
||||||
a += sizeof(ident); \
|
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
|
||||||
a += sizeof(ident); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_offset_t
|
vm_offset_t
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: bootinfo.c,v 1.9 1998/10/07 02:39:05 msmith Exp $
|
* $Id: bootinfo.c,v 1.10 1998/10/07 10:55:46 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stand.h>
|
#include <stand.h>
|
||||||
|
@ -155,21 +155,25 @@ bi_copyenv(vm_offset_t addr)
|
||||||
* MOD_SIZE sizeof(size_t) module size
|
* MOD_SIZE sizeof(size_t) module size
|
||||||
* MOD_METADATA (variable) type-specific metadata
|
* MOD_METADATA (variable) type-specific metadata
|
||||||
*/
|
*/
|
||||||
#define MOD_STR(t, a, s) { \
|
#define COPY32(v, a) { \
|
||||||
u_int32_t ident = (t << 16) + strlen(s) + 1; \
|
u_int32_t x = (v); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
i386_copyin(&x, a, sizeof(x)); \
|
||||||
a += sizeof(ident); \
|
a += sizeof(x); \
|
||||||
i386_copyin(s, a, strlen(s) + 1); \
|
}
|
||||||
a += strlen(s) + 1; \
|
|
||||||
|
#define MOD_STR(t, a, s) { \
|
||||||
|
COPY32(t, a); \
|
||||||
|
COPY32(strlen(s) + 1, a); \
|
||||||
|
i386_copyin(s, a, strlen(s) + 1); \
|
||||||
|
a += strlen(s) + 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
|
#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
|
||||||
#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
|
#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
|
||||||
|
|
||||||
#define MOD_VAR(t, a, s) { \
|
#define MOD_VAR(t, a, s) { \
|
||||||
u_int32_t ident = (t << 16) + sizeof(s); \
|
COPY32(t, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(sizeof(s), a); \
|
||||||
a += sizeof(ident); \
|
|
||||||
i386_copyin(&s, a, sizeof(s)); \
|
i386_copyin(&s, a, sizeof(s)); \
|
||||||
a += sizeof(s); \
|
a += sizeof(s); \
|
||||||
}
|
}
|
||||||
|
@ -177,20 +181,16 @@ bi_copyenv(vm_offset_t addr)
|
||||||
#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
|
#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
|
||||||
#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
|
#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
|
||||||
|
|
||||||
#define MOD_METADATA(a, mm) { \
|
#define MOD_METADATA(a, mm) { \
|
||||||
u_int32_t ident = ((MODINFO_METADATA | mm->md_type) << 16) + mm->md_size; \
|
COPY32(MODINFO_METADATA | mm->md_type, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(mm->md_size, a); \
|
||||||
a += sizeof(ident); \
|
i386_copyin(mm->md_data, a, mm->md_size); \
|
||||||
i386_copyin(mm->md_data, a, mm->md_size); \
|
a += mm->md_size; \
|
||||||
a += mm->md_size; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_END(a) { \
|
#define MOD_END(a) { \
|
||||||
u_int32_t ident = 0; \
|
COPY32(MODINFO_END, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(0, a); \
|
||||||
a += sizeof(ident); \
|
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
|
||||||
a += sizeof(ident); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_offset_t
|
vm_offset_t
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: bootinfo.c,v 1.9 1998/10/07 02:39:05 msmith Exp $
|
* $Id: bootinfo.c,v 1.10 1998/10/07 10:55:46 peter Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stand.h>
|
#include <stand.h>
|
||||||
|
@ -155,21 +155,25 @@ bi_copyenv(vm_offset_t addr)
|
||||||
* MOD_SIZE sizeof(size_t) module size
|
* MOD_SIZE sizeof(size_t) module size
|
||||||
* MOD_METADATA (variable) type-specific metadata
|
* MOD_METADATA (variable) type-specific metadata
|
||||||
*/
|
*/
|
||||||
#define MOD_STR(t, a, s) { \
|
#define COPY32(v, a) { \
|
||||||
u_int32_t ident = (t << 16) + strlen(s) + 1; \
|
u_int32_t x = (v); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
i386_copyin(&x, a, sizeof(x)); \
|
||||||
a += sizeof(ident); \
|
a += sizeof(x); \
|
||||||
i386_copyin(s, a, strlen(s) + 1); \
|
}
|
||||||
a += strlen(s) + 1; \
|
|
||||||
|
#define MOD_STR(t, a, s) { \
|
||||||
|
COPY32(t, a); \
|
||||||
|
COPY32(strlen(s) + 1, a); \
|
||||||
|
i386_copyin(s, a, strlen(s) + 1); \
|
||||||
|
a += strlen(s) + 1; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
|
#define MOD_NAME(a, s) MOD_STR(MODINFO_NAME, a, s)
|
||||||
#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
|
#define MOD_TYPE(a, s) MOD_STR(MODINFO_TYPE, a, s)
|
||||||
|
|
||||||
#define MOD_VAR(t, a, s) { \
|
#define MOD_VAR(t, a, s) { \
|
||||||
u_int32_t ident = (t << 16) + sizeof(s); \
|
COPY32(t, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(sizeof(s), a); \
|
||||||
a += sizeof(ident); \
|
|
||||||
i386_copyin(&s, a, sizeof(s)); \
|
i386_copyin(&s, a, sizeof(s)); \
|
||||||
a += sizeof(s); \
|
a += sizeof(s); \
|
||||||
}
|
}
|
||||||
|
@ -177,20 +181,16 @@ bi_copyenv(vm_offset_t addr)
|
||||||
#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
|
#define MOD_ADDR(a, s) MOD_VAR(MODINFO_ADDR, a, s)
|
||||||
#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
|
#define MOD_SIZE(a, s) MOD_VAR(MODINFO_SIZE, a, s)
|
||||||
|
|
||||||
#define MOD_METADATA(a, mm) { \
|
#define MOD_METADATA(a, mm) { \
|
||||||
u_int32_t ident = ((MODINFO_METADATA | mm->md_type) << 16) + mm->md_size; \
|
COPY32(MODINFO_METADATA | mm->md_type, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(mm->md_size, a); \
|
||||||
a += sizeof(ident); \
|
i386_copyin(mm->md_data, a, mm->md_size); \
|
||||||
i386_copyin(mm->md_data, a, mm->md_size); \
|
a += mm->md_size; \
|
||||||
a += mm->md_size; \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MOD_END(a) { \
|
#define MOD_END(a) { \
|
||||||
u_int32_t ident = 0; \
|
COPY32(MODINFO_END, a); \
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
COPY32(0, a); \
|
||||||
a += sizeof(ident); \
|
|
||||||
i386_copyin(&ident, a, sizeof(ident)); \
|
|
||||||
a += sizeof(ident); \
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vm_offset_t
|
vm_offset_t
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "libi386.h"
|
#include "libi386.h"
|
||||||
#include "btxv86.h"
|
#include "btxv86.h"
|
||||||
|
|
||||||
#define READIN_BUF 4096
|
#define READIN_BUF (16 * 1024)
|
||||||
|
|
||||||
int
|
int
|
||||||
i386_copyin(void *src, vm_offset_t dest, size_t len)
|
i386_copyin(void *src, vm_offset_t dest, size_t len)
|
||||||
|
|
Loading…
Reference in a new issue