mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-24 11:29:10 +00:00
b8e4cd2bb3
It boots FreeBSD from a running MS-DOS system. It's compiled using some MS-DOS tools, but there is a binary hidden in the uuencoded file. (Go ahead, flame me if you can come up with a solution for the problem. Just saying "this is bad" doesn't count!) Rod, you were right: one would have to deal with weird interfaces to the memory managers, and it seems that Christian found them all, and made them work. Thanks Christian! Reviewed by: phk Submitted by: DI. Christian Gusenbauer <cg@fimp01.fim.uni-linz.ac.at> Christians README: ------------------ Hi Everybody! This is version 1.5 of "fbsdboot", a program that allows you to boot a kernel from a MS-DOS partition or a FreeBSD partition. This program runs using DOS. It works with various memory managers (like EMM386, 386MAX) under certain circumstances. First, a FreeBSD kernel is always loaded to memory starting at 0x100000. To assure that loading the kernel *does not* overwrite memory used by memory managers, high memory for the kernel is allocated and after loading the kernel it's moved to 0x100000. Second, there are many ways to switch to protected mode which is necessary to start the kernel. Each BIOS gives you the possibility to use INT15H (AH=89H) to do that. But some memory-managers like 386max does not allow you to use this method. An other way to do the switch is to use DPMI services, but they do not guarantee, that the protected mode application is executed with privilege level 0. Therefore this method is *not* used. VCPI services offer another way to switch to protected mode, and VCPI servers are built into "emm386.exe", "386max" and "qemm". That's why, this method is implemented in fbsdboot.exe. Fbsdboot.exe tries to switch to protected mode using VCPI services. If they're not available INT15H is used to do the switch. If that fails, it's not possible for this version of fbsdboot.exe to boot a kernel :-(. You can get commandline options of fbsdboot if you start it with "-?" as option! I don't know, if fbsdboot works with QEMM, as I don't have the possibility to test it. Enjoy and have fun! Christian. cg@fimp01.fim.uni-linz.ac.at PS: Many thanks to Bruce Evans for his assistance!
112 lines
4.4 KiB
C
112 lines
4.4 KiB
C
/*
|
|
* Copyright (c) 1982, 1989 The Regents of the University of California.
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
* must display the following acknowledgement:
|
|
* This product includes software developed by the University of
|
|
* California, Berkeley and its contributors.
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
* SUCH DAMAGE.
|
|
*
|
|
* from: @(#)dinode.h 7.10 (Berkeley) 5/8/91
|
|
* $Id: dinode.h,v 1.5 1993/12/19 22:51:07 alm Exp $
|
|
*/
|
|
|
|
#ifndef _UFS_DINODE_H_
|
|
#define _UFS_DINODE_H_ 1
|
|
|
|
/*
|
|
* A dinode contains all the meta-data associated with a UFS file.
|
|
* This structure defines the on-disk format of a dinode.
|
|
*/
|
|
|
|
#define NDADDR 12 /* direct addresses in inode */
|
|
#define NIADDR 3 /* indirect addresses in inode */
|
|
|
|
#define MAXFASTLINK (((NDADDR+NIADDR) * sizeof(daddr_t)) - 1)
|
|
|
|
struct dinode {
|
|
u_short di_mode; /* 0: mode and type of file */
|
|
short di_nlink; /* 2: number of links to file */
|
|
uid_t di_uid; /* 4: owner's user id */
|
|
gid_t di_gid; /* 6: owner's group id */
|
|
union {
|
|
/* u_quad_t v;*/
|
|
u_long val[2];
|
|
} di_qsize; /* 8: number of bytes in file */
|
|
time_t di_atime; /* 16: time last accessed */
|
|
long di_atspare;
|
|
time_t di_mtime; /* 24: time last modified */
|
|
long di_mtspare;
|
|
time_t di_ctime; /* 32: last time inode changed */
|
|
long di_ctspare;
|
|
union {
|
|
struct {
|
|
daddr_t di_udb[NDADDR]; /* 40: disk block addresses */
|
|
daddr_t di_uib[NIADDR]; /* 88: indirect blocks */
|
|
} di_addr;
|
|
char di_usymlink[MAXFASTLINK+1];
|
|
} di_un;
|
|
long di_flags; /* 100: status, currently unused */
|
|
long di_blocks; /* 104: blocks actually held */
|
|
long di_gen; /* 108: generation number */
|
|
#define DI_SPARE_SZ 4 /* 112: spare for 4 longs */
|
|
u_long di_spare[DI_SPARE_SZ]; /* reserved (unused) */
|
|
};
|
|
|
|
#define di_db di_un.di_addr.di_udb
|
|
#define di_ib di_un.di_addr.di_uib
|
|
#define di_symlink di_un.di_usymlink
|
|
|
|
#if BYTE_ORDER == LITTLE_ENDIAN || defined(tahoe) /* ugh! -- must be fixed */
|
|
#define di_size di_qsize.val[0]
|
|
#else /* BYTE_ORDER == BIG_ENDIAN */
|
|
#define di_size di_qsize.val[1]
|
|
#endif
|
|
#define di_rdev di_db[0]
|
|
|
|
/* file modes */
|
|
#define IFMT 0170000 /* mask of file type */
|
|
#define IFIFO 0010000 /* named pipe (fifo) */
|
|
#define IFCHR 0020000 /* character special device */
|
|
#define IFDIR 0040000 /* directory */
|
|
#define IFBLK 0060000 /* block special device */
|
|
#define IFREG 0100000 /* regular file */
|
|
#define IFLNK 0120000 /* symbolic link */
|
|
#define IFSOCK 0140000 /* UNIX domain socket */
|
|
|
|
#define ISUID 04000 /* set user identifier when exec'ing */
|
|
#define ISGID 02000 /* set group identifier when exec'ing */
|
|
#define ISVTX 01000 /* save execution information on exit */
|
|
#define IREAD 0400 /* read permission */
|
|
#define IWRITE 0200 /* write permission */
|
|
#define IEXEC 0100 /* execute permission */
|
|
|
|
#define DFASTLINK(di) \
|
|
((((di).di_mode & IFMT) == IFLNK) && \
|
|
((di).di_size <= MAXFASTLINK) && \
|
|
((di).di_size == (di).di_spare[0]))
|
|
#endif /* _UFS_DINODE_H_ */
|