Coherent4.2.10/tboot/DOCS

Documentation for libtboot.a.




























Startup.s: 	.globl	myds_
Startup.s: 	.globl	seconddat
Startup.s: 	.globl	nbuf_
Startup.s: 	.globl	traks
Startup.s: 	.globl	traks_
Startup.s: 	.globl	sects
Startup.s: 	.globl	sects_
Startup.s: 	.globl	heads
Startup.s: 	.globl	heads_
Startup.s: 	.globl	drive
Startup.s: 	.globl	drive_
Startup.s: 	.globl	first
Startup.s: 	.globl	first_
BASE10	cbootlib.c	83
BASE16	cbootlib.c	113
BITS_PER_INT16	cbootlib.c	251
BLOCK	tboot.h	25
BS	cbootlib.c	26
BUFSIZE	tboot.h	55
COFF_SYS_BASE	tboot.h	63
DEF_SYS_BASE	tboot.h	64
DEL	cbootlib.c	27
DIGITS_PER_INT16	cbootlib.c	252
DIGITS_PER_INT8	cbootlib.c	253
DISK	tboot.h	56
DISKINT	tboot.h	32
DISK_PARAMS	tboot.h	33
FALSE	tboot.h	20
FIRST	tboot.h	59
FOURK	tboot.h	23
FOURKBOUNDRY	tboot.h	24
FULLSEG	tboot.h	60
GIFTBOX	gift.c	48
GREATEST	tboot.h	74
HARD_DRIVE	tboot.h	34
HIGH	tboot.h	76
IBSHIFT	tboot.h	52
INODES_PER_BLOCK	tboot.h	38
INOMASK	tboot.h	54
INOORG	tboot.h	51
IOSHIFT	tboot.h	53
KEYBD	tboot.h	57
LESSER	tboot.h	75
LINESIZE	tboot.h	26
LOW	tboot.h	77
MAIN	tboot.c	23
MAXINT16	ptypes.h	16
MAXINT32	ptypes.h	20
MAXINT8	ptypes.h	12
MAXSEG	cbootlib.c	177
MAXUINT16	ptypes.h	18
MAXUINT32	ptypes.h	22
MAXUINT8	ptypes.h	14
MAX_SEGS	tboot.h	27
MIDNIGHT	cbootlib.c	377
Mcoff	coff.c	main()
Mobjects	objects.c	main()
NAK	cbootlib.c	28
NBUF	bio.c	16
NHD	tboot.h	42
NORMAL_MAGIC	tboot.h	28
NSPT	tboot.h	46
NTRK	tboot.h	47
NULL	tboot.h	22
PPMASK	tboot.h	61
PPSIZE	cbootlib.c	178
PROMPT	monitor.c	15
PTYPES_H	ptypes.h	6
READ1	tboot.h	58
RESIZE	typed.h	40
RETYPE	typed.h	42
ROOTINO	tboot.h	50
SEVENONES	indirect.c	139
SIXBITS	tboot.h	36
SYS_START	tboot.h	65
THE_DEV	tboot.h	67
THE_XDEV	tboot.h	68
TIMER_OFF	cbootlib.c	375
TIMER_SEG	cbootlib.c	374
TRUE	tboot.h	19
TYPED_H	typed.h	17
TYPED_SPACE	fifo_k.c	TYPED_SPACE(global_space, 128, T_FIFO_SIC);	 Static In-Core Fifo.  
TYPED_SPACE	gift.c	TYPED_SPACE(local_gift, GIFTBOX, T_FIFO_SIC);  Static In-Core Fifo.  
TYPED_SPACE	tboot.c	TYPED_SPACE(boot_gift, 8192, T_FIFO_SIC);	 Static In-Core FIFO.  
TYPED_SPACE	typed.h	32
T_BIOS	typed.h	63
T_BIOS_DISK	typed.h	64
T_BIOS_ROOTDEV	typed.h	65
T_FIFO	typed.h	56
T_FIFO_DIC	typed.h	58
T_FIFO_DP	typed.h	60
T_FIFO_SIC	typed.h	57
T_FIFO_SP	typed.h	59
T_STR	typed.h	68
T_STR_ARGF	typed.h	71
T_STR_ARGV	typed.h	69
T_STR_STR	typed.h	70
T_UNKNOWN	typed.h	53
WAIT_DELAY	tboot.h	71
WS	tboot.h	21























