Annotation of coherent/d/conf/tboot/tboot.h, revision 1.1.1.1

1.1       root        1: /* Include file for tertiary boot programs.
                      2:  *
                      3:  * This is a real hodge-podge of symbols.  If you are looking to improve
                      4:  * code readability, start by hacking this file into many tiny pieces.
                      5:  *
                      6:  * La Monte H. Yarroll <[email protected]>, September 1991
                      7:  */
                      8: 
                      9: #ifndef TBOOT_H        /* Rest of file. */
                     10: #define TBOOT_H
                     11: 
                     12: #ifdef MAIN
                     13: #define EXTERN
                     14: #else
                     15: #define EXTERN extern
                     16: #endif
                     17: 
                     18: #include <sys/types.h>
                     19: #include <sys/buf.h>
                     20: #include <sys/ptypes.h>
                     21: 
                     22: #define TRUE   (1==1)
                     23: #define FALSE  (1==2)
                     24: #define WS     " \t"
                     25: #define        NULL    ((char *)0)
                     26: #define        FOURK   0x1000  /* 4k page.  Needed for alignment purposes.  */
                     27: #define FOURKBOUNDRY   0xf000
                     28: #define BLOCK  512     /* 512 bytes per disk block.  */
                     29: #define LINESIZE 81    /* Size of typical line with NUL terminator.  */
                     30: #define        MAX_SEGS 8      /* Maximum number of executable file segs + 1.  */
                     31: #define RBOOTS 0x8000  /* This constant is from Startup.s.  It is the
                     32:                         * segment to which tboot relocates itself.
                     33:                         * Setting it in this file will only affect
                     34:                         * the check in seg_too_high().
                     35:                         */
                     36: #define NORMAL_MAGIC 0x10B     /* Value of optional header magic
                     37:                                 * for normal executable file.
                     38:                                 */
                     39: 
                     40: #define DISKINT        0x13            /* Disk drive interrupt.  */
                     41: #define DISK_PARAMS (8 << 8)   /* Return Disk Drive Parameters function.  */
                     42: #define HARD_DRIVE 0x80                /* Select fixed disks.  */
                     43: 
                     44: #define SIXBITS 0x3f           /* Lower six bits of a byte.  */
                     45: 
                     46: #define INODES_PER_BLOCK 8
                     47: 
                     48: 
                     49: #ifndef        NHD
                     50: #define        NHD     1                       /* # of heads per drive [1 for f9d0]. */
                     51: #endif
                     52: 
                     53: #ifndef        NSPT
                     54: #define        NSPT    9                       /* # of sectors per track on floppy. */
                     55: #define        NTRK    40                      /* # of tracks on floppy. */
                     56: #endif
                     57: 
                     58: #define ROOTINO 2                      /* Root inode # */
                     59: #define INOORG 2                       /* First inode block. */
                     60: #define IBSHIFT 3                      /* Shift, inode to blocks */
                     61: #define IOSHIFT 6                      /* Shift, inode to bytes */
                     62: #define INOMASK 0x0007                 /* Mask, inode to offset */
                     63: #define BUFSIZE 512                    /* Block size. */
                     64: #define DISK   0x13                    /* Disk Interrupt */
                     65: #define KEYBD  0x16                    /* Keyboard Interrupt */
                     66: #define READ1  0x0201                  /* read one sector */
                     67: #define FIRST  8                       /* Relative start of partition. */
                     68: #define FULLSEG        0xffff                  /* Size of a whole 8086 segment. */
                     69: #define PPMASK (unsigned short) 0xfff0 /* Mask for rounding to paragraph.  */
                     70: 
                     71: #define COFF_SYS_BASE  0x0200          /* System load base paragraph for 386.  */
                     72: #define DEF_SYS_BASE   0x0060          /* System load base paragraph. */
                     73: #define SYS_START      0x0100          /* System entry point. */
                     74: 
                     75: #define THE_DEV                ((dev_t)0x01)   /* The one disk device we recognize.  */
                     76: #define THE_XDEV       ((dev_t)0x02)   /* The whole disk device, rather than partition.  */
                     77: 
                     78: /* WAIT_DELAY is how long to wait after finding autoboot before booting.  */
                     79: #define WAIT_DELAY     91      /* 5 seconds * 18.2 clicks per second.  */
                     80: 
                     81: /* Maximum number of tokens on one command line.  */
                     82: #define MAX_TOKENS     10
                     83: 
                     84: /* Useful macros.  */
                     85: #define GREATEST(a, b, c) (a > (b>c?b:c) ? a : (b>c?b:c))
                     86: #define LESSER(a, b) (a < b ? a : b)
                     87: #define HIGH(x)        (x >> 8)        /* High byte of 16 bit number.  */
                     88: #define LOW(x) (x & 0xff)      /* Low byte of 16 bit number.  */
                     89: #define VERBOSE(c) if (verbose_flag) { c; }
                     90: /*
                     91:  * Macros for evaluating return codes from get_cpu_type().
                     92:  */
                     93: #define IS_PRE_AT(f)   ((f)==0)
                     94: #define IS_I286(f)     ((f)==1)
                     95: #define IS_I386(f)     ((f)==2)
                     96: 
                     97: /* Register structure used by call_bios().  */
                     98: struct reg {
                     99:        unsigned r_ax;
                    100:        unsigned r_bx;
                    101:        unsigned r_cx;
                    102:        unsigned r_dx;
                    103:        unsigned r_si;
                    104:        unsigned r_di;
                    105:        unsigned r_ds;
                    106:        unsigned r_es;
                    107:        unsigned r_flags;
                    108: };
                    109: 
                    110: /* Table entry describing a generic segment in an executable file.  */
                    111: struct load_segment {
                    112:        int valid;                      /* Is this a valid table entry? */
                    113:        char *message;                  /* Message to print while loading.  */
                    114:        uint16 load_toseg;      /* Where in memory to           */
                    115:        uint16 load_tooffset;   /* load this segment.           */
                    116:        fsize_t load_offset;    /* Where in file to get it.     */
                    117:        fsize_t load_length;    /* How long it is.              */
                    118: };
                    119: 
                    120: extern int intcall();  /* Provide C interface to bios interrupts.  */
                    121: /* int intcall(reg *srcreg, reg *destreg, int intnum);  */
                    122: extern void puts();    /* Put a string on the screen.  */
                    123: extern char *gets();   /* Get a string from the keyboard.  */
                    124: extern void reverse(); /* Reverse a string in place.  */
                    125: extern void itoa();    /* Convert an integer to a decimal string.  */
                    126: extern void itobase(); /* Convert an integer to an arbitrary base string.  */
                    127: extern uint16 basetoi(); /* Convert an arbitrary base string to an integer.  */
                    128: extern daddr_t vmap(); /* Convert file block number to physical block number.  */
                    129: extern char *lpad();   /* Pad a string on the left.  */
                    130: extern uint16 object_nlist();  /* Look up a symbol in an object file.  */
                    131: extern uint16 object_sys_base(); /* Generate a default sys_base.  */
                    132: extern uint32 wrap_coffnlist();        /* Candy coated coff nlist().  */
                    133: extern int wait_for_keystrok();        /* Wait a time delay for a keystroke.  */
                    134: extern BUF *bread();           /* Read a disk block.  */
                    135: extern BUF *xbread();          /* Read a disk block rel. to the whole disk.  */
                    136: extern BUF *bclaim();          /* Claim a disk buffer.  */
                    137: extern BUF *bpick();           /* Pick a buffer to trash.  */
                    138: extern void bufinit();         /* Initialize disk buffers.  */
                    139: extern void brelease();                /* Free a disk buffer.  */
                    140: extern int gate_lock();                /* Attempt to lock a GATE.  */
                    141: extern int gate_locked();      /* Check to see if a GATE is locked.  */
                    142: extern void gate_unlock();     /* Unlock a GATE.  */
                    143: extern void print8();          /* Print an 8 bit integer, base 16.  */
                    144: extern void print16();         /* Print a 16 bit integer, base 16.  */
                    145: extern void print32();         /* Print a 32 bit integer, base 16.  */
                    146: extern void sanity_check();    /* Check for insane conditions.  */
                    147: extern void seg_align();       /* Align a far address.  */
                    148: extern int coff2load();                /* Convert COFF to load table.  */
                    149: extern int coffnlist();                /* Search COFF file for symbols.  */
                    150: extern void dump_bios_disk();  /* Dump a T_BIOS_DISK typed space.  */
                    151: extern void dump_fifo();       /* Dump a T_FIFO* typed space.  */
                    152: extern void dump_gift();       /* Dump the boot_gift typed space.  */
                    153: extern void dump_rootdev();    /* Dump a T_BIOS_ROOTDEV typed space.  */
                    154: extern int gift_argf();                /* Prepare a command line gift.  */
                    155: extern int gift_drive_params();        /* Prepare a drive description from the BIOS.  */
                    156: extern int gift_rootdev();     /* Indentify the boot partition to the kernel.  */
                    157: extern void seginc();          /* Add an offset to a segment.  */
                    158: extern void ffcopy();          /* Copy from one far address to another.  */
                    159: extern int read();             /* Read from a file descriptor.  */
                    160: extern int open();             /* Open a file descriptor.  */
                    161: extern long lseek();           /* Set a read/write position in a file.  */
                    162: extern int close();            /* Close a file descriptor.  */
                    163: extern int object2load();      /* Extract information to load an executable.  */
                    164: extern void monitor();         /* Mini-monitor for testing boot code.  */
                    165: extern int lout2load();                /* Convert l.out to load table.  */
                    166: extern void l_out_nlist();     /* Get entries from l.out name list.  */
                    167: extern int iopen();            /* Open an inode for a file.  */
                    168: extern ino_t namei();  /* Convert from a name to an inode.  */
                    169: extern void iread();   /* Read from a file, given an inode.  */
                    170: extern void ifread();  /* Read from a file into a far buffer, given an inode.  */
                    171: extern daddr_t indirect();     /* Follow a block indirection out.  */
                    172: extern daddr_t ind_lookup();   /* Look up a block in an indirection table.  */
                    173: extern uint16 ind_index();     /* Calculate index into an indirection table.  */
                    174: extern int get_num_of_drives();        /* Ask the BIOS how many drives are attached.  */
                    175: extern int interpret();        /* Attempt to execute a builtin command.  */
                    176: extern void dpb();     /* Display parameters from bios.  */
                    177: extern void dir();     /* List contents of /.  */
                    178: extern int fdisk();    /* Read fixed disk configuration.  */
                    179: 
                    180: extern int errno;      /* Error number for "system" calls.  */
                    181: EXTERN uint16 sys_base;        /* Segment into which to load the kernel.  */
                    182: EXTERN int sys_base_set;       /* Has sys_base been explicitly set?  */
                    183: EXTERN int want_monitor;       /* Should we invoke monitor before execution?  */
                    184: EXTERN int verbose_flag;       /* Be verbose?  */
                    185: #endif /* TBOOT_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.