|
|
1.1 root 1: Documentation for libtboot.a.
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30: Startup.s: .globl myds_
31: Startup.s: .globl seconddat
32: Startup.s: .globl nbuf_
33: Startup.s: .globl traks
34: Startup.s: .globl traks_
35: Startup.s: .globl sects
36: Startup.s: .globl sects_
37: Startup.s: .globl heads
38: Startup.s: .globl heads_
39: Startup.s: .globl drive
40: Startup.s: .globl drive_
41: Startup.s: .globl first
42: Startup.s: .globl first_
43: BASE10 cbootlib.c 83
44: BASE16 cbootlib.c 113
45: BITS_PER_INT16 cbootlib.c 251
46: BLOCK tboot.h 25
47: BS cbootlib.c 26
48: BUFSIZE tboot.h 55
49: COFF_SYS_BASE tboot.h 63
50: DEF_SYS_BASE tboot.h 64
51: DEL cbootlib.c 27
52: DIGITS_PER_INT16 cbootlib.c 252
53: DIGITS_PER_INT8 cbootlib.c 253
54: DISK tboot.h 56
55: DISKINT tboot.h 32
56: DISK_PARAMS tboot.h 33
57: FALSE tboot.h 20
58: FIRST tboot.h 59
59: FOURK tboot.h 23
60: FOURKBOUNDRY tboot.h 24
61: FULLSEG tboot.h 60
62: GIFTBOX gift.c 48
63: GREATEST tboot.h 74
64: HARD_DRIVE tboot.h 34
65: HIGH tboot.h 76
66: IBSHIFT tboot.h 52
67: INODES_PER_BLOCK tboot.h 38
68: INOMASK tboot.h 54
69: INOORG tboot.h 51
70: IOSHIFT tboot.h 53
71: KEYBD tboot.h 57
72: LESSER tboot.h 75
73: LINESIZE tboot.h 26
74: LOW tboot.h 77
75: MAIN tboot.c 23
76: MAXINT16 ptypes.h 16
77: MAXINT32 ptypes.h 20
78: MAXINT8 ptypes.h 12
79: MAXSEG cbootlib.c 177
80: MAXUINT16 ptypes.h 18
81: MAXUINT32 ptypes.h 22
82: MAXUINT8 ptypes.h 14
83: MAX_SEGS tboot.h 27
84: MIDNIGHT cbootlib.c 377
85: Mcoff coff.c main()
86: Mobjects objects.c main()
87: NAK cbootlib.c 28
88: NBUF bio.c 16
89: NHD tboot.h 42
90: NORMAL_MAGIC tboot.h 28
91: NSPT tboot.h 46
92: NTRK tboot.h 47
93: NULL tboot.h 22
94: PPMASK tboot.h 61
95: PPSIZE cbootlib.c 178
96: PROMPT monitor.c 15
97: PTYPES_H ptypes.h 6
98: READ1 tboot.h 58
99: RESIZE typed.h 40
100: RETYPE typed.h 42
101: ROOTINO tboot.h 50
102: SEVENONES indirect.c 139
103: SIXBITS tboot.h 36
104: SYS_START tboot.h 65
105: THE_DEV tboot.h 67
106: THE_XDEV tboot.h 68
107: TIMER_OFF cbootlib.c 375
108: TIMER_SEG cbootlib.c 374
109: TRUE tboot.h 19
110: TYPED_H typed.h 17
111: TYPED_SPACE fifo_k.c TYPED_SPACE(global_space, 128, T_FIFO_SIC); Static In-Core Fifo.
112: TYPED_SPACE gift.c TYPED_SPACE(local_gift, GIFTBOX, T_FIFO_SIC); Static In-Core Fifo.
113: TYPED_SPACE tboot.c TYPED_SPACE(boot_gift, 8192, T_FIFO_SIC); Static In-Core FIFO.
114: TYPED_SPACE typed.h 32
115: T_BIOS typed.h 63
116: T_BIOS_DISK typed.h 64
117: T_BIOS_ROOTDEV typed.h 65
118: T_FIFO typed.h 56
119: T_FIFO_DIC typed.h 58
120: T_FIFO_DP typed.h 60
121: T_FIFO_SIC typed.h 57
122: T_FIFO_SP typed.h 59
123: T_STR typed.h 68
124: T_STR_ARGF typed.h 71
125: T_STR_ARGV typed.h 69
126: T_STR_STR typed.h 70
127: T_UNKNOWN typed.h 53
128: WAIT_DELAY tboot.h 71
129: WS tboot.h 21
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153: _bread_ bootlib.m
154: _ffcopy_ bootlib.m
155: _xbread_ bootlib.m
156: arg_exist arg_exist.c
157: * Determine whether or not a given argument exists on the command line
158: * passed into the kernel.
159: *
160: * Takes a pointer to a NUL terminated string that is the name of
161: * the desired argument.
162: int arg_exist(arg)
163: basetoi cbootlib.c uint16 basetoi(char *s, base)
164: uint16 basetoi(); Convert an arbitrary base string to an integer.
165: * basetoi(char *s, int base)
166: * Convert a string base "base" to an integer.
167: * Good through base 36.
168: * Loosely based on K&R's atoi().
169: bclaim bio.c bclaim(block)
170: BUF *bclaim(); Claim a disk buffer.
171: bpick bio.c bpick()
172: BUF *bpick(); Pick a buffer to trash.
173: bread diskio.c bread(blockno)
174: /* Aligning bread.
175: * Reads 1 block into an arbitrary buffer. The assembly language
176: * routine bread() needs a buffer aligned on a 4K boundary.
177: */
178:
179: BUF *
180: bread(blockno)
181: daddr_t blo
182: brelease bio.c brelease(bp)
183: void brelease(); Free a disk buffer.
184: bufinit bio.c bufinit()
185: void bufinit(); Initialize disk buffers.
186: close sys.c int close(int fd)
187: int close(); /* Close a file descriptor. */
188: coff2load coff.c coff2load(ip, table, data_seg)
189: int
190: coff2load(ip, table, data_seg)
191: struct inode *ip; /* input: File to read. */
192: struct load_segment table[]; /* output: How to read it. */
193: uint16 *data_seg; /* output: Where to point es. */
194: * Convert COFF to load table.
195: * Used to generate loading instructions for use by tboot main().
196: * Returns true on successful translation.
197: coffnlist coff.c
198: Search COFF file for symbols.
199: int
200: coffnlist(fn, nlp, names, count)
201: char *fn; /* file name */
202: SYMENT *nlp; /* names to look up */
203: char *names; /* long names */
204: int count; /* size of passed table */
205:
206: dir builtin.c dir()
207: Create a listing of file names in /.
208: void dir()
209: dpb builtin.c dpb()
210: Display the BIOS parameters loaded up by the startup code.
211: void dpb()
212: dump_bios_disk gift.c dump_bios_disk(a_disk)
213: /* Dump a T_BIOS_DISK typed_space. */
214: void
215: dump_bios_disk(a_disk)
216: BIOS_DISK *a_disk;
217: dump_fifo gift.c dump_fifo(fifo)
218: /* Dump the contents of a fifo. */
219: void
220: dump_fifo(fifo)
221: typed_space *fifo;
222: dump_gift gift.c dump_gift()
223: /* Dump the contents of boot_gift. */
224: void
225: dump_gift()
226: dump_rootdev gift.c dump_rootdev(a_rootdev)
227: /* Dump a T_BIOS_ROOTDEV typed_space. */
228: void
229: dump_rootdev(a_rootdev)
230: BIOS_ROOTDEV *a_rootdev;
231: fdisk fdisk.c fdisk( fp )
232: * void
233: * fdisk( fp ) -- Fixed Disk Configuration
234: * dev_t dev;
235: * struct fdisk_s *fp;
236: * Input: fp = pointer to memory-resident partition info (to update)
237: *
238: * Action: Read first block from the device.
239: * If valid signature present on block,
240: * copy partition information to memory
241: *
242: * Return: 1 = partition information successfully updated
243: * 0 = failure (could not read block, or bad signature)
244:
245: ffcopy cbootlib.c ffcopy(to_offset, to_seg, from_offset, from_seg, length)
246: * Wrapper for far-far copy. Changes the segment so that the requested
247: * length does not wrap past the end of the segment.
248: *
249: * For Intel 8086 Real Mode.
250: void
251: ffcopy(to_offset, to_seg, from_offset, from_seg, length)
252: uint16 to_offset;
253: uint16 to_seg;
254: uint16 from_offset;
255: uint16 from_seg;
256: uint16 length;
257: fifo_close fifo_k.c fifo_close(ffp)
258: int fifo_close(); Finish with using a typed space as a fifo.
259: fifo_len fifo_b.c fifo_len(ffp)
260: long fifo_len(); /* Find out how long a fifo is. */
261: fifo_open fifo_k.c fifo_open(fifo_space, mode)
262: FIFO *fifo_open(); Open a typed space as a fifo.
263: fifo_read fifo_k.c fifo_read(ffp)
264: typed_space *fifo_read(); Read a typed space from a fifo.
265: fifo_rewind fifo_k.c fifo_rewind(ffp)
266: int fifo_rewind(); Go back to the start of the fifo.
267: fifo_write fifo_b.c fifo_write(ffp, space)
268: typed_space *fifo_write(); Write a typed space into an open fifo.
269: fifo_write_untyped fifo_b.c fifo_write_untyped(ffp, datum, size, type)
270: typed_space *fifo_write_untyped(); Write data into an open fifo.
271: getchar bootlib.m
272: gate_lock bio.c gate_lock(g)
273: int gate_lock(); Attempt to lock a GATE.
274: gate_locked bio.c gate_locked(g)
275: int gate_locked(); Check to see if a GATE is locked.
276: gate_unlock bio.c gate_unlock(g)
277: void gate_unlock(); Unlock a GATE.
278: get_num_of_drives builtin.c int get_num_of_drives()
279: /* Ask the BIOS how many drives are attached. */
280: int get_num_of_drives()
281: gets cbootlib.c gets(s)
282: char *gets(); Get a string from the keyboard.
283: gift_argf gift.c gift_argf(ffp, cmd_line)
284: /* Write an argument fifo into ffp from the command line cmd_line.
285: * Returns 0 if it runs out of space, 1 on success, and 2 if something else
286: * goes wrong.
287: */
288: int
289: gift_argf(ffp, cmd_line)
290: FIFO *ffp;
291: char *cmd_line;
292: gift_drive_params gift.c gift_drive_params(ffp)
293: /* Load the BIOS parameters loaded up by the startup code. */
294: int
295: gift_drive_params(ffp)
296: FIFO *ffp;
297: gift_rootdev gift.c gift_rootdev(ffp)
298: /* Write a structure describing the boot partition into a fifo.
299: * Returns 1 on success, 0 if it runs out of space, or 2 if it
300: * can't read the boot block.
301: */
302: int
303: gift_rootdev(ffp)
304: FIFO *ffp;
305: gotofar bootlib.m
306: gotoker bootlib.m
307: hdinit bootlib.m
308: ifread diskio.c ifread(ip, toseg, tooffset, offset, lenarg)
309: * Inode to Far READ: Load an arbitrary length from a file into a far address.
310: void
311: ifread(ip, toseg, tooffset, offset, lenarg)
312: struct inode *ip; /* Read from this file, */
313: uint16 toseg; /* into this far buffer, */
314: uint16 tooffset;
315: fsize_t offset; /* from here in the file, */
316: fsize_t lenarg; /* for this many bytes. */
317: ind_index indirect.c ind_index(ind_level, vblockno)
318: * uint16 ind_index(uint16 ind_level, daddr_t vblockno);
319: * Calculate the index needed for virtual block vblockno into
320: * a table of the given indirection level.
321: ind_lookup indirect.c ind_lookup(ind_level, ind_table, vblockno)
322: * Look up the next level of block in table ind_table, for virtual
323: * block number vblockno.
324: * Note that this table is in DISK CANNONICAL format. If the local
325: * notion of daddr_t is a different size from DISK CANONICAL daddr_t
326: daddr_t
327: ind_lookup(ind_level, ind_table, vblockno)
328: uint16 ind_level;
329: daddr_t *ind_table;
330: daddr_t vblockno;
331: indirect indirect.c indirect(ind_level, ind_table_ptr, vblockno)
332: * Recursively follow an indirection for a given virtual block number
333: * vblockno.
334: * ind_level must be the level of indirection still un-resolved.
335: * ind_table is the physical block number of the next indirection.
336: * daddr_t
337: * indirect(uint16 ind_level, daddr_t ind_table_ptr, daddr_t vblockno)
338: intcall intcall.m
339: int intcall(reg *srcreg, reg *destreg, int intnum);
340: Provide C interface to bios interrupts.
341: interpret builtin.c interpret(command)
342: * If possible, execute "command".
343: * Return "true" if the command exists, "false" otherwise.
344: int
345: interpret(command)
346: char *command;
347: intmon bootlib.m
348: iopen diskio.c iopen(meminode, inode_number)
349: * Inode OPEN: Load the inode for a file into memory.
350: * iopen(struct inode *ip,
351: * ino_t inode_number)
352: int
353: iopen(meminode, inode_number)
354: struct inode *meminode;
355: ino_t inode_number;
356: iread diskio.c iread(ip, buffer, offset, lenarg)
357: * Inode READ: Load a local buffer from a file.
358: void
359: iread(ip, buffer, offset, lenarg)
360: struct inode *ip; /* Read from this file, */
361: char *buffer; /* into this buffer, */
362: fsize_t offset; /* from here in the file, */
363: uint16 lenarg; /* for this many bytes. */
364: iskey bootlib.m
365: itoa cbootlib.c itoa(n, s)
366: void itoa(); Convert an integer to a decimal string.
367: itobase cbootlib.c itobase(n, s, base)
368: void itobase(); Convert an integer to an arbitrary base string.
369: l_out_nlist l.out.c l_out_nlist(fn, nlp)
370: * Get entries from l.out name list.
371: void
372: l_out_nlist(fn, nlp)
373: char *fn;
374: struct nlist *nlp;
375: lout2load l.out.c lout2load(ip, table, data_seg)
376: /* Convert l.out to load table.
377: * Used to generate loading instructions for use by tboot main().
378: * Returns true on successful translation.
379: */
380:
381: int
382: lout2load(ip, table, data_seg)
383: struct inode *ip; /* input: File to read. */
384: struct load_segment table[]; /* output: How to read it. */
385: uint16 *data_seg; /* output: Where to point es. */
386: lpad cbootlib.c lpad(s, c, n)
387: char *lpad(); Pad a string on the left.
388: lseek sys.c lseek(fd, where, how)
389: /* Set a read/write position.
390: * Changes the seek position for file descriptor fd.
391: * where and how describe the new seek position. where gives the
392: * number of bytes that you wish to move the seek position; it is
393: * measured from the beginning of the file if how is zero, from the
394: * current seek position if how is one, or from the end of the file
395: * if how is two. A successful call to lseek returns the new seek
396: * position; a failure returns (int32) -1.
397: */
398: long
399: lseek(fd, where, how)
400: int fd;
401: long where;
402: int how;
403: monitor monitor.c void monitor()
404: Mini-monitor for testing boot code.
405: namei diskio.c namei(filename)
406: * Convert a filename to an inode number. Returns inode number 0 on
407: * failure.
408: ino_t
409: namei(filename)
410: char *filename;
411: object2load objects.c object2load(magic, ip, table, data_seg)
412: /* Extract information from an object file that describes how to
413: * load an executable.
414: * The magic number of the file is in "magic".
415: * The object file's inode is in "ip".
416: *
417: * The information needed is extracted into "table".
418: * The value for the data segment is put in "data_seg".
419: *
420: * Returns TRUE if the needed information could be extracted, FALSE ow.
421: */
422:
423: int
424: object2load(magic, ip, table, data_seg)
425: uint16 magic;
426: struct inode *ip;
427: struct load_segment table[];
428: uint16 *data_seg;
429: object_nlist objects.c object_nlist(magic, filename, symbol)
430: /* Look up symbol(s) in an object file.
431: * searches the name list (symbol table) of the load module
432: * "filename" for each symbol in the array pointed to by "nlp".
433: *
434: * nlp points to an array of nlist structures, terminated by a
435: * structure with a null string as its n_name member.
436: *
437: * If "filename" is not a load module or has had its symbol table
438: * stripped, all returned n_type and n_value entries will be zero.
439:
440: uint16
441: object_nlist(magic, filename, symbol)
442: uint16 magic;
443: char *filename;
444: char *symbol;
445: object_sys_base objects.c object_sys_base(magic)
446: /* Determine the value for sys_base based on the type of the load file. */
447: uint16
448: object_sys_base(magic)
449: int magic;
450: open sys.c open(file, type)
451: /* Open a file.
452: * Takes a file name, file; and a way of opening it, type as follows:
453: * 0 Read only
454: * 1 Write
455: * 2 Read and write
456: * Only read is implimented.
457: *
458: * Returns a file descriptor, or -1 if the open failed.
459: */
460: int
461: open(file, type)
462: char *file;
463: int type;
464: print8 cbootlib.c print8(uint8 my_int)
465: void print8(); Print an 8 bit integer, base 16.
466: print16 cbootlib.c print16(uint16 my_int)
467: void print16(); Print a 16 bit integer, base 16.
468: print32 cbootlib.c print32(uint32 my_int)
469: void print32(); Print a 32 bit integer, base 16.
470: putchar bootlib.m
471: puts cbootlib.c puts(s)
472: void puts(); Put a string on the screen.
473: * puts() -- put a NUL terminated string.
474: * Takes one argument--a pointer to a NUL terminated character string.
475: * Does no error checking. Calls the assembly language routine putc().
476: read sys.c read(fd, buffer, n)
477: * Read from a file.
478: * Takes a file descriptor, a buffer, and a length to read.
479: *
480: * Returns the number of characters read, or -1 if an error occurs.
481: int
482: read(fd, buffer, n)
483: int fd;
484: char *buffer;
485: int n;
486: reverse cbootlib.c reverse(s)
487: void reverse(); Reverse a string in place.
488: sanity_check bio.c sanity_check(message)
489: * Sanity checker.
490: * Prints contents of "message" if something is amiss and dumps you
491: * into the monitor.
492: *
493: * Add tests and messages as needed.
494:
495: void
496: sanity_check(message)
497: char *message;
498: seg_align cbootlib.c seg_align(offset, segment)
499: void seg_align(); Align a far address.
500: seginc cbootlib.c seginc(offset, segment, increment)
501: /* seginc(uint16 *offset,
502: * uint16 *segment,
503: * uint16 increment)
504: * Add an offset to a segment. We may adjust the segment base
505: * to make everything fit.
506: */
507: vmap indirect.c vmap(ip, vblockno)
508: /* Convert the given virtual block to a physical block for the given inode.
509: * ip points to the in-core inode for a file.
510: * vblockno is a block number relative to the start of that file.
511: */
512: daddr_t
513: vmap(ip, vblockno)
514: struct inode *ip;
515: daddr_t vblockno;
516: wait_for_keystroke cbootlib.c wait_for_keystroke(delay, key)
517: int wait_for_keystrok(); Wait a time delay for a keystroke.
518: wrap_coffnlist coff.c wrap_coffnlist(fn, symbol)
519: * Look up the value of a single data symbol in a coff file,
520: * relative to the start of the data segment.
521: *
522: * We use the symbol "sdata" to find the start of the data segment--
523: * this works for 386 COHERENT kernels but will not work in general.
524: * It should really fetch the address of the start of the data segment
525: * from the data section header.
526: uint32
527: wrap_coffnlist(fn, symbol)
528: char *fn; /* file name */
529: char *symbol; /* symbol to look up */
530: xbread diskio.c xbread(blockno)
531: * Aligning xbread.
532: * Disk addresses are relative to the start of the disk, rather than
533: * the start of the partition.
534: * Reads 1 block into an arbitrary buffer. The assembly language
535: * routine xbread() needs a buffer aligned on a 4K boundary.
536: BUF *
537: xbread(blockno)
538: daddr_t blockno; /* Block number. */
539: * To pass a new data structure into the kernel:
540: *
541: * 1. Define your new data structure in typed.h. You will probably want
542: * to define some supporting routines for your data structure. These
543: * should go in a file by themselves. Be sure to add the file to the
544: * tboot Makefile.
545: *
546: * 2. Write a routine that takes at least an ffp, which will generate your
547: * data structure and write it into the ffp. The routine should return 0
548: * if it ran out of space in the FIFO. Other return values are permissible,
549: * but ignored. Add arguments to prepare_gift() as needed. It is called
550: * only from the end of main() in tboot.c
551: *
552: * 3. Add a call to your routine to prepare_gift() in the section marked
553: * FILL THE BOX. This is an if statement with || seperated calls. The
554: * most important data structures should be called first, because later
555: * calls will be skipped if the FIFO fills.
556: *
557: * 4. In the kernel (probably in a driver) you will want to add a loop to
558: * look through the gift for your data structure:
559: *
560: * FIFO *ffp;
561: * typed_space *tp;
562: *
563: * ffp = fifo_open(&boot_gift, 0); -- Open gift for reading.
564: *
565: * if (F_NULL == ffp) {
566: * indicate_error("Could not open boot_gift.");
567: * } else {
568: * while (T_NULL != (tp = fifo_read(ffp))) { -- While not EOFIFO.
569: * if (T_MYTYPE == tp->ts_type) { -- Is this my type?
570: * my_handler(tp->ts_data); -- Process the data.
571: * }
572: * }
573: * }
574: *
575: * Be sure to include fifo_k.c and typed.h into your kernel.
576:
577:
578: gift_drive_params
579:
580: gift_argf
581: * To read gift_argf from bootgift, use the procedure outlined above in
582: * point 4 to find the entry marked T_STR_ARGF. You must then explicitly
583: * recast it with RETYPE(tp->ts_data, T_FIFO_SIC). Then you can open it
584: * as a FIFO, with code modeled on point 4 above. This scheme seemed
585: * the simplest for uniquely identifying the argument FIFO.
586: * Each element of the FIFO is a T_STR_STR, so ts_data for these is
587: * just a NUL terminated string.
588:
589: gift_rootdev
590: /* typed.h -- Data structures for an implimentation of internally
591: * typed data structures.
592: *
593: * This file has 5 major sections:
594: * TYPED_SPACE DECLARATIONS -- Declarations for typed_space in general.
595: * DATA TYPES -- Values for typed_space.ts_type.
596: * Make at least one entry here when you add new data types.
597: * STRUCTURE DECLARATIONS -- Declarations for specific typed spaces.
598: * Declare structures that describe the typed_space.ts_data element.
599: * FUNCTION DECLARATIONS -- Function names for specific typed spaces.
600: * Declare all the functions need to manipulate your data type.
601: * USEFUL SYMBOLS -- Symbols needed by specific typed spaces.
602: * Anything else you need to define should go here.
603: */
604:
605: /*
606: * DATA TYPES: (values for ts_type in a typed_space)
607: * All data types start with "T_".
608: * Similar data types share a common prefix which is defined like this:
609: * #define T_COMMON (space_type)0xhh00
610: * Specific types are then assigned sequentially from that:
611: * #define T_COMMON_SPECIFIC T_COMMON+n
612: */
613: /*
614: * STRUCTURE DECLARATIONS.
615: * These define the typed_space.ts_data elements that go with the above
616: * data types. They should be typedef'd to a name derivable from the
617: * type name by removing the leading "T_" (see above.)
618: *
619: * E.g. For the type T_COMMON create this typedef:
620: * typedef common {
621: * ...
622: * } COMMON;
623: *
624: * If the specific types need their own structs do them like this:
625: * typedef common_specific {
626: * ...
627: * } COMMON_SPECIFIC;
628: *
629: */
630:
631: /* USEFUL SYMBOLS.
632: * If appropriate, be sure to define a form of NULL for your new data
633: * type. E.g. for the type COMMON
634: * #define COMMON_NULL ((COMMON *) 0)
635: *
636: * If you need any other symbols define them here.
637: */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.