_bread_	bootlib.m
_ffcopy_	bootlib.m
_xbread_	bootlib.m
arg_exist arg_exist.c
	 * Determine whether or not a given argument exists on the command line
	 * passed into the kernel.
	 *
	 * Takes a pointer to a NUL terminated string that is the name of
	 * the desired argument.
	int arg_exist(arg)
basetoi	cbootlib.c	uint16 basetoi(char *s, base)
	uint16 basetoi();  Convert an arbitrary base string to an integer.  
	 * basetoi(char *s, int base)
	 * Convert a string base "base" to an integer.
	 * Good through base 36.
	 * Loosely based on K&R's atoi().
bclaim	bio.c	bclaim(block)
	BUF *bclaim();		 Claim a disk buffer.  
bpick	bio.c	bpick()
	BUF *bpick();		 Pick a buffer to trash.  
bread	diskio.c	bread(blockno)
	/* Aligning bread.
	 * Reads 1 block into an arbitrary buffer.  The assembly language
	 * routine bread() needs a buffer aligned on a 4K boundary.
	 */

	BUF *
	bread(blockno)
		daddr_t blo
brelease	bio.c	brelease(bp)
	void brelease();		 Free a disk buffer.  
bufinit	bio.c	bufinit()
	void bufinit();		 Initialize disk buffers.  
close	sys.c	int close(int fd)
	int close();		/* Close a file descriptor.  */
coff2load	coff.c	coff2load(ip, table, data_seg)
	int
	coff2load(ip, table, data_seg)
		struct inode *ip;		/* input: File to read.		*/
		struct load_segment table[];	/* output: How to read it.	*/
		uint16 *data_seg;	/* output: Where to point es.	*/
	 * Convert COFF to load table.
	 * Used to generate loading instructions for use by tboot main().
	 * Returns true on successful translation.
coffnlist	coff.c
	Search COFF file for symbols.
	int
	coffnlist(fn, nlp, names, count)
		char *fn;	/* file name */
		SYMENT *nlp;	/* names to look up */
		char *names;	/* long names */
		int count;	/* size of passed table */

dir	builtin.c	dir()
	Create a listing of file names in /.
	void dir()
dpb	builtin.c	dpb()
	Display the BIOS parameters loaded up by the startup code.
	void dpb()
dump_bios_disk	gift.c	dump_bios_disk(a_disk)
	/* Dump a T_BIOS_DISK typed_space.  */
	void
	dump_bios_disk(a_disk)
		BIOS_DISK *a_disk;
dump_fifo	gift.c	dump_fifo(fifo)
	/* Dump the contents of a fifo.  */
	void
	dump_fifo(fifo)
		typed_space *fifo;
dump_gift	gift.c	dump_gift()
	/* Dump the contents of boot_gift.  */
	void
	dump_gift()
dump_rootdev	gift.c	dump_rootdev(a_rootdev)
	/* Dump a T_BIOS_ROOTDEV typed_space.  */
	void
	dump_rootdev(a_rootdev)
		BIOS_ROOTDEV *a_rootdev;
fdisk	fdisk.c	fdisk( fp )
	 * void
	 * fdisk( fp )	--	Fixed Disk Configuration
	 * dev_t dev;
	 * struct fdisk_s *fp;
	 *	Input:	fp  = pointer to memory-resident partition info (to update)
	 *
	 *	Action:	Read first block from the device.
	 *		If valid signature present on block,
	 *			copy partition information to memory
	 *
	 *	Return:	1 = partition information successfully updated
	 *		0 = failure (could not read block, or bad signature)

