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