1{
2    This file is part of the Free Pascal run time library.
3    Copyright (c) 2016 by Free Pascal development team
4
5    exec.library functions for Amiga OS 4.x
6
7    See the file COPYING.FPC, included in this distribution,
8    for details about the copyright.
9
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14 **********************************************************************}
15
16{$PACKRECORDS 2}
17
18{$i utild1.inc}
19
20// TODO: ExtMem.h - still missing ExtMemIFace discuss how to (open all possible interfaces)
21//                  or make an other unit?
22//       Initializers.h - Macros needed?
23
24type
25  STRPTR   = PChar;
26  PSTRPTR  = PPChar;
27  ULONG    = Longword;
28  LONG     = LongInt;
29  APTR     = Pointer;
30  //BPTR     = LongInt; // Long word (BCPL) pointer
31  //BSTR     = LongInt; // Long word pointer to BCPL string
32  BOOL     = SmallInt;
33  UWORD    = Word;
34  WORDBITS = Word;
35  LONGBITS = LongWord;
36  PLONGBITS = ^LONGBITS;
37  UBYTE    = Byte;
38  PULONG   = ^LongWord;
39  PAPTR    = ^APTR;
40  PLONG    = ^LONG;
41
42type
43// List Node Structure.  Each member in a list starts with a Node
44  PNode = ^TNode;
45  TNode =  record
46    ln_Succ,           // Pointer to next (successor)
47    ln_Pred: PNode;    // Pointer to previous (predecessor)
48    ln_Type: Byte;
49    ln_Pri: Shortint;  // Priority, for sorting
50    ln_Name: STRPTR;   // ID string, null terminated
51  end;  // Note: smallint aligned
52
53// minimal node -- no type checking possible
54  PMinNode = ^TMinNode;
55  TMinNode =  record
56    mln_Succ,
57    mln_Pred: PMinNode;
58  end;
59
60// Note: Newly initialized IORequests, and software interrupt structures
61// used with Cause(), should have type NT_UNKNOWN.  The OS will assign a type
62// when they are first used.
63// ----- Node Types for LN_TYPE -----
64const
65  NT_UNKNOWN      =  0;
66  NT_TASK         =  1;  // Exec task
67  NT_INTERRUPT    =  2;
68  NT_DEVICE       =  3;
69  NT_MSGPORT      =  4;
70  NT_MESSAGE      =  5;  // Indicates message currently pending
71  NT_FREEMSG      =  6;
72  NT_REPLYMSG     =  7;  // Message has been replied
73  NT_RESOURCE     =  8;
74  NT_LIBRARY      =  9;
75  NT_MEMORY       = 10;
76  NT_SOFTINT      = 11;  // Internal flag used by SoftInits
77  NT_FONT         = 12;
78  NT_PROCESS      = 13;  // AmigaDOS Process
79  NT_SEMAPHORE    = 14;
80  NT_SIGNALSEM    = 15;  // signal semaphores
81  NT_BOOTNODE     = 16;
82  NT_KICKMEM      = 17;
83  NT_GRAPHICS     = 18;
84  NT_DEATHMESSAGE = 19;
85
86  // New additions in V50
87  NT_EXTINTERRUPT =  20;  // Native interrupt
88  NT_EXTSOFTINT   =  21;  // Native soft interrupt
89  NT_VMAREA       =  22;  // Internal use only
90  NT_VMAREA_PROXY =  23;  // Internal use only
91  NT_CLASS        =  24;  // Class
92  NT_INTERFACE    =  25;  // Interface
93
94  // New additions in V51
95  NT_KMEMCACHE    =  26;  // Internal use only
96  NT_RESERVED1    =  27;
97
98  // New additions in V53
99  NT_FILESYSTEM   =  28;  // For new style Vector-Port based Filesystems
100
101  // New additions in V54
102  NT_PAGE         =  40;
103
104  NT_ELFHANDLE    =  41;
105  NT_SOLIBHANDLE  =  42;
106
107  NT_USER         = 254;  // User node types work down from here
108  NT_EXTENDED     = 255;
109
110
111// START consts and types from utility needed here
112
113const
114// differentiates user tags from control tags
115 TAG_USER = $80000000;    // differentiates user tags from system tags
116type
117  Tag = LongWord;
118  PTag = ^Tag;
119
120  PTagItem = ^TTagItem;
121  TTagItem = record
122    ti_Tag: Tag;        // identifies the type of data
123    ti_Data: LongWord;  // type-specific data
124  end;
125  PPTagItem = ^PTagItem;
126
127  PHook = ^THook;
128  THook = record
129    h_MinNode: TMinNode;
130    h_Entry: Pointer;    // assembler entry point
131    h_SubEntry: Pointer; // often HLL entry point
132    h_Data: Pointer;     // owner specific
133  end;
134
135// END consts and types from utility needed here
136
137
138const
139  {There is a problem with boolean
140  vaules in taglists, just use this
141  for now instead}
142  LTrue : LongInt = 1;
143  LFalse: LongInt = 0;
144
145{
146    This file defines Exec system lists, which are used to link
147    various things.  Exec provides several routines to handle list
148    processing (defined at the bottom of this file), so you can
149    use these routines to save yourself the trouble of writing a list
150    package.
151}
152
153
154type
155// Full featured list header.
156  PList = ^TList;
157  TList =  record
158    lh_Head: PNode;
159    lh_Tail: PNode;
160    lh_TailPred: PNode;
161    lh_Type: Byte;
162    l_pad: Byte;
163  end; // word aligned
164
165// Minimal List Header - no type checking
166  PMinList = ^TMinList;
167  TMinList =  record
168    mlh_Head: PMinNode;
169    mlh_Tail: PMinNode;
170    mlh_TailPred: PMinNode;
171  end; // LongWord aligned
172
173
174{ ********************************************************************
175*
176*  Format of the alert error number:
177*
178*    +-+-------------+----------------+--------------------------------+
179*    |D|  SubSysId   |  General Error |    SubSystem Specific Error    |
180*    +-+-------------+----------------+--------------------------------+
181*     1    7 bits          8 bits                  16 bits
182*
183*                    D:  Deadend alert
184*             SubSysId:  indicates ROM subsystem number.
185*        General Error:  roughly indicates what the error was
186*       Specific Error:  indicates more detail
187*********************************************************************}
188
189const
190{*********************************************************************
191*
192*  Hardware/CPU specific alerts:  They may show without the 8 at the
193*  front of the number.  These are CPU/68000 specific.  See 68$0
194*  programmer's manuals for more details.
195*
196*********************************************************************}
197  ACPU_BusErr     = $80000002;      { Hardware bus fault/access error }
198  ACPU_AddressErr = $80000003;      { Illegal address access (ie: odd) }
199  ACPU_InstErr    = $80000004;      { Illegal instruction }
200  ACPU_DivZero    = $80000005;      { Divide by zero }
201  ACPU_CHK        = $80000006;      { Check instruction error }
202  ACPU_TRAPV      = $80000007;      { TrapV instruction error }
203  ACPU_PrivErr    = $80000008;      { Privilege violation error }
204  ACPU_Trace      = $80000009;      { Trace error }
205  ACPU_LineA      = $8000000A;      { Line 1010 Emulator error }
206  ACPU_LineF      = $8000000B;      { Line 1111 Emulator error }
207  ACPU_Format     = $8000000E;      { Stack frame format error }
208  ACPU_Spurious   = $80000018;      { Spurious interrupt error }
209  ACPU_AutoVec1   = $80000019;      { AutoVector Level 1 interrupt error }
210  ACPU_AutoVec2   = $8000001A;      { AutoVector Level 2 interrupt error }
211  ACPU_AutoVec3   = $8000001B;      { AutoVector Level 3 interrupt error }
212  ACPU_AutoVec4   = $8000001C;      { AutoVector Level 4 interrupt error }
213  ACPU_AutoVec5   = $8000001D;      { AutoVector Level 5 interrupt error }
214  ACPU_AutoVec6   = $8000001E;      { AutoVector Level 6 interrupt error }
215  ACPU_AutoVec7   = $8000001F;      { AutoVector Level 7 interrupt error }
216
217
218{ ********************************************************************
219*
220*  General Alerts
221*
222*  For example: timer.device cannot open math.library would be $05038015
223*
224*       Alert(AN_TimerDev|AG_OpenLib|AO_MathLib);
225*
226********************************************************************}
227
228
229const
230
231// ------ alert types
232  AT_Deadend    = $80000000;
233  AT_Recovery   = $00000000;
234
235// ------ general purpose alert codes
236  AG_NoMemory   = $00010000;
237  AG_MakeLib    = $00020000;
238  AG_OpenLib    = $00030000;
239  AG_Opendev    = $00040000;
240  AG_OpenRes    = $00050000;
241  AG_IOError    = $00060000;
242  AG_NoSignal   = $00070000;
243  AG_BadParm    = $00080000;
244  AG_CloseLib   = $00090000; // usually too many closes
245  AG_CloseDev   = $000A0000; // or a mismatched close
246  AG_ProcCreate = $000B0000; // Process creation failed
247  AG_Obsolete   = $000C0000; // Obsolete feature used */
248
249// ------ alert objects:
250  AO_ExecLib      = $00008001;
251  AO_GraphicsLib  = $00008002;
252  AO_LayersLib    = $00008003;
253  AO_Intuition    = $00008004;
254  AO_MathLib      = $00008005;
255  AO_DOSLib       = $00008007;
256  AO_RAMLib       = $00008008;
257  AO_IconLib      = $00008009;
258  AO_ExpansionLib = $0000800A;
259  AO_DiskfontLib  = $0000800B;
260  AO_UtilityLib   = $0000800C;
261  AO_KeyMapLib    = $0000800D;
262  AO_NewlibLib    = $0000800E;
263
264  AO_AudioDev     = $00008010;
265  AO_ConsoleDev   = $00008011;
266  AO_GamePortDev  = $00008012;
267  AO_KeyboardDev  = $00008013;
268  AO_TrackDiskDev = $00008014;
269  AO_TimerDev     = $00008015;
270
271  AO_CIARsrc    = $00008020;
272  AO_DiskRsrc   = $00008021;
273  AO_MiscRsrc   = $00008022;
274
275  AO_BootStrap  = $00008030;
276  AO_Workbench  = $00008031;
277  AO_DiskCopy   = $00008032;
278  AO_GadTools   = $00008033;
279  AO_Unknown    = $00008035;
280
281
282
283{ ********************************************************************
284*
285*   Specific Alerts:
286*
287********************************************************************}
288
289// ------ exec.library
290
291  AN_ExecLib     = $01000000;
292  AN_ExcptVect   = $01000001; //  68000 exception vector checksum (obs.)
293  AN_BaseChkSum  = $01000002; //  Execbase checksum (obs.)
294  AN_LibChkSum   = $01000003; // Library checksum failure
295  AN_IFaceChkSum = $01000004; // Interface checksum failure
296
297  AN_MemCorrupt = $81000005; //  Corrupt memory list detected in FreeMem
298  AN_IntrMem    = $81000006; //  No memory for interrupt servers
299  AN_InitAPtr   = $01000007; //  InitStruct() of an APTR source (obs.)
300  AN_SemCorrupt = $01000008; //  A semaphore is in an illegal state at ReleaseSempahore()
301
302  AN_FreeTwice    = $01000009; //  Freeing memory already freed
303  AN_BogusExcpt   = $8100000A; //  illegal 68k exception taken (obs.)
304  AN_IOUsedTwice  = $0100000B; //  Attempt to reuse active IORequest
305  AN_MemoryInsane = $0100000C; //  Sanity check on memory list failed during AvailMem(MEMF_LARGEST)
306  AN_IOAfterClose = $0100000D; //  IO attempted on closed IORequest
307  AN_StackProbe   = $0100000E; //  Stack appears to extend out of range
308  AN_BadFreeAddr  = $0100000F; //  Memory header not located. [ Usually an invalid address passed to FreeMem() ]
309  AN_BadSemaphore = $01000010; // An attempt was made to use the old message semaphores.
310  AN_BadMemory    = $01000011; // A bad memory request was made (Realloc on non-allocated memory)
311  AN_BadHook      = $01000012; // An uninitialized hook was called
312// ------ graphics.library
313  AN_GraphicsLib  = $02000000;
314  AN_GfxNoMem     = $82010000;  //  graphics out of memory
315  AN_GfxNoMemMspc = $82010001;  //  MonitorSpec alloc, no memory
316  AN_LongFrame    = $82010006;  //  long frame, no memory
317  AN_ShortFrame   = $82010007;  //  short frame, no memory
318  AN_TextTmpRas   = $02010009;  //  text, no memory for TmpRas
319  AN_BltBitMap    = $8201000A;  //  BltBitMap, no memory
320  AN_RegionMemory = $8201000B;  //  regions, memory not available
321  AN_MakeVPort    = $82010030;  //  MakeVPort, no memory
322  AN_GfxNewError  = $0200000C;
323  AN_GfxFreeError = $0200000D;
324
325  AN_GfxNoLCM     = $82011234;  //  emergency memory not available
326
327  AN_ObsoleteFont = $02000401;  //  unsupported font description used
328
329// ------ layers.library
330
331  AN_LayersLib    = $03000000;
332  AN_LayersNoMem  = $83010000;  //  layers out of memory
333
334// ------ intuition.library
335  AN_Intuition    = $04000000;
336  AN_GadgetType   = $84000001;  //  unknown gadget type
337  AN_BadGadget    = $04000001;  //  Recovery form of AN_GadgetType
338  AN_CreatePort   = $84010002;  //  create port, no memory
339  AN_ItemAlloc    = $04010003;  //  item plane alloc, no memory
340  AN_SubAlloc     = $04010004;  //  sub alloc, no memory
341  AN_PlaneAlloc   = $84010005;  //  plane alloc, no memory
342  AN_ItemBoxTop   = $84000006;  //  item box top < RelZero
343  AN_OpenScreen   = $84010007;  //  open screen, no memory
344  AN_OpenScrnRast = $84010008;  //  open screen, raster alloc, no memory
345  AN_SysScrnType  = $84000009;  //  open sys screen, unknown type
346  AN_AddSWGadget  = $8401000A;  //  add SW gadgets, no memory
347  AN_OpenWindow   = $8401000B;  //  open window, no memory
348  AN_BadState     = $8400000C;  //  Bad State Return entering Intuition
349  AN_BadMessage   = $8400000D;  //  Bad Message received by IDCMP
350  AN_WeirdEcho    = $8400000E;  //  Weird echo causing incomprehension
351  AN_NoConsole    = $8400000F;  //  couldn't open the Console Device
352  AN_NoISem       = $04000010;  // Intuition skipped obtaining a sem
353  AN_ISemOrder    = $04000011;  // Intuition obtained a sem in bad order
354
355// ------ math.library
356  AN_MathLib      = $05000000;
357
358// ------ dos.library
359  AN_DOSLib       = $07000000;
360  AN_StartMem     = $07010001; //  no memory at startup
361  AN_endTask      = $07000002; //  endTask didn't
362  AN_QPktFail     = $07000003; //  Qpkt failure
363  AN_AsyncPkt     = $07000004; //  Unexpected packet received
364  AN_FreeVec      = $07000005; //  Freevec failed
365  AN_DiskBlkSeq   = $07000006; //  Disk block sequence error
366  AN_BitMap       = $07000007; //  Bitmap corrupt
367  AN_KeyFree      = $07000008; //  Key already free
368  AN_BadChkSum    = $07000009; //  Invalid checksum
369  AN_DiskError    = $0700000A; //  Disk Error
370  AN_KeyRange     = $0700000B; //  Key out of range
371  AN_BadOverlay   = $0700000C; //  Bad overlay
372  AN_BadInitFunc  = $0700000D; //  Invalid init packet for cli/shell
373  AN_FileReclosed = $0700000E; //  A filehandle was closed more than once
374  AN_NoBootNode   = $0700000F; //  No bootnode found in eb_MountList
375
376// ------ ramlib.library
377  AN_RAMLib       = $08000000;
378  AN_BadSegList = $08000001; // no overlays in library seglists
379
380// ------ icon.library
381  AN_IconLib = $09000000;
382
383// ------ expansion.library
384  AN_ExpansionLib     = $0A000000;
385  AN_BadExpansionFree = $0A000001; // freeed free region
386
387// ------ diskfont.library
388  AN_DiskfontLib = $0B000000;
389
390//------ newlib.library
391  AN_NewlibLib  = $0E000000;
392
393// ------ audio.device
394  AN_AudioDev   = $10000000;
395
396// ------ console.device
397  AN_ConsoleDev = $11000000;
398  AN_NoWindow   = $11000001; // Console can't open initial window
399
400// ------ gameport.device
401  AN_GamePortDev = $12000000;
402
403// ------ keyboard.device
404  AN_KeyboardDev        = $13000000;
405
406// ------ trackdisk.device
407  AN_TrackDiskDev = $14000000;
408  AN_TDCalibSeek  = $14000001;  // calibrate: seek error
409  AN_TDDelay      = $14000002;  // delay: error on timer wait
410
411// ------ timer.device
412  AN_TimerDev     = $15000000;
413  AN_TMBadReq     = $15000001; // bad request
414  AN_TMBadSupply  = $15000002; // power supply -- no 50/60Hz ticks
415
416//------ cybppc.device
417  AN_CybppcDev    = $16000000;
418  AN_CybppcNoTerm = $16000001; // no termination
419  AN_CybppcNoWide = $16000002; // no wide termination
420
421// ------ cia.resource
422  AN_CIARsrc      = $20000000;
423
424// ------ disk.resource
425  AN_DiskRsrc   = $21000000;
426  AN_DRHasDisk  = $21000001; // get unit: already has disk
427  AN_DRIntNoAct = $21000002; // interrupt: no active unit
428
429// ------ misc.resource
430  AN_MiscRsrc   = $22000000;
431
432// ------ bootstrap
433  AN_BootStrap  = $30000000;
434  AN_BootError  = $30000001; // boot code returned an error
435
436// ------ Workbench
437  AN_Workbench          = $31000000;
438  AN_NoFonts            = $B1000001;
439  AN_WBBadStartupMsg1   = $31000001;
440  AN_WBBadStartupMsg2   = $31000002;
441  AN_WBBadIOMsg         = $31000003; // Hacker code?
442  AN_WBReLayoutToolMenu = $B1010009; // GadTools broke?
443
444// ------ DiskCopy
445  AN_DiskCopy   = $32000000;
446
447// ------ toolkit for Intuition
448  AN_GadTools   = $33000000;
449
450// ------ System utility library
451  AN_UtilityLib = $34000000;
452
453// ------ For use by any application that needs it
454  AN_Unknown    = $35000000;
455
456
457type
458  PResident = ^TResident;
459  TResident = record
460    rt_MatchWord: Word;     // smallint to match on (ILLEGAL)
461    rt_MatchTag: PResident; // pointer to the above
462    rt_EndSkip: APTR;       // address to continue scan
463    rt_Flags: Byte;         // various tag flags
464    rt_Version: Byte;       // release version number
465    rt_Type: Byte;          // type of module (NT_mumble)
466    rt_Pri: Shortint;       // initialization priority
467    rt_Name: STRPTR;        // pointer to node name
468    rt_IdString: STRPTR;    // pointer to ident string
469    rt_Init: APTR;          // pointer to init code
470  end;
471
472const
473  RTC_MATCHWORD   = $4AFC; // The 68000 "ILLEGAL" instruction
474
475// enResidentFlags
476  RTF_AUTOINIT   = 1 shl 7; // rt_Init points to data structure
477  RTF_NATIVE     = 1 shl 5; // rt_Init points to a native function (otherwise, 68k is assumed)
478  RTF_AFTERDOS   = 1 shl 2;
479  RTF_SINGLETASK = 1 shl 1;
480  RTF_COLDSTART  = 1 shl 0;
481
482type
483// ****** MemChunk *****************************************************
484
485  PMemChunk = ^TMemChunk;
486  TMemChunk = record
487    mc_Next: PMemChunk;  // pointer to next chunk
488    mc_Bytes: LongWord;  // chunk byte size
489  end;
490
491// ****** MemHeader ****************************************************
492
493  PMemHeader = ^TMemHeader;
494  TMemHeader = record
495    mh_Node: TNode;
496    mh_Attributes: Word; // characteristics of this region
497    mh_First: PMemChunk; // first free region
498    mh_Lower: APTR;      // lower memory bound
499    mh_Upper: APTR;      // upper memory bound + 1
500    mh_Free: LongWord;   // total number of free bytes
501  end;
502
503// ****** MemEntry *****************************************************
504
505  PMemEntry = ^TMemEntry;
506  TMemEntry = record
507    me_Un: record
508      case LongInt of
509         0: (meu_Reqs: LongWord);
510         1: (meu_Addr: APTR);
511      end;
512    me_Length: LongWord;
513  end;
514
515// ****** MemList ******************************************************
516// Note: sizeof(struct MemList) includes the size of the first MemEntry!
517  PMemList = ^TMemList;
518  TMemList = record
519    ml_Node: TNode;
520    ml_NumEntries: Word;             // number of entries in this struct
521    ml_ME: array[0..0] of TMemEntry; // the first entry
522  end;
523
524// ----- Memory Requirement Types ---------------------------
525// ----- See the AllocMem() documentation for details--------
526
527const
528  MEMF_ANY           = 0;        // Any type of memory will do
529  MEMF_PUBLIC        = 1 shl  0;
530  MEMF_CHIP          = 1 shl  1;
531  MEMF_FAST          = 1 shl  2;
532  MEMF_VIRTUAL       = 1 shl  3; // Memory that is mapped/paged
533  MEMF_EXECUTABLE    = 1 shl  4; // Memory that contains executable code
534  MEMF_LOCAL         = 1 shl  8; // Memory that does not go away at RESET
535  MEMF_24BITDMA      = 1 shl  9; // DMAable memory within 24 bits of address
536  MEMF_KICK          = 1 shl 10; // Memory that can be used for KickTags
537  MEMF_PRIVATE       = 1 shl 11; // Memory that is only _visible_ to the  allocator task
538  MEMF_SHARED        = 1 shl 12; // Memory that is visible and accessible  to all tasks
539
540  MEMF_CLEAR         = 1 shl 16; // AllocMem: NL out area before return
541  MEMF_LARGEST       = 1 shl 17; // AvailMem: return the largest chunk size
542  MEMF_REVERSE       = 1 shl 18; // AllocMem: allocate from the top down
543  MEMF_TOTAL         = 1 shl 19; // AvailMem: return total size of memory
544  MEMF_HWALIGNED     = 1 shl 20; // AllocMem: Allocate aligned to hardware  page size
545  MEMF_DELAYED       = 1 shl 21; // AllocMem: Delay physical memory mapping
546  MEMF_CORE_RESIDENT = 1 shl 22; // Availmem: return only memory that is not paged out
547  MEMF_NO_EXPUNGE    = 1 shl 31; // AllocMem: Do not cause expunge on failure
548
549  MEM_BLOCKSIZE = 16;
550  MEM_BLOCKMASK = MEM_BLOCKSIZE - 1;
551
552type
553// ***** MemHandlerData ************************************************
554// Note:  This structure is *READ ONLY* and only EXEC can create it!
555  PMemHandlerData = ^TMemHandlerData;
556  TMemHandlerData = record
557    memh_RequestSize: LongWord;  // Requested allocation size
558    memh_RequestFlags: LongWord; // Requested allocation flags
559    memh_Flags: LongWord;        // Flags (see below)
560  end;
561
562const
563  MEMHF_RECYCLE  = 1 shl 0; // 0 = First time, 1 = recycle
564
565// ***** Low Memory handler return values ******************************
566  MEM_DID_NOTHING = 0;  // Nothing we could do...
567  MEM_ALL_DONE    = -1; // We did all we could do
568  MEM_TRY_AGAIN   = 1;  // We did some, try the allocation again
569
570// ****** Memory attributes ********************************************
571//enMemAttrs
572  MEMATTRF_WRITETHROUGH     = 1 shl  0; // Stores in this area update cache  and memory
573  MEMATTRF_CACHEINHIBIT     = 1 shl  1; // Caches are inhibited in this  area
574  MEMATTRF_COHERENT         = 1 shl  2; // Coherency required, stores to  same region will be serialized
575  MEMATTRF_GUARDED          = 1 shl  3; // Ensure in-order execute of memory accesses
576  MEMATTRF_REFERENCED       = 1 shl  4; // Page containing memory location has been referenced (used)
577  MEMATTRF_CHANGED          = 1 shl  5; // Page containing memory location has been changed
578
579    // The following are mutually exclusive
580  MEMATTRF_SUPER_RW         = 0 shl  6;
581  MEMATTRF_SUPER_RW_USER_RO = 1 shl  6;
582  MEMATTRF_SUPER_RW_USER_RW = 2 shl  6;
583  MEMATTRF_SUPER_RO_USER_RO = 3 shl  6;
584  MEMATTRF_RW_MASK          = 3 shl  6;
585
586  MEMATTRF_EXECUTE          = 1 shl  9; // CPU can execute instructions from this memory
587
588  MEMATTRF_NOT_MAPPED       = 1 shl 10; // Special flag: The memory is not mapped at all. This flag is only used as return value of GetMemoryAttr
589  MEMATTRF_RESERVED1        = 1 shl 11; // Used by the system
590  MEMATTRF_RESERVED2        = 1 shl 12; // _NEVER_ use these
591  MEMATTRF_RESERVER3        = 1 shl 13;
592
593// Short forms for common cases
594  MEMATTRF_READ_WRITE = MEMATTRF_SUPER_RW_USER_RW;
595  MEMATTRF_READ_ONLY  = MEMATTRF_SUPER_RO_USER_RO;
596
597// ****** GetMemoryAttrs flags *****************************************
598// enGetMemoryAttrsFlags
599  GMAF_REPORT_CR = 1 shl 0;
600
601// ****** AllocSysObject flags *****************************************
602// enAllocSysObjectFlags
603  ASOF_NOTRACK = 1 shl 1; // Used internally to indicate no tracking of object
604
605// ****** Trackable ****************************************************
606// Warning: Do NOT allocate one of those yourself!
607type
608  PTrackable = ^TTrackable;
609  TTrackable = record
610    Destructor_: THook;
611    Object_: APTR;
612    Flags: LongWord;
613    HashChain: PTrackable;
614  end; // Long word aligned
615
616const
617// enTrackableFlags
618  TRACKF_COMPACT = 1 shl 0; // Trackable was allocated by "constructor"
619
620// ****** DMA Scatter list *********************************************
621type
622  PDMAEntry = ^TDMAEntry;
623  TDMAEntry = record
624    PhysicalAddress: APTR; // Physically mapped address
625    BlockLength: LongWord; // Length of the block in physical memory
626  end;
627
628// ****** Named memory scan message ************************************
629  PSNMMessage = ^TSNMMessage;
630  TSNMMessage = record
631    Namespace: STRPTR;
632    Name: STRPTR;
633    Memory: APTR;
634    Size: LongWord;
635    Flags: LongWord;
636  end;
637
638const
639  SNMF_NAMESPACES_ONLY = 1 shl 0;
640
641type
642  PInterrupt = ^TInterrupt;
643  TInterrupt =  record
644    is_Node: TNode;
645    is_Data: APTR;       // Server data segment
646    is_Code: TProcedure; // Server code entry
647  end;
648
649  PIntVector = ^TIntVector;
650  TIntVector =  record   // For EXEC use ONLY!
651    iv_Data: APTR;
652    iv_Code: TProcedure;
653    iv_Node: PNode;
654  end;
655
656  PSoftIntList = ^TSoftIntList;
657  TSoftIntList =  record // For EXEC use ONLY!
658    sh_List: TList;
659    sh_Pad: Word;
660  end;
661
662  PExceptionContext = ^TExceptionContext;
663  TExceptionContext = record
664    Flags: LongWord;               // Flags, describing the context (READ-ONLY)
665    Traptype: LongWord;            // Type of trap (READ-ONLY)
666    msr: LongWord;                 // Machine state
667    ip: LongWord;                  // Return instruction pointer
668    gpr: array[0..31] of LongWord; // r0 - r31
669    cr: LongWord;                  // Condition code register
670    xer: LongWord;                 // Extended exception register
671    ctr: LongWord;                 // Count register
672    lr: LongWord;                  // Link register
673    dsisr: LongWord;               // DSI status register. Only set when valid
674    dar: LongWord;                 // Data address register. Only set when valid
675    fpr: array[0..31] of double;   // Floating point registers
676    fpscr: QWord;                  // Floating point control and status register
677    // The following are only used on AltiVec
678    vscr: array[0..15] of Byte;    // AltiVec vector status and control register
679    vr: array[0..511] of Byte;     // AltiVec vector register storage
680    vrsave: LongWord;              // AltiVec VRSAVE register
681  end;
682
683const
684// Flags for ExceptionContext
685// enECFlags
686  ECF_FULL_GPRS = 1 shl 0; // Set if all register have been saved
687                           // If this flag is not set; gpr[14] through
688                           // gpr[31] are invalid
689  ECF_FPU       = 1 shl 1; // Set if the FPU registers have been saved
690  ECF_FULL_FPU  = 1 shl 2; // Set if all FPU registers have been saved
691  ECF_VECTOR    = 1 shl 3; // Set if vector registers have been saved
692  ECF_VRSAVE    = 1 shl 4; // Set if VRSAVE reflects state of vector registers saved
693
694// Flags for ReadTaskContext/WriteTaskContext
695// enRTCFlags
696  RTCF_SPECIAL  = 1 shl 0;
697  RTCF_STATE    = 1 shl 1;
698  RTCF_GENERAL  = 1 shl 2;
699  RTCF_FPU      = 1 shl 3;
700  RTCF_VECTOR   = 1 shl 4;
701  RTCF_INFO     = 1 shl 5;
702
703  SIH_PRIMASK = $F0;
704//**********************************************************************
705// this is a fake INT definition, used only for AddIntServer and the like
706  INTB_NMI    = 15;
707  INTF_NMI    = 1 shl INTB_NMI;
708
709//  These are used with AddIntServer/SetIntVector to install global
710// trap handlers and with SetTaskTrap to install local task traps
711// Note: Use of these global trap handlers should be
712// restricted to system and debugger use. You should normally
713// use the task's local trap handler.
714
715// enTrapNumbers
716  TRAPNUM_BUS_ERROR              = $01000000; // Bus error exception/machine check
717  TRAPNUM_DATA_SEGMENT_VIOLATION = $02000000; // Data segment violation
718  TRAPNUM_INST_SEGMENT_VIOLATION = $03000000; // Instruction segment violation
719  TRAPNUM_ALIGNMENT              = $04000000; // Alignment violation
720  TRAPNUM_ILLEGAL_INSTRUCTION    = $05000000; // Illegal instruction
721  TRAPNUM_PRIVILEGE_VIOLATION    = $06000000; // Privilege violation
722  TRAPNUM_TRAP                   = $07000000; // Trap instruction
723  TRAPNUM_FPU                    = $08000000; // Floating point related (FPU disabled; imprecise)
724  TRAPNUM_TRACE                  = $09000000; // Single step trace exception
725  TRAPNUM_DATA_BREAKPOINT        = $0a000000; // Data breakpoint
726  TRAPNUM_INST_BREAKPOINT        = $0b000000; // Instruction breakpoint
727  TRAPNUM_PERFORMANCE            = $0c000000; // Performance monitor (System use only)
728  TRAPNUM_THERMAL                = $0d000000; // Thermal management (System use only)
729  TRAPNUM_RESERVED1              = $0e000000; // reserved
730  TRAPNUM_ALTIVEC_ASSIST         = $0f000000; // AltiVec Assist
731  TRAPNUM_SMI                    = $10000000; // System Management interrupt
732
733  TRAPNUM_NUMTRAPS               = 16;          // Number of hardware traps
734
735// Every Amiga Task has one of these Task structures associated with it.
736// To find yours, use FindTask(Nil).  AmigaDOS processes tack a few more
737// values on to the end of this structure, which is the difference between
738// Tasks and Processes.
739type
740  PTask = ^TTask;
741  TTask = record
742    tc_Node: TNode;
743    tc_Flags: Byte;
744    tc_State: Byte;
745    tc_IDNestCnt: ShortInt; // intr disabled nesting
746    tc_TDNestCnt: ShortInt; // task disabled nesting
747    tc_SigAlloc: LongWord;  // sigs allocated
748    tc_SigWait: LongWord;   // sigs we are waiting for
749    tc_SigRecvd: LongWord;  // sigs we have received
750    tc_SigExcept: LongWord; // sigs we will take excepts for
751      //The following field used to be this tc_TrapAlloc, tc_TrapAble, It was replaced by a pointer to an private extended task structure.
752    tc_ETask: APTR;
753    tc_ExceptData: APTR;    // points to except data
754    tc_ExceptCode: APTR;    // points to except code
755    tc_TrapData: APTR;      // points to trap data
756    tc_TrapCode: APTR;      // points to trap code
757    tc_SPReg: APTR;         // stack APTR
758    tc_SPLower: APTR;       // stack lower bound
759    tc_SPUpper: APTR;       // stack upper bound + 2
760    tc_Switch: TProcedure;  // task losing CPU
761    tc_Launch: TProcedure;  // task getting CPU
762    tc_MemEntry: TList;     // allocated memory
763    tc_UserData: APTR;      // per task data
764  end;
765
766// Stack swap structure as passed to StackSwap()
767  PStackSwapStruct = ^TStackSwapStruct;
768  TStackSwapStruct = record
769    stk_Lower: APTR;     // Lowest byte of stack
770    stk_Upper: LongWord; // Upper end of stack (size + Lowest)
771    stk_Pointer: APTR;   // Stack pointer at switch point
772  end;
773
774// ----- Flag Bits ------------------------------------------
775const
776// enTaskFlagsBits
777  TB_PROCTIME         = 0;
778  TB_ETASK            = 3;
779  TB_STACKCHK         = 4;
780  TB_EXCEPT           = 5;
781  TB_SWITCH           = 6;
782  TB_LAUNCH           = 7;
783// enTaskFlags
784  TF_PROCTIME         = 1;
785  TF_ETASK            = 8;
786  TF_STACKCHK         = 16;
787  TF_EXCEPT           = 32;
788  TF_SWITCH           = 64;
789  TF_LAUNCH           = 128;
790
791// ----- Task States ----------------------------------------
792// enTaskState
793  TS_INVALID          = 0;
794  TS_ADDED            = 1;
795  TS_RUN              = 2;
796  TS_READY            = 3;
797  TS_WAIT             = 4;
798  TS_EXCEPT           = 5;
799  TS_REMOVED          = 6;
800  TS_CRASHED          = 7;
801  TS_SUSPENDED        = 8;
802
803// ----- Predefined Signals -------------------------------------
804// enTaskSignalBits
805  SIGB_ABORT          = 0;
806  SIGB_CHILD          = 1;
807  SIGB_BLIT           = 4;
808  SIGB_SINGLE         = 4;
809  SIGB_INTUITION      = 5;
810  SIGB_NET            = 7;
811  SIGB_DOS            = 8;
812
813// enTaskSignal
814  SIGF_ABORT     = 1 shl SIGB_ABORT;
815  SIGF_CHILD     = 1 shl SIGB_CHILD;
816  SIGF_BLIT      = 1 shl SIGB_BLIT;
817  SIGF_SINGLE    = 1 shl SIGB_SINGLE;
818  SIGF_INTUITION = 1 shl SIGB_INTUITION;
819  SIGF_NET       = 1 shl SIGB_NET;
820  SIGF_DOS       = 1 shl SIGB_DOS;
821
822// enSuspendBits
823  STB_CRASHED = 0;
824  STB_REMOVED = 1;
825
826// enSuspendFlags
827  STF_CRASHED = 1 shl STB_CRASHED;
828  STF_REMOVED = 1 shl STB_REMOVED;
829
830// This file defines ports and messages, which are used for inter-
831// task communications using the routines defined toward the
832// bottom of this file.
833type
834// ****** MsgPort ******************************************************
835  PMsgPort = ^TMsgPort;
836  TMsgPort = record
837    mp_Node: TNode;
838    mp_Flags: Byte;
839    mp_SigBit: Byte;   // signal bit number
840    mp_SigTask: APTR;  // task to be signalled (TaskPtr)
841    mp_MsgList: TList; // message linked list
842  end;
843
844// ****** Message ******************************************************
845
846  PMessage = ^TMessage;
847  TMessage =  record
848    mn_Node: TNode;
849    mn_ReplyPort: PMsgPort; // message reply port
850    mn_Length: Word;        // total message length, in bytes, (include the size of the Message structure in the length)
851   end;
852
853// mp_Flags: Port arrival actions (PutMsg)
854const
855// enMsgPortFlags
856  PF_ACTION  = 3;        // Mask
857  PF_SIGALLOC = 1 shl 7; // Internal use
858
859// enMsgPortActions
860  PA_SIGNAL  = 0; // Signal task in mp_SigTask
861  PA_SOFTINT = 1; // Signal SoftInt in mp_SoftInt/mp_SigTask
862  PA_IGNORE  = 2; // Ignore arrival
863
864
865// ****** SignalSemaphore **********************************************
866type
867// Private structure used by ObtainSemaphore()
868  PSemaphoreRequest = ^TSemaphoreRequest;
869  TSemaphoreRequest = record
870    sr_Link: TMinNode;
871    sr_Waiter: PTask;
872  end;
873
874// Signal Semaphore data structure
875  PSignalSemaphore = ^TSignalSemaphore;
876  TSignalSemaphore = record
877      ss_Link: TNode;
878      ss_NestCount: SmallInt;
879      ss_WaitQueue: TMinList;
880      ss_MultipleLink: TSemaphoreRequest;
881      ss_Owner: PTask;
882      ss_QueueCount: SmallInt;
883  end;
884
885// ***** Semaphore procure message (for use in V39 Procure/Vacate ***
886  PSemaphoreMessage = ^TSemaphoreMessage;
887  TSemaphoreMessage = record
888    ssm_Message: TMessage;
889    ssm_Semaphore: PSignalSemaphore;
890  end;
891
892const
893// enSemaphoreRequestType
894 SM_SHARED      = 1;
895 SM_EXCLUSIVE   = 0;
896
897const
898// ------ Special constants ---------------------------------------
899// Note: This only applies to "legacy" 68k-based functions
900  LIB_VECTSIZE  =  6;   //  Each library entry takes 6 bytes
901  LIB_RESERVED  =  4;   //  Exec reserves the first 4 vectors
902  LIB_BASE      = -LIB_VECTSIZE;
903  LIB_USERDEF   = LIB_BASE - (LIB_RESERVED * LIB_VECTSIZE);
904  LIB_NONSTD    = LIB_USERDEF;
905
906// ------ Standard functions --------------------------------------
907// Note: This only applies to "legacy" 68k-based functions
908  LIB_OPEN    =  -6;
909  LIB_CLOSE   = -12;
910  LIB_EXPUNGE = -18;
911  LIB_EXTFUNC = -24;  // for future expansion
912
913type
914// ------ Library Base Structure ----------------------------------
915//  Also used for Devices and some Resources
916
917  PLibrary = ^TLibrary;
918  TLibrary =  record
919    lib_Node: TNode;
920    lib_Flags: Byte;
921    lib_ABIVersion: Byte; // ABI exported by library
922    lib_NegSize: Word;    // number of bytes before library
923    lib_PosSize: Word;    // number of bytes after library
924    lib_Version: Word;    // major
925    lib_Revision: Word;   // minor
926    lib_IdString: STRPTR; // ASCII identification
927    lib_Sum: LongWord;    // the checksum itself  }
928    lib_OpenCnt: Word;    // number of current opens  }
929  end;   // Warning: size is not a longword multiple!
930
931const
932
933// lib_ABIVersion definitions
934// enABIVersion
935  LIBABI_68K    = 0; // A 68k library (pre OS4)
936  LIBABI_MIFACE = 1; // V50 multi interface library
937
938// lib_Flags bit definitions (all others are system reserved)
939  LIBF_SUMMING = 1 shl 0; // we are currently checksumming
940  LIBF_CHANGED = 1 shl 1; // we have just changed the lib
941  LIBF_SUMUSED = 1 shl 2; // set if we should bother to sum
942  LIBF_DELEXP  = 1 shl 3; // delayed expunge
943  LIBF_EXP0CNT = 1 shl 4;
944
945
946// This file defines the constants and types required to use
947// Amiga device IO routines, which are also defined here.
948
949type
950
951//***** Device *********************************************************
952  PDevice = ^TDevice;
953  TDevice =  record
954    dd_Library: TLibrary;
955  end;
956
957//***** Unit ***********************************************************
958  PUnit = ^TUnit;
959  TUnit = record
960      unit_MsgPort: TMsgPort; // queue for unprocessed messages instance of msgport is recommended
961      unit_flags: Byte;
962      unit_pad: Byte;
963      unit_OpenCnt: Word;     // number of active opens
964  end;
965
966const
967  UNITF_ACTIVE  = 1 shl 0;
968  UNITF_INTASK  = 1 shl 1;
969
970type
971  PIORequest = ^TIORequest;
972  TIORequest =  record
973    io_Message: TMessage;
974    io_Device: PDevice; // device node pointer
975    io_Unit: PUnit;     // unit (driver private)
976    io_Command: Word;   // device command
977    io_Flags: Byte;
978    io_Error: ShortInt; // error or warning num
979  end;
980
981  PIOStdReq = ^TIOStdReq;
982  TIOStdReq =  record
983    io_Message: TMessage;
984    io_Device: PDevice;  // device node pointer
985    io_Unit: PUnit;      // unit (driver private)
986    io_Command: Word;    // device command
987    io_Flags: Byte;
988    io_Error: ShortInt;  // error or warning num
989    io_Actual: LongWord; // actual number of bytes transferred
990    io_Length: LongWord; // requested number bytes transferred
991    io_Data: APTR;       // points to data area
992    io_Offset: LongWord; // offset for block structured devices
993  end;
994
995
996// library vector offsets for device reserved vectors }
997const
998// enum enDeviceLibraryReserved
999  DEV_beginIO = -30;
1000  DEV_ABORTIO = -36;
1001
1002// io_Flags defined bits
1003
1004  IOB_QUICK   = 0;
1005  IOF_QUICK   = 1 shl IOB_QUICK;
1006
1007// enDefaultDeviceCommands
1008  CMD_INVALID = 0;
1009  CMD_RESET   = 1;
1010  CMD_READ    = 2;
1011  CMD_WRITE   = 3;
1012  CMD_UPDATE  = 4;
1013  CMD_CLEAR   = 5;
1014  CMD_STOP    = 6;
1015  CMD_START   = 7;
1016  CMD_FLUSH   = 8;
1017
1018  CMD_NONSTD  = 9;
1019
1020//**********************************************************************
1021// The interface is the new way for exec libraries.
1022// Basically, the interface is embedded in a table of
1023// function pointers similar to the old library jump table.
1024//
1025// FIXME: Add some more documentation
1026{$PACKRECORDS C}
1027
1028type
1029  TOS4InterfaceData = record
1030    Link: TNode;             // Node for linking several interfaces
1031    LibBase: PLibrary;       // Library this interface belongs to
1032
1033    RefCount: LongWord;      // Reference count
1034    Version: LongWord;       // Version number of the interface
1035    Flags: LongWord;         // Various flags (see below)
1036    CheckSum: LongWord;      // Checksum of the interface
1037    PositiveSize: LongWord;  // Size of the function pointer part, (with this struct)
1038    NegativeSize: LongWord;  // Size of the data area
1039    IExecPrivate: APTR;      // Private copy of IExec
1040    EnvironmentVector: APTR; // Base address for base relative code
1041    Reserved3: LongWord;
1042    Reserved4: LongWord;
1043  end;
1044
1045  TOS4Interface = record
1046    Data: TOS4InterfaceData;
1047    // some functions, calling convention?
1048  end;
1049  POS4Interface = ^TOS4Interface;
1050
1051{$PACKRECORDS 2}
1052
1053const
1054// Flags for the Flags field in interfaces and as flags parameter for GetInterface
1055// enInterfaceFlags
1056  IFLF_NONE          = $0000; // No flags
1057  IFLF_PROTECTED     = $0001; // This interface can't be SetMethod'd
1058  IFLF_NOT_NATIVE    = $0002; // Interface is 68k
1059  IFLF_PRIVATE       = $0004; // Interface is a private, non-shareable instance
1060  IFLF_CHANGED       = $0008; // Interface has been changed, ready for re-summing
1061  IFLF_UNMODIFIED    = $0010; // Interface is unmodified. This flag will be set
1062                               // if the interface is created, and reset as soon
1063                               // as someone uses SetMethod on it.
1064  IFLF_CLONED        = $0020; // Interface was created by Clone method and will
1065                               // have to be freed via Expunge(). Interface
1066                               // implementors must set this bit in Clone().
1067  IFLF_CLONE_EXPUNGE = $0040;  // Call Expunge() on cloned interface when the
1068                               // reference count reaches zero. (V53.31)
1069
1070
1071//  Definition of the Exec library base structure (pointed to by location 4).
1072// Most fields are not to be viewed or modified by user programs.  Use
1073// extreme caution.
1074
1075type
1076  PExecBase = ^TExecBase;
1077  TExecBase =  Record
1078    LibNode: TLibrary; //  Standard library node
1079
1080// ******* Static System Variables *************************************
1081
1082    SoftVer: Word;          // kickstart release number (obs.)
1083    LowMemChkSum: SmallInt; // checksum of 68000 trap vectors
1084    ChkBase: LongWord;      // system base pointer complement
1085    ColdCapture: APTR;      //  coldstart soft capture vector
1086    CoolCapture: APTR;      //  coolstart soft capture vector
1087    WarmCapture: APTR;      //  warmstart soft capture vector
1088    SysStkUpper: APTR;      //  system stack base   (upper bound)
1089    SysStkLower: APTR;      //  top of system stack (lower bound)
1090    MaxLocMem: LongWord;    //  top of chip memory
1091    DebugEntry: APTR;       //  global debugger entry point
1092    DebugData: APTR;        //  global debugger data segment
1093    AlertData: APTR;        //  alert data segment
1094    MaxExtMem: APTR;        //  top of extended mem, or nil if none
1095
1096    ChkSum: Word;           //  for all of the above (minus 2)
1097
1098// ****** Interrupt Related ********************************************
1099
1100    IntVects: array[0..15] of TIntVector;
1101
1102// ****** Dynamic System Variables *************************************
1103
1104    ThisTask: PTask;     // pointer to current task (readable)
1105
1106    IdleCount: LongWord; //  idle counter
1107    DispCount: LongWord; //  dispatch counter
1108    Quantum: Word;       //  time slice quantum
1109    Elapsed: Word;       //  current quantum ticks
1110    SysFlags: Word;      //  misc internal system flags
1111    IDNestCnt: ShortInt; //  interrupt disable nesting count
1112    TDNestCnt: ShortInt; //  task disable nesting count
1113
1114    AttnFlags: Word;     //  special attention flags (readable)
1115
1116    AttnResched: Word;   //  rescheduling attention
1117    ResModules: APTR;    //  resident module array pointer
1118    TaskTrapCode: APTR;
1119    TaskExceptCode: APTR;
1120    TaskExitCode: APTR;
1121    TaskSigAlloc: LongWord;
1122    TaskTrapAlloc: Word;
1123
1124
1125// ****** System Lists (private!) **************************************
1126
1127    MemList: TList;
1128    ResourceList: TList;
1129    DeviceList: TList;
1130    IntrList: TList;
1131    LibList: TList;
1132    PortList: TList;
1133    TaskReady: TList;
1134    TaskWait: TList;
1135
1136    SoftInts: array[0..4] of TSoftIntList;
1137
1138// ****** Other Globals ************************************************
1139
1140    LastAlert: array[0..3] of LongInt;
1141
1142    // these next two variables are provided to allow
1143    // system developers to have a rough idea of the
1144    // period of two externally controlled signals --
1145    // the time between vertical blank interrupts and the
1146    // external line rate (which is counted by CIA A's
1147    // "time of day" clock).  In general these values
1148    // will be 50 or 60, and may or may not track each
1149    // other.  These values replace the obsolete AFB_PAL
1150    // and AFB_50HZ flags.
1151    VBlankFrequency: Byte;      //  (readable)
1152    PowerSupplyFrequency: Byte; //  (readable)
1153
1154    SemaphoreList: TList;
1155
1156    // these next two are to be able to kickstart into user ram.
1157    // KickMemPtr holds a singly linked list of MemLists which
1158    // will be removed from the memory list via AllocAbs.  If
1159    // all the AllocAbs's succeeded, then the KickTagPtr will
1160    // be added to the rom tag list.
1161    KickMemPtr: APTR;    //  ptr to queue of mem lists
1162    KickTagPtr: APTR;    //  ptr to rom tag queue
1163    KickCheckSum: APTR;  //  checksum for mem and tags
1164
1165// ****** V36 Exec additions start here ********************************
1166
1167    ex_Pad0: Word;            // Private internal use
1168    ex_LaunchPoint: LongWord; // Private to Launch/Switch
1169    ex_RamLibPrivate: APTR;
1170
1171    //  The next LongWord contains the system "E" clock frequency,
1172    // expressed in Hertz.  The E clock is used as a timebase for
1173    // the Amiga's 8520 I/O chips. (E is connected to "02").
1174    // Typical values are 715909 for NTSC, or 709379 for PAL.
1175    ex_EClockFrequency: LongWord; //  (readable)
1176    ex_CacheControl: LongWord;    //  Private to CacheControl calls
1177    ex_TaskID: LongWord;          //  Next available task ID
1178
1179    ex_Reserved1: array[0..4] of LongWord;
1180
1181    ex_MMULock: APTR;    //  private
1182
1183    ex_Reserved2: array[0..2] of LongWord;
1184
1185// ****** V39 Exec additions start here ********************************
1186
1187    // The following list and data element are used
1188    //for V39 exec's low memory handler...
1189    ex_MemHandlers: TMinList; // The handler list
1190    ex_MemHandler: APTR;      // Private! handler pointer
1191
1192// ****** V50 Exec additions start here ********************************
1193
1194    MainInterface: PInterface; // ExecLibrary's primary interface
1195    Private01: APTR;
1196    Private02: LongWord;
1197    Private03: APTR;
1198    Private04: APTR;
1199    Private05: APTR;
1200    Private06: TList;
1201    Private07: APTR;
1202    EmuWS: APTR;          // Emulator Workspace. Legacy libraries might access this field
1203  // Yes, there are more additions, but you don't need to know what it is
1204  end;
1205
1206// ***** Bit defines for AttnFlags (see above) *************************
1207
1208// Processors and Co-processors:
1209// enAttnFlagBits
1210const
1211  AFB_68010     = 0; // also set for 68020
1212  AFB_68020     = 1; // also set for 68030
1213  AFB_68030     = 2; // also set for 68040
1214  AFB_68040     = 3; // also set for 68060
1215  AFB_68881     = 4; // also set for 68882
1216  AFB_68882     = 5;
1217  AFB_FPU40     = 6; // Set if 68040 FPU
1218  AFB_68060     = 7;
1219
1220  // The following flags are new to V50
1221  AFB_603     =  8;
1222  AFB_604     =  9;
1223  AFB_750     = 10;
1224  AFB_7400    = 11;
1225  AFB_ALTIVEC = 12;
1226  AFB_4XX     = 13;
1227  AFB_OTHER   = 14;
1228
1229// The AFB_FPU40 bit is set when a working 68040 FPU
1230// is in the system.  If this bit is set and both the
1231// AFB_68881 and AFB_68882 bits are not set, then the 68040
1232// math emulation code has not been loaded and only 68040
1233// FPU instructions are available.  This bit is valid *ONLY*
1234// if the AFB_68040 bit is set.
1235// Likewise, AFB_ALTIVEC identifies an existing AltiVec unit.
1236
1237  AFB_PRIVATE = 15; // Just what it says
1238
1239// enAttnFlags
1240  AFF_68010   = 1 shl  0;
1241  AFF_68020   = 1 shl  1;
1242  AFF_68030   = 1 shl  2;
1243  AFF_68040   = 1 shl  3;
1244  AFF_68881   = 1 shl  4;
1245  AFF_68882   = 1 shl  5;
1246  AFF_FPU40   = 1 shl  6;
1247  AFF_68060   = 1 shl  7;
1248
1249  AFF_603     = 1 shl  8;
1250  AFF_604     = 1 shl  9;
1251  AFF_750     = 1 shl 10;
1252  AFF_7400    = 1 shl 11;
1253  AFF_ALTIVEC = 1 shl 12;
1254  AFF_4XX     = 1 shl 13;
1255  AFF_OTHER   = 1 shl 14;
1256
1257  AFF_PRIVATE = 1 shl 15;
1258
1259
1260//***** Selected flag definitions for Cache manipulation calls *********
1261  CACRF_EnableI       = 1 shl  0; // Enable instruction cache
1262  CACRF_FreezeI       = 1 shl  1; // Freeze instruction cache
1263  CACRF_ClearI        = 1 shl  3; // Clear instruction cache
1264  CACRF_IBE           = 1 shl  4; // Instruction burst enable
1265  CACRF_EnableD       = 1 shl  8; // Enable data cache
1266  CACRF_FreezeD       = 1 shl  9; // Freeze data cache
1267  CACRF_ClearD        = 1 shl 11; // Clear data cache (flush to memory first)
1268  CACRF_DBE           = 1 shl 12; // 68030 Data burst enable
1269  CACRF_WriteAllocate = 1 shl 13; // 68030 Write-Allocate mode (must always be set!)
1270  CACRF_InvalidateD   = 1 shl 15; // Invalidate data cache (no writeback)
1271  CACRF_EnableE       = 1 shl 30; // Master enable for external caches.
1272                                        // External caches should track the
1273                                        // state of the internal caches
1274                                        // such that they do not cache anything
1275                                        // that the internal cache turned off
1276                                        // for.
1277  CACRF_CopyBack      = 1 shl 31; // Master enable for copyback caches
1278
1279// enDMAFlags
1280  DMA_Continue     = 1 shl 1;      // Continuation flag for CachePreDMA
1281  DMAF_Continue    = DMA_Continue;
1282  DMA_NoModify     = 1 shl 2;      // Set if DMA does not update memory
1283  DMAF_NoModify    = DMA_NoModify;
1284  DMA_ReadFromRAM  = 1 shl 3;      // Set if DMA goes *FROM* RAM to device
1285  DMAF_ReadFromRAM = DMA_ReadFromRAM;
1286
1287// The only fixed address in the Amiga memory space.
1288  AbsExecBase: PExecBase = Pointer(4);
1289
1290// Don't even think about the contents of this structure. Just embed it and reference it
1291type
1292  PAVLNode = ^TAVLNode;
1293  TAVLNode = record
1294    Reserved: array[0..3] of LongWord;
1295  end;
1296  PPAVLNode = ^PAVLNode;
1297
1298  TAVLKey = Pointer;
1299
1300  PAVLNODECOMP = ^AVLNODECOMP;
1301  AVLNODECOMP = APTR;
1302
1303  PAVLKEYCOMP = ^AVLKEYCOMP;
1304  AVLKEYCOMP = APTR;
1305
1306const
1307// Minimum size of the buffers to receive disassembled opcodes
1308// and operands including the NIL string terminator.
1309  LEN_DISASSEMBLE_OPCODE_STRING   = 15;
1310  LEN_DISASSEMBLE_OPERANDS_STRING = 40;
1311
1312type
1313// The StackFrameMsg is used when traversing a Task's stack.
1314  TStackFrameMsg = record
1315    StructSize: LongWord;    // Size of the data structure
1316    State: LongWord;         // State of the stack frame
1317    MemoryAddress: APTR;     // Memory address being pointed to
1318    StackPointer: PLongWord; // The stack pointer itself
1319  end;
1320
1321const
1322//enStackFrameMsgState
1323  STACK_FRAME_DECODED               = 1;  // Decoded stack frame
1324  STACK_FRAME_INVALID_BACKCHAIN_PTR = 2;  // Invalid backchain pointer
1325  STACK_FRAME_TRASHED_MEMORY_LOOP   = 3;  // Memory loop caused by trashed memory
1326  STACK_FRAME_BACKCHAIN_PTR_LOOP    = 4;   // Backchain pointer loops
1327
1328// Each DebugSymbol corresponds to some memory address.
1329type
1330  TDebugSymbol = record
1331    StructSize: LongWord;       // Size of the data structure
1332    Type_: LongWord;            // Type of debug symbol
1333
1334    Name: STRPTR;               // Module name (may be NULL)
1335    Offset: LongWord;           // Offset into the module
1336    SegmentNumber: LongWord;    // DOS segment number
1337    SegmentOffset: LongWord;    // DOS segment offset
1338
1339    SourceFileName: STRPTR;     // Source code file name (may be NULL)
1340    SourceLineNumber: LongWord; // Source code line number (may be zero)
1341    SourceFunctionName: STRPTR; // Source code function name (may be NULL)
1342    SourceBaseName: STRPTR;     // Source code base name (may be NULL)
1343  end;
1344
1345const
1346// enDebugSymbolType
1347  DEBUG_SYMBOL_68K_MODULE    = 1; // 68K kernel module
1348  DEBUG_SYMBOL_NATIVE_MODULE = 2; // Kernel data module
1349  DEBUG_SYMBOL_KERNEL_MODULE = 3; // Kernel module
1350  DEBUG_SYMBOL_MODULE        = 4; // Module
1351  DEBUG_SYMBOL_MODULE_STABS  = 5; // Module with stabs debug
1352
1353type
1354// Opaque datatype for the result of StartDebugOutputNotify.
1355  TDebugOutputNotify = record
1356  end;
1357
1358// he task that should be signaled with the given
1359// signal mask when the debug output buffer was updated.
1360const
1361  SDONA_Task = TAG_USER + $1021000; // PTask
1362// The signal mask that shall be used
1363  SDONA_SignalMask = TAG_USER + $1021001; // LongWord
1364
1365type
1366//**********************************************************************
1367// The following structure can be used to switch from 68k into PPC code,
1368// in general its use is discouraging but necessary in a few places.
1369  TEmuTrapfunction = procedure(Reg68K: PLongWord);
1370
1371  TEmuTrap = record
1372    Instruction: LongWord;      // TRAPINST, see below
1373    Type_: Byte;                // TRAPTYPE or TRAPTYPENR
1374    Function_: TEmutrapFunction; // PPC function address also see "enRegConst" below but watch out byteoffsets!
1375  end;
1376
1377const
1378  TRAPINST   = $4ef80000;  // jmp.w 0, indicate switch
1379  TRAPTYPE   = $0004;      // type of this trap (result in r3/d0)
1380  TRAPTYPENR = $0005;      // same as above but no return value
1381
1382//**********************************************************************
1383
1384// enRegConst
1385  REG68K_D0  =   0;
1386  REG68K_D1  =   4;
1387  REG68K_D2  =   8;
1388  REG68K_D3  =  12;
1389  REG68K_D4  =  16;
1390  REG68K_D5  =  20;
1391  REG68K_D6  =  24;
1392  REG68K_D7  =  28;
1393  REG68K_A0  =  32;
1394  REG68K_A1  =  36;
1395  REG68K_A2  =  40;
1396  REG68K_A3  =  44;
1397  REG68K_A4  =  48;
1398  REG68K_A5  =  52;
1399  REG68K_A6  =  56;
1400  REG68K_A7  =  60;
1401
1402  REG68K_FP0 =  64;
1403  REG68K_FP1 =  72;
1404  REG68K_FP2 =  80;
1405  REG68K_FP3 =  88;
1406  REG68K_FP4 =  96;
1407  REG68K_FP5 = 104;
1408  REG68K_FP6 = 112;
1409  REG68K_FP7 = 120;
1410
1411//**********************************************************************
1412// Tag Items for Emulate() system call
1413
1414  ET_RegisterD0     = TAG_USER +  1;
1415  ET_RegisterD1     = TAG_USER +  2;
1416  ET_RegisterD2     = TAG_USER +  3;
1417  ET_RegisterD3     = TAG_USER +  4;
1418  ET_RegisterD4     = TAG_USER +  5;
1419  ET_RegisterD5     = TAG_USER +  6;
1420  ET_RegisterD6     = TAG_USER +  7;
1421  ET_RegisterD7     = TAG_USER +  8;
1422
1423  ET_RegisterA0     = TAG_USER +  9;
1424  ET_RegisterA1     = TAG_USER + 10;
1425  ET_RegisterA2     = TAG_USER + 11;
1426  ET_RegisterA3     = TAG_USER + 12;
1427  ET_RegisterA4     = TAG_USER + 13;
1428  ET_RegisterA5     = TAG_USER + 14;
1429  ET_RegisterA6     = TAG_USER + 15;
1430  ET_RegisterA7     = TAG_USER + 16;
1431
1432  ET_NoJIT          = TAG_USER + 17;
1433
1434  ET_FPRegisters    = TAG_USER + 18;
1435  ET_FPRegisterMask = TAG_USER + 19;
1436
1437  ET_SuperState     = TAG_USER + 20;
1438
1439  ET_Offset         = TAG_USER + 21;
1440
1441  ET_StackPtr       = TAG_USER + 22;
1442
1443  ET_SaveRegs       = TAG_USER + 23;
1444  ET_SaveParamRegs  = TAG_USER + 24;
1445
1446//**********************************************************************
1447// enEmulateFPFlags
1448
1449  EFPF_FP0 = 1;
1450  EFPF_FP1 = 1 shl 1;
1451  EFPF_FP2 = 1 shl 2;
1452  EFPF_FP3 = 1 shl 3;
1453  EFPF_FP4 = 1 shl 4;
1454  EFPF_FP5 = 1 shl 5;
1455  EFPF_FP6 = 1 shl 6;
1456  EFPF_FP7 = 1 shl 7;
1457
1458//**********************************************************************
1459// enDeviceIOErrors
1460
1461  IOERR_SUCCESS    =  0; // no error
1462  IOERR_OPENFAIL   = -1; // device/unit failed to open
1463  IOERR_ABORTED    = -2; // request terminated early [after AbortIO()]
1464  IOERR_NOCMD      = -3; // command not supported by device
1465  IOERR_BADLENGTH  = -4; // not a valid length (usually IO_LENGTH)
1466  IOERR_BADADDRESS = -5; // invalid address (misaligned or bad range)
1467  IOERR_UNITBUSY   = -6; // device opens ok, but requested unit is busy
1468  IOERR_SELFTEST   = -7; // hardware failed self-test
1469
1470//**********************************************************************
1471//Tag items used by AllocSysObject
1472
1473  ASO_NoTrack         = TAG_USER +  1; // Don't track this object (i.e. do not free automatically;
1474  ASO_MemoryOvr       = TAG_USER +  2; // Memory type override
1475// IORequest
1476  ASOIOR_Size         = TAG_USER + 10; // Size of the object
1477  ASOIOR_ReplyPort    = TAG_USER + 11; // ReplyPort to use
1478  ASOIOR_Duplicate    = TAG_USER + 12; // Source IO request to duplicate
1479// Hook
1480  ASOHOOK_Size        = TAG_USER + 10; // Size of the object
1481  ASOHOOK_Entry       = TAG_USER + 11; // The hook's entry
1482  ASOHOOK_Subentry    = TAG_USER + 12; // The hook's subentry field
1483  ASOHOOK_Data        = TAG_USER + 13; // The hook's user data
1484// Interrupt
1485  ASOINTR_Size        = TAG_USER + 10; // Size of the object
1486  ASOINTR_Code        = TAG_USER + 11; // Code pointer
1487  ASOINTR_Data        = TAG_USER + 12; // Data pointer
1488  ASOINTR_SoftInt     = TAG_USER + 13; // Interrupt is used by Cause(;
1489// List
1490  ASOLIST_Size        = TAG_USER + 10; // Size of the object
1491  ASOLIST_Type        = TAG_USER + 11; // Type to set for the list
1492  ASOLIST_Min         = TAG_USER + 12; // Create a minlist
1493// DMAEntry array
1494  ASODMAE_Size        = TAG_USER + 10; // Raw size of the object
1495  ASODMAE_NumEntries  = TAG_USER + 11; // Number of entries
1496// List node
1497  ASONODE_Size        = TAG_USER + 10; // Size of the node
1498  ASONODE_Min         = TAG_USER + 11; // Make it a MinNode
1499  ASONODE_Type        = TAG_USER + 12; // Node's type
1500  ASONODE_Pri         = TAG_USER + 13; // Node's priority
1501  ASONODE_Name        = TAG_USER + 14; // Pointer to a node string
1502// Message port
1503  ASOPORT_Size        = TAG_USER + 10; // Size of the object
1504  ASOPORT_AllocSig    = TAG_USER + 11; // Allocate a signal
1505  ASOPORT_Action      = TAG_USER + 12; // Action at message arrival (see ports.h, enMsgPortActions;
1506  ASOPORT_Pri         = TAG_USER + 13; // Priority used when the port is added to a list
1507  ASOPORT_Name        = TAG_USER + 14; // Name for the port
1508  ASOPORT_Signal      = TAG_USER + 15; // Preallocted signal number
1509  ASOPORT_Target      = TAG_USER + 16; // MsgPort's target, either a task, or a softint
1510  ASOPORT_Public      = TAG_USER + 17; // Make the port public
1511  ASOPORT_CopyName    = TAG_USER + 18; // Copy the name string
1512// Message
1513  ASOMSG_Size         = TAG_USER + 10; // Size of the object
1514  ASOMSG_ReplyPort    = TAG_USER + 11; // Reply port
1515  ASOMSG_Length       = TAG_USER + 12; // Message length
1516  ASOMSG_Name         = TAG_USER + 13; // Name to put into the node
1517// Signal semaphore
1518  ASOSEM_Size         = TAG_USER + 10; // Size of the object
1519  ASOSEM_Name         = TAG_USER + 11; // Name
1520  ASOSEM_Pri          = TAG_USER + 12; // Node's priority (only used on public semaphores;
1521  ASOSEM_Public       = TAG_USER + 13; // Semaphore is public and will be added to the system
1522  ASOSEM_CopyName     = TAG_USER + 14; // Copy the name string
1523// TagItem array
1524  ASOTAGS_Size        = TAG_USER + 10; // Raw size of the object, i.e. in bytes
1525  ASOTAGS_NumEntries  = TAG_USER + 11; // Number of tagitems
1526// Memory Pool
1527  ASOPOOL_MFlags      = TAG_USER + 10; // Memory flags/requirements for this pool
1528  ASOPOOL_Puddle      = TAG_USER + 11; // Size of each puddle
1529  ASOPOOL_Threshold   = TAG_USER + 12; // Largest alloction size that goes into the puddle
1530  ASOPOOL_Protected   = TAG_USER + 13; // Protect pool with a semaphore
1531  ASOPOOL_Name        = TAG_USER + 14; // Name for the pool (for informational purpose only;
1532  ASOPOOL_CopyName    = TAG_USER + 15; // Copy the name string
1533  ASOPOOL_LockMem     = TAG_USER + 16; // Lock memory allocated
1534// Item Pool
1535  ASOITEM_MFlags      = TAG_USER + 10; // Memory flags for the pool
1536  ASOITEM_ItemSize    = TAG_USER + 11; // Size of individual items
1537  ASOITEM_BatchSize   = TAG_USER + 12; // Amount of items to be allocated in one batch
1538  ASOITEM_MaxSize     = TAG_USER + 13; // Maximum amount of items allowed in pool
1539  ASOITEM_GCPolicy    = TAG_USER + 14; // Garbage collection policy
1540  ASOITEM_GCParameter = TAG_USER + 15; // Garbage collection parameter
1541  ASOITEM_Constructor = TAG_USER + 16; // Constructor hook
1542  ASOITEM_Destructor  = TAG_USER + 17; // Destructor hook
1543  ASOITEM_Protected   = TAG_USER + 18; // Protect pool with a semaphore
1544// Mutex
1545  ASOMUTEX_Recursive  = TAG_USER + 10; // Make mutex recursive
1546// ExtMem
1547  ASOEXTMEM_Size            = TAG_USER + 10; // Size of extended memory area
1548  ASOEXTMEM_AllocationPolicy  = TAG_USER + 11; // Allocation policy
1549
1550// Item pool GCPolicy types
1551// enItemPoolGCPolicy
1552  ITEMGC_NONE       = 0;
1553  ITEMGC_AFTERCOUNT = 1;
1554
1555// Ext Memory allocation policies
1556// enExtMemAllocationPolicy
1557  EXTMEMPOLICY_IMMEDIATE  = 0;
1558  EXTMEMPOLICY_DELAYED    = 1;
1559  EXTMEMPOLICY_ACCESS     = 2;
1560
1561// Kernel memory cache
1562  ASOKMEM_Name        = TAG_USER + 10; // Name of the cache
1563  ASOKMEM_Type        = TAG_USER + 11; // Type, private or shared
1564  ASOKMEM_Size        = TAG_USER + 12; // Object size
1565  ASOKMEM_Alignment   = TAG_USER + 13; // Object Alignment
1566  ASOKMEM_Constructor = TAG_USER + 14; // Constructor
1567  ASOKMEM_Destructor  = TAG_USER + 15; // Destructor
1568  ASOKMEM_Colored     = TAG_USER + 16; // Use cache slab coloring
1569  ASOKMEM_Compact     = TAG_USER + 17; // Force cache to be compact, even if this means the slab internal
1570                                       // fragmentation will be above the threshold
1571// Kernel memory cache type
1572// enKMemCacheType
1573  KMEMT_PRIVATE     = 0;
1574  KMEMT_SHARED      = 1;
1575
1576// Resource map
1577  ASORMAP_Base        = TAG_USER + 10; // Resource range base
1578  ASORMAP_Size        = TAG_USER + 11; // Resource range size
1579  ASORMAP_Quantum     = TAG_USER + 12; // Minimal quantum for one single allocation
1580
1581  ASORMAP_CacheMax    = TAG_USER + 13; // Maximum size for quantum caches. All allocations smaller or equal
1582                                       // to this size will come from quantum caches
1583
1584// Tags for AllocVecTagList (V51)
1585  AVT_Type              = TAG_USER + 1;
1586  AVT_Contiguous        = TAG_USER + 2;
1587  AVT_Lock              = TAG_USER + 3;
1588  AVT_Alignment         = TAG_USER + 4;
1589  AVT_PhysicalAlignment = TAG_USER + 5;
1590  AVT_Clear             = TAG_USER + 6;
1591  AVT_ClearWithValue    = TAG_USER + 6;
1592  AVT_ClearValue        = TAG_USER + 6;
1593  AVT_Wait              = TAG_USER + 7;
1594  AVT_NoExpunge         = TAG_USER + 8;
1595
1596// Tags for AllocNamedMemory (V51)
1597  ANMT_CheckSum       = TAG_USER + 1;
1598  ANMT_Error          = TAG_USER + 2;
1599
1600// Possible values for ANMT_Error
1601// enAllocNamedMemoryErrors
1602  ANMERROR_NOERROR        = 0;
1603  ANMERROR_NOMEMORY       = 1;
1604  ANMERROR_DUPLICATENAME  = 2;
1605  ANMERROR_PARAMETER      = 3;
1606
1607// Tags for GetCPUInfo
1608  GCIT_NumberOfCPUs   = TAG_USER +  1;
1609  GCIT_Family         = TAG_USER +  2;
1610  GCIT_Model          = TAG_USER +  3;
1611  GCIT_ModelString    = TAG_USER +  4;
1612  GCIT_Version        = TAG_USER +  5;
1613  GCIT_VersionString  = TAG_USER +  6;
1614  GCIT_FrontsideSpeed = TAG_USER +  7;
1615  GCIT_ProcessorSpeed = TAG_USER +  8;
1616  GCIT_L1CacheSize    = TAG_USER +  9;
1617  GCIT_L2CacheSize    = TAG_USER + 10;
1618  GCIT_L3CacheSize    = TAG_USER + 11;
1619  GCIT_VectorUnit     = TAG_USER + 12;
1620  GCIT_Extensions     = TAG_USER + 13;
1621  GCIT_CacheLineSize  = TAG_USER + 14;
1622  GCIT_CPUPageSize    = TAG_USER + 15;
1623  GCIT_ExecPageSize   = TAG_USER + 16;
1624  GCIT_TimeBaseSpeed  = TAG_USER + 17;
1625
1626// Family codes
1627//enCPUFamiliy
1628  CPUFAMILY_UNKNOWN = 0;
1629  CPUFAMILY_60X     = 1;
1630  CPUFAMILY_7X0     = 2;
1631  CPUFAMILY_74XX    = 3;
1632  CPUFAMILY_4XX     = 4;
1633  CPUFAMILY_PA6T    = 5;
1634  CPUFAMILY_E300    = 6;
1635  CPUFAMILY_E5500   = 7;
1636
1637// Model codes
1638// enCPUModel
1639  CPUTYPE_UNKNOWN        =  0;
1640  CPUTYPE_PPC603E        =  1;
1641  CPUTYPE_PPC604E        =  2;
1642  CPUTYPE_PPC750CXE      =  3;
1643  CPUTYPE_PPC750FX       =  4;
1644  CPUTYPE_PPC750GX       =  5;
1645  CPUTYPE_PPC7410        =  6;
1646  CPUTYPE_PPC74XX_VGER   =  7;
1647  CPUTYPE_PPC74XX_APOLLO =  8;
1648  CPUTYPE_PPC405LP       =  9;
1649  CPUTYPE_PPC405EP       = 10;
1650  CPUTYPE_PPC405GP       = 11;
1651  CPUTYPE_PPC405GPR      = 12;
1652  CPUTYPE_PPC440EP       = 13;
1653  CPUTYPE_PPC440GP       = 14;
1654  CPUTYPE_PPC440GX       = 15;
1655  CPUTYPE_PPC440SX       = 16;
1656  CPUTYPE_PPC440SP       = 17;
1657  CPUTYPE_PA6T_1682M     = 18;
1658  CPUTYPE_PPC460EX       = 19;
1659  CPUTYPE_PPC5121E     = 20;
1660  CPUTYPE_P50XX      = 21;
1661
1662// Vector unit types
1663// enVectorUnitType
1664  VECTORTYPE_NONE    = 0;
1665  VECTORTYPE_ALTIVEC = 1;
1666  // Same as AltiVec    VECTORTYPE_VMX     = 2
1667
1668//**********************************************************************
1669// Object types for AllocSysObject
1670
1671// enAllocSysObjectTypes
1672  ASOT_IOREQUEST =  0; // IORequest
1673  ASOT_HOOK      =  1; // Hook
1674  ASOT_INTERRUPT =  2; // Interrupt structure
1675  ASOT_LIST      =  3; // List and MinList
1676  ASOT_DMAENTRY  =  4; // DMAEntry array
1677  ASOT_NODE      =  5; // List node and MinNode
1678  ASOT_PORT      =  6; // Message port
1679  ASOT_MESSAGE   =  7; // Exec Message
1680  ASOT_SEMAPHORE =  8; // Signal Semaphore
1681  ASOT_TAGLIST   =  9; // TagItem list
1682  ASOT_MEMPOOL   = 10; // Memory pool
1683  ASOT_ITEMPOOL  = 11; // Item pool
1684  ASOT_RMAP      = 12; // Resource map
1685  ASOT_MUTEX     = 13; // Mutex
1686  ASOT_EXTMEM    = 14; // Extended memory
1687
1688//**********************************************************************
1689// Tag items for CreateLibrary
1690  CLT_Vector68K     = TAG_USER +  1;
1691  CLT_InitData      = TAG_USER +  2;
1692  CLT_InitFunc      = TAG_USER +  3;
1693  CLT_Seglist       = TAG_USER +  8;
1694  CLT_Interfaces    = TAG_USER +  9;
1695  CLT_DataSize      = TAG_USER + 10;
1696  CLT_Legacy        = TAG_USER + 11;
1697  CLT_NoLegacyIFace = TAG_USER + 12;
1698
1699//**********************************************************************
1700// Message types for debugger hook
1701// enDebugMessage
1702  DBHMT_EXCEPTION     = 1;
1703  DBHMT_REMTASK       = 2;
1704  DBHMT_OPENLIB       = 3;
1705  DBHMT_CLOSELIB      = 4;
1706  DBHMT_ADDTASK       = 5;
1707  DBHMT_SHAREDOBJECTOPEN  = 6;
1708  DBHMT_SHAREDOBJECTCLOSE = 7;
1709
1710//**********************************************************************
1711// Tags for AddTask/CreateTask
1712  AT_Param1         = TAG_USER + 1;
1713  AT_Param2         = TAG_USER + 2;
1714  AT_Param3         = TAG_USER + 3;
1715  AT_Param4         = TAG_USER + 4;
1716  AT_Param5         = TAG_USER + 5;
1717  AT_Param6         = TAG_USER + 6;
1718  AT_Param7         = TAG_USER + 7;
1719  AT_Param8         = TAG_USER + 8;
1720  AT_Child          = TAG_USER + 9;
1721
1722  CT_LockStack      = TAG_USER + 20;
1723
1724//**********************************************************************
1725// Tags for NewStackRun
1726  NSR_Dummy         = TAG_USER + 500;    // Offset to avoid Emulate(; tag collision.
1727  NSR_StackSize     = NSR_Dummy + 1;     // Initial stack size
1728  NSR_MinStackSize  = NSR_Dummy + 2;     // Absolute minimal stack size
1729  NSR_LockStack     = NSR_Dummy + 3;     // Lock the stack in memory to prevent paging
1730  NSR_Arg1          = NSR_Dummy + 10;    // Parameters passed to the function
1731  NSR_Arg2          = NSR_Dummy + 11;
1732  NSR_Arg3          = NSR_Dummy + 12;
1733  NSR_Arg4          = NSR_Dummy + 13;
1734  NSR_Arg5          = NSR_Dummy + 14;
1735  NSR_Arg6          = NSR_Dummy + 15;
1736
1737//**********************************************************************
1738
1739{$PACKRECORDS DEFAULT}
1740