ffcopy	cbootlib.c	ffcopy(to_offset, to_seg, from_offset, from_seg, length)
	 * Wrapper for far-far copy.  Changes the segment so that the requested
	 * length does not wrap past the end of the segment.
	 *
	 * For Intel 8086 Real Mode.
	void
	ffcopy(to_offset, to_seg, from_offset, from_seg, length)
		uint16 to_offset;
		uint16 to_seg;
		uint16 from_offset;
		uint16 from_seg;
		uint16 length;
fifo_close	fifo_k.c	fifo_close(ffp)
	int fifo_close();		 Finish with using a typed space as a fifo.  
fifo_len	fifo_b.c	fifo_len(ffp)
	long fifo_len();		/* Find out how long a fifo is.  */
fifo_open	fifo_k.c	fifo_open(fifo_space, mode)
	FIFO *fifo_open();		 Open a typed space as a fifo.	
fifo_read	fifo_k.c	fifo_read(ffp)
	typed_space *fifo_read();	 Read a typed space from a fifo.	
fifo_rewind	fifo_k.c	fifo_rewind(ffp)
	int fifo_rewind();		 Go back to the start of the fifo.	
fifo_write	fifo_b.c	fifo_write(ffp, space)
	typed_space *fifo_write();	 Write a typed space into an open fifo.  
fifo_write_untyped	fifo_b.c	fifo_write_untyped(ffp, datum, size, type)
	typed_space *fifo_write_untyped();   Write data into an open fifo.  
getchar	bootlib.m
gate_lock	bio.c	gate_lock(g)
	int gate_lock();		 Attempt to lock a GATE.  
gate_locked	bio.c	gate_locked(g)
	int gate_locked();	 Check to see if a GATE is locked.  
gate_unlock	bio.c	gate_unlock(g)
	void gate_unlock();	 Unlock a GATE.  
get_num_of_drives	builtin.c	int get_num_of_drives()
	/* Ask the BIOS how many drives are attached.  */
	int get_num_of_drives()
gets	cbootlib.c	gets(s)
	char *gets();	 Get a string from the keyboard.  
gift_argf	gift.c	gift_argf(ffp, cmd_line)
	/* Write an argument fifo into ffp from the command line cmd_line.
	 * Returns 0 if it runs out of space, 1 on success, and 2 if something else
	 * goes wrong.
	 */
	int
	gift_argf(ffp, cmd_line)
		FIFO *ffp;
		char *cmd_line;
gift_drive_params	gift.c	gift_drive_params(ffp)
	/* Load the BIOS parameters loaded up by the startup code.  */
	int
	gift_drive_params(ffp)
		FIFO *ffp;
gift_rootdev	gift.c	gift_rootdev(ffp)
	/* Write a structure describing the boot partition into a fifo.
	 * Returns 1 on success, 0 if it runs out of space, or 2 if it
	 * can't read the boot block.
	 */
	int
	gift_rootdev(ffp)
		FIFO *ffp;
gotofar	bootlib.m
gotoker	bootlib.m
hdinit		bootlib.m
ifread	diskio.c	ifread(ip, toseg, tooffset, offset, lenarg)
	 * Inode to Far READ: Load an arbitrary length from a file into a far address.
	void
	ifread(ip, toseg, tooffset, offset, lenarg)
		struct inode *ip;	/* Read from this file,		*/
		uint16 toseg;	/* into this far buffer,	*/
		uint16 tooffset;
		fsize_t offset;		/* from here in the file,	*/
		fsize_t lenarg;		/* for this many bytes.		*/
ind_index	indirect.c	ind_index(ind_level, vblockno)
	 * uint16 ind_index(uint16 ind_level, daddr_t vblockno);
	 * Calculate the index needed for virtual block vblockno into
	 * a table of the given indirection level.
ind_lookup	indirect.c	ind_lookup(ind_level, ind_table, vblockno)
	 * Look up the next level of block in table ind_table, for virtual
	 * block number vblockno.
	 * Note that this table is in DISK CANNONICAL format.  If the local
	 * notion of daddr_t is a different size from DISK CANONICAL daddr_t
	daddr_t
	ind_lookup(ind_level, ind_table, vblockno)
		uint16 ind_level;
		daddr_t *ind_table;
		daddr_t vblockno;
