source: trunk/minix/include/tools.h@ 10

Last change on this file since 10 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 4.5 KB
RevLine 
[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
35typedef struct vector {
36 u16_t offset;
37 u16_t segment;
38} vector;
39
40struct image_header {
41 char name[IM_NAME_MAX + 1]; /* Null terminated. */
42 struct exec process;
43};
44
45EXTERN vector rem_part; /* boot partition table entry */
46EXTERN u16_t cseg, dseg; /* code and data segment of the boot program */
47EXTERN u32_t runsize; /* size of this program */
48EXTERN u16_t device; /* drive being booted from */
49EXTERN u16_t heads, sectors; /* the drive's number of heads and sectors */
50extern 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
62typedef 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 */
72EXTERN environment *env; /* Lists the environment */
73EXTERN int fsok; /* True if the boot device contains an FS */
74EXTERN 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
Note: See TracBrowser for help on using the repository browser.