[9] | 1 | /* Constants describing the disk */
|
---|
| 2 | #define SECTOR_SIZE 512
|
---|
| 3 | #define SECTOR_SHIFT 9
|
---|
| 4 | #define RATIO(b) ((b)/SECTOR_SIZE)
|
---|
| 5 | #define ISO_SECTOR_SIZE 2048
|
---|
| 6 | #define ISO_PVD_OFFSET 16
|
---|
| 7 | #define HRATIO (SECTOR_SIZE / HCLICK_SIZE)
|
---|
| 8 | #define PARAMSEC 1 /* sector containing boot parameters */
|
---|
| 9 | #define DSKBASE 0x1E /* floppy disk parameter vector */
|
---|
| 10 | #define DSKPARSIZE 11 /* there are this many bytes of parameters */
|
---|
| 11 | #define ESC '\33' /* escape key */
|
---|
| 12 | #define HEADERSEG 0x0060 /* place for an array of struct exec's */
|
---|
| 13 | #define MINIXSEG 0x0080 /* MINIX loaded here (rounded up to a click) */
|
---|
| 14 | #define BOOTSEG 0x07C0 /* bootstraps are loaded here */
|
---|
| 15 | #define SIGNATURE 0xAA55 /* proper bootstraps have this signature */
|
---|
| 16 | #define SIGNATPOS 510 /* offset within bootblock */
|
---|
| 17 | #define FREESEG 0x0800 /* Memory from FREESEG to cseg is free */
|
---|
| 18 | #define MSEC_PER_TICK 55 /* 18.2 ticks per second */
|
---|
| 19 |
|
---|
| 20 | /* Scan codes for four different keyboards (from kernel/keyboard.c) */
|
---|
| 21 | #define DUTCH_EXT_SCAN 32 /* 'd' */
|
---|
| 22 | #define OLIVETTI_SCAN 12 /* '=' key on olivetti */
|
---|
| 23 | #define STANDARD_SCAN 13 /* '=' key on IBM */
|
---|
| 24 | #define US_EXT_SCAN 22 /* 'u' */
|
---|
| 25 |
|
---|
| 26 | /* Other */
|
---|
| 27 | #define ROOT_INO ((ino_t) 1) /* Inode nr of root dir. */
|
---|
| 28 | #define IM_NAME_MAX 63
|
---|
| 29 |
|
---|
| 30 | /* Variables */
|
---|
| 31 | #ifndef EXTERN
|
---|
| 32 | #define EXTERN extern
|
---|
| 33 | #endif
|
---|
| 34 |
|
---|
| 35 | typedef struct vector {
|
---|
| 36 | u16_t offset;
|
---|
| 37 | u16_t segment;
|
---|
| 38 | } vector;
|
---|
| 39 |
|
---|
| 40 | struct image_header {
|
---|
| 41 | char name[IM_NAME_MAX + 1]; /* Null terminated. */
|
---|
| 42 | struct exec process;
|
---|
| 43 | };
|
---|
| 44 |
|
---|
| 45 | EXTERN vector rem_part; /* boot partition table entry */
|
---|
| 46 | EXTERN u16_t cseg, dseg; /* code and data segment of the boot program */
|
---|
| 47 | EXTERN u32_t runsize; /* size of this program */
|
---|
| 48 | EXTERN u16_t device; /* drive being booted from */
|
---|
| 49 | EXTERN u16_t heads, sectors; /* the drive's number of heads and sectors */
|
---|
| 50 | extern u16_t eqscancode; /* Set by peek/getch() if they see a '=' */
|
---|
| 51 |
|
---|
| 52 | /* Sticky attributes */
|
---|
| 53 | #define E_SPECIAL 0x01 /* These are known to the program */
|
---|
| 54 | #define E_DEV 0x02 /* The value is a device name */
|
---|
| 55 | #define E_RESERVED 0x04 /* May not be set by user, e.g. scancode */
|
---|
| 56 | #define E_STICKY 0x07 /* Don't go once set */
|
---|
| 57 |
|
---|
| 58 | /* Volatile attributes */
|
---|
| 59 | #define E_VAR 0x08 /* Variable */
|
---|
| 60 | #define E_FUNCTION 0x10 /* Function definition */
|
---|
| 61 |
|
---|
| 62 | typedef struct environment {
|
---|
| 63 | struct environment *next;
|
---|
| 64 | char flags;
|
---|
| 65 | char *name; /* name = value */
|
---|
| 66 | char *arg; /* name(arg) {value} */
|
---|
| 67 | char *value;
|
---|
| 68 | char *defval; /* Safehouse for default values */
|
---|
| 69 | } environment;
|
---|
| 70 |
|
---|
| 71 | /* External variables */
|
---|
| 72 | EXTERN environment *env; /* Lists the environment */
|
---|
| 73 | EXTERN int fsok; /* True if the boot device contains an FS */
|
---|
| 74 | EXTERN u32_t lowsec; /* Offset to the file system on the boot dev */
|
---|
| 75 |
|
---|
| 76 | /* Prototypes */
|
---|
| 77 | _PROTOTYPE( off_t r_super, (void));
|
---|
| 78 | _PROTOTYPE( void r_stat, (Ino_t _inum, struct stat *_stp ));
|
---|
| 79 | _PROTOTYPE( ino_t r_readdir, (char *_name ));
|
---|
| 80 | _PROTOTYPE( off_t r_vir2abs, (off_t _virblk ));
|
---|
| 81 | _PROTOTYPE( ino_t r_lookup, (Ino_t _cwd, char *_path ));
|
---|
| 82 |
|
---|
| 83 | #ifdef _MONHEAD
|
---|
| 84 | _PROTOTYPE( void readerr, (off_t _sec, int _err ));
|
---|
| 85 | _PROTOTYPE( int numprefix, (char *_s, char **_ps ));
|
---|
| 86 | _PROTOTYPE( int numeric, (char *_s ));
|
---|
| 87 | _PROTOTYPE( dev_t name2dev, (char *_name ));
|
---|
| 88 | _PROTOTYPE( int delay, (char *_msec ));
|
---|
| 89 | _PROTOTYPE( char *unix_err, (int _err ));
|
---|
| 90 | _PROTOTYPE( void init_cache, (void));
|
---|
| 91 | _PROTOTYPE( void invalidate_cache, (void));
|
---|
| 92 | _PROTOTYPE( char *b_value, (char *_name ));
|
---|
| 93 | _PROTOTYPE( void raw_copy, (int _doff, int _dseg, int _soff, int _sseg,
|
---|
| 94 | int _count));
|
---|
| 95 | _PROTOTYPE( void raw_clear, (int _off, int _seg, int _count));
|
---|
| 96 | _PROTOTYPE( void bootstrap, (int _device, int _partoff, int _partseg));
|
---|
| 97 |
|
---|
| 98 | _PROTOTYPE( long a2l, (char *_a ));
|
---|
| 99 | _PROTOTYPE( char *ul2a, (u32_t _n ));
|
---|
| 100 | _PROTOTYPE( char *u2a, (int _n1 ));
|
---|
| 101 |
|
---|
| 102 | /* Functions defined in monhead.s and usable by other files. */
|
---|
| 103 | _PROTOTYPE( void reset_video, (int color));
|
---|
| 104 | _PROTOTYPE( int dev_geometry, (void));
|
---|
| 105 | _PROTOTYPE( u16_t get_ext_memsize, (void));
|
---|
| 106 | _PROTOTYPE( u16_t get_low_memsize, (void));
|
---|
| 107 | _PROTOTYPE( u16_t get_processor, (void));
|
---|
| 108 | _PROTOTYPE( u32_t get_tick, (void));
|
---|
| 109 | _PROTOTYPE( u16_t get_video, (void));
|
---|
| 110 | _PROTOTYPE( u16_t get_word, (int _off, int _seg));
|
---|
| 111 | _PROTOTYPE( int getchar, (void));
|
---|
| 112 | _PROTOTYPE( void minix, (void));
|
---|
| 113 | _PROTOTYPE( void minix86, (int _kcs, int _kds, char *_bpar, int _psize));
|
---|
| 114 | _PROTOTYPE( void minix386, (int _kcs, int _kds, char *_bpar, int _psize));
|
---|
| 115 | _PROTOTYPE( int peekchar, (void));
|
---|
| 116 | _PROTOTYPE( void put_word, (int _off, int _seg, int _word));
|
---|
| 117 | _PROTOTYPE( int putchar, (char _c));
|
---|
| 118 | _PROTOTYPE( int readsectors, (int _off, int _seg, off_t _adr, int _ct));
|
---|
| 119 | _PROTOTYPE( void reboot, (void));
|
---|
| 120 | _PROTOTYPE( void relocate, (void));
|
---|
| 121 | _PROTOTYPE( int writesectors, (int _off, int _seg, off_t _adr, int _ct));
|
---|
| 122 | #endif
|
---|
| 123 |
|
---|