indirect	indirect.c	indirect(ind_level, ind_table_ptr, vblockno)
	 * Recursively follow an indirection for a given virtual block number
	 * vblockno.
	 * ind_level must be the level of indirection still un-resolved.
	 * ind_table is the physical block number of the next indirection.
	 * daddr_t
	 * indirect(uint16 ind_level, daddr_t ind_table_ptr, daddr_t vblockno)
intcall	intcall.m
	int intcall(reg *srcreg, reg *destreg, int intnum);
	 Provide C interface to bios interrupts.
interpret	builtin.c	interpret(command)
	 * If possible, execute "command".
	 * Return "true" if the command exists, "false" otherwise.
	int
	interpret(command)
		char *command;
intmon		bootlib.m
iopen	diskio.c	iopen(meminode, inode_number)
	 * Inode OPEN: Load the inode for a file into memory.
	 * iopen(struct inode *ip,
	 *	 ino_t inode_number)
	int
	iopen(meminode, inode_number)
		struct inode *meminode;
		ino_t inode_number;
iread	diskio.c	iread(ip, buffer, offset, lenarg)
	 * Inode READ: Load a local buffer from a file.
	void
	iread(ip, buffer, offset, lenarg)
		struct inode *ip;	/* Read from this file,		*/
		char *buffer;		/* into this buffer,		*/
		fsize_t offset;		/* from here in the file,	*/
		uint16 lenarg;	/* for this many bytes.		*/
iskey	bootlib.m
itoa	cbootlib.c	itoa(n, s)
	void itoa();	 Convert an integer to a decimal string.  
itobase	cbootlib.c	itobase(n, s, base)
	void itobase();	 Convert an integer to an arbitrary base string.  
l_out_nlist	l.out.c	l_out_nlist(fn, nlp)
	 * Get entries from l.out name list.
	void
	l_out_nlist(fn, nlp)
	char *fn;
	struct nlist *nlp;
lout2load	l.out.c	lout2load(ip, table, data_seg)
	/* Convert l.out to load table.
	 * Used to generate loading instructions for use by tboot main().
	 * Returns true on successful translation.
	 */
	
	int
	lout2load(ip, table, data_seg)
		struct inode *ip;		/* input: File to read.		*/
		struct load_segment table[];	/* output: How to read it.	*/
		uint16 *data_seg;	/* output: Where to point es.	*/
lpad	cbootlib.c	lpad(s, c, n)
	char *lpad();	 Pad a string on the left.  
lseek	sys.c	lseek(fd, where, how)
	/* Set a read/write position.
	 * Changes the seek position for file descriptor fd.
	 * where and  how describe the  new seek position.   where gives the
	 * number of  bytes that you wish  to move the seek  position; it is
	 * measured from the beginning of the  file if how is zero, from the
	 * current seek position if how is  one, or from the end of the file
	 * if how is  two.  A successful call to lseek  returns the new seek
	 * position; a failure returns (int32) -1.
	 */
	long
	lseek(fd, where, how)
		int fd;
		long where;
		int how;
monitor	monitor.c	void monitor()
	Mini-monitor for testing boot code.
namei	diskio.c	namei(filename)
	 * Convert a filename to an inode number.  Returns inode number 0 on
	 * failure.
	ino_t
	namei(filename)
		char *filename;
object2load	objects.c	object2load(magic, ip, table, data_seg)
	/* Extract information from an object file that describes how to
	 * load an executable.
	 * The magic number of the file is in "magic".
	 * The object file's inode is in "ip".
	 *
	 * The information needed is extracted into "table".
	 * The value for the data segment is put in "data_seg".
	 *
	 * Returns TRUE if the needed information could be extracted, FALSE ow.
	 */
	
	int
	object2load(magic, ip, table, data_seg)
		uint16 magic;
		struct inode *ip;
		struct load_segment table[];
		uint16 *data_seg;
