|
|
1.1 root 1: /*
2:
3: Copyright 1990,1991,1992 Eric R. Smith. All rights reserved.
4:
5: */
6:
7:
8:
9: #ifndef _mem_h
10:
11: #define _mem_h
12:
13:
14:
1.1.1.2 ! root 15: #include "file.h"
! 16:
! 17:
! 18:
1.1 root 19: typedef struct memregion {
20:
21: long loc; /* base of memory region */
22:
23: ulong len; /* length of memory region */
24:
25: ushort links; /* number of users of region */
26:
27: ushort mflags; /* e.g. which map this came from */
28:
29: struct memregion *next; /* next region in memory map */
30:
31: } MEMREGION;
32:
33:
34:
35: /* dummy type for virtual addresses */
36:
37: typedef struct vaddr {
38:
39: char dummy;
40:
41: } *virtaddr;
42:
43:
44:
45: /* flags for memory regions */
46:
1.1.1.2 ! root 47: #define M_CORE 0x01 /* region came from core map */
! 48:
! 49: #define M_ALT 0x02 /* region came from alt map */
! 50:
! 51: #define M_SWAP 0x04 /* region came from swap map */
! 52:
! 53: #define M_KER 0x08 /* region came from kernel map */
! 54:
! 55: #define M_MAP 0x0f /* and with this to pick out map */
! 56:
! 57:
! 58:
! 59: #define M_SHTEXT 0x10 /* region is a shared text region */
! 60:
! 61: #define M_KEEP 0x0100 /* don't free on process termination */
! 62:
! 63:
! 64:
! 65: /* structure for shared text regions */
! 66:
! 67:
! 68:
! 69: typedef struct shtextreg {
! 70:
! 71: FILEPTR *f; /* what file did this come from? */
! 72:
! 73: MEMREGION *text; /* pointer to shared text region */
! 74:
! 75: short mtime, mdate; /* date & time for file */
! 76:
! 77: struct shtextreg *next;
1.1 root 78:
1.1.1.2 ! root 79: } SHTEXT;
1.1 root 80:
81:
82:
1.1.1.2 ! root 83: /* structure of exectuable program headers */
1.1 root 84:
1.1.1.2 ! root 85: typedef struct fileheader {
1.1 root 86:
1.1.1.2 ! root 87: short fmagic;
1.1 root 88:
1.1.1.2 ! root 89: long ftext;
! 90:
! 91: long fdata;
! 92:
! 93: long fbss;
! 94:
! 95: long fsym;
! 96:
! 97: long reserved;
! 98:
! 99: long flag;
! 100:
! 101: short reloc;
! 102:
! 103: } FILEHEAD;
! 104:
! 105:
! 106:
! 107: #define GEMDOS_MAGIC 0x601a
1.1 root 108:
109:
110:
111: /* flags for curproc->memflags */
112:
1.1.1.2 ! root 113: /* also used for program headers */
! 114:
1.1 root 115: #define F_FASTLOAD 0x01 /* don't zero heap */
116:
117: #define F_ALTLOAD 0x02 /* OK to load in alternate ram */
118:
119: #define F_ALTALLOC 0x04 /* OK to malloc from alt. ram */
120:
1.1.1.2 ! root 121: #define F_RESERVED 0x08 /* reserved for future use */
! 122:
! 123: #define F_MEMFLAGS 0xf0 /* reserved for future use */
! 124:
! 125: #define F_SHTEXT 0x800 /* program's text may be shared */
! 126:
! 127:
! 128:
! 129: #define F_MINALT 0xf0000000L /* used to decide which type of RAM to load in */
! 130:
1.1 root 131:
132:
133: /* flags for Malloc/Mxalloc */
134:
135: #define F_KEEP 0x4000 /* don't free memory on termination */
136:
137:
138:
139: typedef MEMREGION **MMAP;
140:
1.1.1.2 ! root 141:
! 142:
! 143: #ifndef GENMAGIC
! 144:
1.1 root 145: extern MMAP core, alt, ker, swap;
146:
1.1.1.2 ! root 147: #endif
! 148:
1.1 root 149:
150:
151: /* compilers differ on what "sizeof" returns */
152:
153: #define SIZEOF (long)sizeof
154:
155:
156:
157: /* MiNT leaves this much memory for TOS to use
158:
159: */
160:
161: #define TOS_MEM (8*1024L)
162:
163:
164:
165: /* MiNT tries to keep this much memory available for the kernel and other
166:
167: * programs when a program is launched
168:
169: */
170:
171: #define KEEP_MEM (8*1024L)
172:
173:
174:
175: /*
176:
177: * how much memory should be allocated to the kernel?
178:
179: */
180:
181: #define KERNEL_MEM (24*1024L)
182:
183:
184:
185: /* macro for rounding off region sizes */
186:
187: #define MASKBITS 0xf
188:
189: #define ROUND(size) ((size + MASKBITS) & ~MASKBITS)
190:
191:
192:
193: #endif /* _mem_h */
194:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.