object_nlist	objects.c	object_nlist(magic, filename, symbol)
	/* Look up symbol(s) in an object file. 
	 * searches  the name list  (symbol table) of  the load module
	 * "filename" for each symbol in the array pointed to by "nlp".
	 *
	 * nlp points to an array of nlist structures, terminated by a
	 * structure with a null string as its n_name member.
	 *
	 * If "filename" is not a load module or has had its symbol table
	 * stripped, all returned n_type and n_value entries will be zero.
	
	uint16
	object_nlist(magic, filename, symbol)
		uint16 magic;
		char *filename;
		char *symbol;
object_sys_base	objects.c	object_sys_base(magic)
	/* Determine the value for sys_base based on the type of the load file.  */
	uint16
	object_sys_base(magic)
		int magic;
open	sys.c	open(file, type)
	/* Open a file.
	 * Takes a file name, file; and a way of opening it, type as follows:
	 * 	0	Read only
	 *	1	Write
	 *	2	Read and write
	 * Only read is implimented.
	 *
	 * Returns a file descriptor, or -1 if the open failed.
	 */
	int
	open(file, type)
		char *file;
		int type;
print8	cbootlib.c	print8(uint8 my_int)
	void print8();		 Print an 8 bit integer, base 16.  
print16	cbootlib.c	print16(uint16 my_int)
	void print16();		 Print a 16 bit integer, base 16.
print32	cbootlib.c	print32(uint32 my_int)
	void print32();		 Print a 32 bit integer, base 16.  
putchar	bootlib.m
puts	cbootlib.c	puts(s)
	void puts();	 Put a string on the screen.  
	 * puts() -- put a NUL terminated string.
	 * Takes one argument--a pointer to a NUL terminated character string.
	 * Does no error checking.  Calls the assembly language routine putc().
read	sys.c	read(fd, buffer, n)
	 * Read from a file.
	 * Takes a file descriptor, a buffer, and a length to read.
	 *
	 * Returns the number of characters read, or -1 if an error occurs.
	int
	read(fd, buffer, n)
		int fd;
		char *buffer;
		int n;
reverse	cbootlib.c	reverse(s)
	void reverse();	 Reverse a string in place.  
sanity_check	bio.c	sanity_check(message)
	 * Sanity checker.
	 * Prints contents of "message" if something is amiss and dumps you
	 * into the monitor.
	 *
	 * Add tests and messages as needed.
	
	void
	sanity_check(message)
		char *message;
seg_align	cbootlib.c	seg_align(offset, segment)
	void seg_align();	 Align a far address.  
seginc	cbootlib.c	seginc(offset, segment, increment)
	/* seginc(uint16 *offset,
	 *	  uint16 *segment,
	 *	  uint16 increment)
	 * Add an offset to a segment.  We may adjust the segment base
	 * to make everything fit.
	 */
vmap	indirect.c	vmap(ip, vblockno)
	/* Convert the given virtual block to a physical block for the given inode.
	 * ip points to the in-core inode for a file.
	 * vblockno is a block number relative to the start of that file.
	 */
	daddr_t
	vmap(ip, vblockno)
		struct inode *ip;
		daddr_t vblockno;
wait_for_keystroke	cbootlib.c	wait_for_keystroke(delay, key)
	int wait_for_keystrok();	 Wait a time delay for a keystroke.  
wrap_coffnlist	coff.c	wrap_coffnlist(fn, symbol)
	 * Look up the value of a single data symbol in a coff file,
	 * relative to the start of the data segment.
	 *
	 * We use the symbol "sdata" to find the start of the data segment--
	 * this works for 386 COHERENT kernels but will not work in general.
	 * It should really fetch the address of the start of the data segment
	 * from the data section header.
	uint32
	wrap_coffnlist(fn, symbol)
		char *fn;	/* file name */
		char *symbol;	/* symbol to look up */
xbread	diskio.c	xbread(blockno)
	 * Aligning xbread.
	 * Disk addresses are relative to the start of the disk, rather than
	 * the start of the partition.
	 * Reads 1 block into an arbitrary buffer.  The assembly language
	 * routine xbread() needs a buffer aligned on a 4K boundary.
	BUF *
	xbread(blockno)
		daddr_t blockno;	/* Block number.  */
 * To pass a new data structure into the kernel:
 *
 * 1. Define your new data structure in typed.h.  You will probably want
 *    to define some supporting routines for your data structure.  These
 *    should go in a file by themselves.  Be sure to add the file to the
 *    tboot Makefile.
 * 
 * 2. Write a routine that takes at least an ffp, which will generate your
 *    data structure and write it into the ffp.  The routine should return 0
 *    if it ran out of space in the FIFO.  Other return values are permissible,
 *    but ignored.  Add arguments to prepare_gift() as needed.  It is called
 *    only from the end of main() in tboot.c
 *
 * 3. Add a call to your routine to prepare_gift() in the section marked
 *    FILL THE BOX.  This is an if statement with || seperated calls.  The
 *    most important data structures should be called first, because later
 *    calls will be skipped if the FIFO fills.
 *
 * 4. In the kernel (probably in a driver) you will want to add a loop to
 *    look through the gift for your data structure:
 *
 *    FIFO *ffp;
 *    typed_space *tp;
 *
 *    ffp = fifo_open(&boot_gift, 0);	-- Open gift for reading. 
 * 
 *    if (F_NULL == ffp) {
 *	  indicate_error("Could not open boot_gift.");
 *    } else {
 *        while (T_NULL != (tp = fifo_read(ffp))) {	-- While not EOFIFO.
 *	      if (T_MYTYPE == tp->ts_type) {	-- Is this my type?
 *		  my_handler(tp->ts_data);	-- Process the data.
 *	      }
 *        }
 *    }
 *
 *    Be sure to include fifo_k.c and typed.h into your kernel.


gift_drive_params

gift_argf
 * To read gift_argf from bootgift, use the procedure outlined above in
 * point 4 to find the entry marked T_STR_ARGF.  You must then explicitly
 * recast it with RETYPE(tp->ts_data, T_FIFO_SIC).  Then you can open it
 * as a FIFO, with code modeled on point 4 above.  This scheme seemed
 * the simplest for uniquely identifying the argument FIFO.
 * Each element of the FIFO is a T_STR_STR, so ts_data for these is
 * just a NUL terminated string.

gift_rootdev
/* typed.h -- Data structures for an implimentation of internally
 * typed data structures.
 *
 * This file has 5 major sections:
 * TYPED_SPACE DECLARATIONS	-- Declarations for typed_space in general.
 * DATA TYPES			-- Values for typed_space.ts_type.
 *	Make at least one entry here when you add new data types.
 * STRUCTURE DECLARATIONS	-- Declarations for specific typed spaces.
 *	Declare structures that describe the typed_space.ts_data element.
 * FUNCTION DECLARATIONS	-- Function names for specific typed spaces.
 *	Declare all the functions need to manipulate your data type.
 * USEFUL SYMBOLS		-- Symbols needed by specific typed spaces.
 *	Anything else you need to define should go here.
 */

/*
 * DATA TYPES:  (values for ts_type in a typed_space)
 * All data types start with "T_".
 * Similar data types share a common prefix which is defined like this:
 * #define T_COMMON	(space_type)0xhh00
 * Specific types are then assigned sequentially from that:
 * #define T_COMMON_SPECIFIC	T_COMMON+n
 */
/* 
 * STRUCTURE DECLARATIONS.
 * These define the typed_space.ts_data elements that go with the above
 * data types.  They should be typedef'd to a name derivable from the
 * type name by removing the leading "T_" (see above.)
 *
 * E.g. For the type T_COMMON create this typedef:
 * typedef common {
 * ...
 * } COMMON;
 *
 * If the specific types need their own structs do them like this:
 * typedef common_specific {
 * ...
 * } COMMON_SPECIFIC;
 *
 */

/* USEFUL SYMBOLS.
 * If appropriate, be sure to define a form of NULL for your new data
 * type.  E.g. for the type COMMON
 * #define COMMON_NULL ((COMMON *) 0)
 *
 * If you need any other symbols define them here.
 */