~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/rtl/morphos/execd.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    This file is part of the Free Pascal run time library.
 
3
 
 
4
    exec definitions (V50) for MorphOS/PowerPC
 
5
    Copyright (c) 2002 The MorphOS Development Team, All Rights Reserved.
 
6
 
 
7
    Free Pascal conversion
 
8
    Copyright (c) 2004 Karoly Balogh for Genesi S.a.r.l. <www.genesi.lu>
 
9
 
 
10
    See the file COPYING.FPC, included in this distribution,
 
11
    for details about the copyright.
 
12
 
 
13
    This program is distributed in the hope that it will be useful,
 
14
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
16
 
 
17
 **********************************************************************}
 
18
 
 
19
{$include emuld.inc}
 
20
{$include utild1.inc}
 
21
 
 
22
 
 
23
{ * exec node definitions (V50)
 
24
  *********************************************************************
 
25
  * }
 
26
 
 
27
 
 
28
type
 
29
  PNode = ^TNode;
 
30
  TNode = packed record
 
31
    ln_Succ: PNode;
 
32
    ln_Pred: PNode;
 
33
    ln_Type: Byte;
 
34
    ln_Pri : ShortInt;
 
35
    ln_Name: PChar;
 
36
  end;
 
37
 
 
38
type
 
39
  PMinNode = ^TMinNode;
 
40
  TMinNode = packed record
 
41
    mln_Succ: PMinNode;
 
42
    mln_Pred: PMinNode;
 
43
  end;
 
44
 
 
45
 
 
46
const
 
47
  NT_UNKNOWN      = 0;
 
48
  NT_TASK         = 1;
 
49
  NT_INTERRUPT    = 2;
 
50
  NT_DEVICE       = 3;
 
51
  NT_MSGPORT      = 4;
 
52
  NT_MESSAGE      = 5;
 
53
  NT_FREEMSG      = 6;
 
54
  NT_REPLYMSG     = 7;
 
55
  NT_RESOURCE     = 8;
 
56
  NT_LIBRARY      = 9;
 
57
  NT_MEMORY       = 10;
 
58
  NT_SOFTINT      = 11;
 
59
  NT_FONT         = 12;
 
60
  NT_PROCESS      = 13;
 
61
  NT_SEMAPHORE    = 14;
 
62
  NT_SIGNALSEM    = 15;
 
63
  NT_BOOTNODE     = 16;
 
64
  NT_KICKMEM      = 17;
 
65
  NT_GRAPHICS     = 18;
 
66
  NT_DEATHMESSAGE = 19;
 
67
  NT_USER         = 254;
 
68
  NT_EXTENDED     = 255;
 
69
 
 
70
 
 
71
 
 
72
{ * exec list definitions (V50)
 
73
  *********************************************************************
 
74
  * }
 
75
 
 
76
 
 
77
type
 
78
  PList = ^TList;
 
79
  TList = packed record
 
80
    lh_Head    : PNode;
 
81
    lh_Tail    : PNode;
 
82
    lh_TailPred: PNode;
 
83
    lh_Type    : Byte;
 
84
    lh_pad     : Byte;
 
85
  end;
 
86
 
 
87
type
 
88
  PMinList = ^TMinList;
 
89
  TMinList = packed record
 
90
    mlh_Head    : PMinNode;
 
91
    mlh_Tail    : PMinNode;
 
92
    mlh_TailPred: PMinNode;
 
93
  end;
 
94
 
 
95
 
 
96
 
 
97
{ * exec alert definitions (V50)
 
98
  *********************************************************************
 
99
  * }
 
100
 
 
101
 
 
102
const
 
103
  ACPU_BusErr             = $80000002;
 
104
  ACPU_AddressErr         = $80000003;
 
105
  ACPU_InstErr            = $80000004;
 
106
  ACPU_DivZero            = $80000005;
 
107
  ACPU_CHK                = $80000006;
 
108
  ACPU_TRAPV              = $80000007;
 
109
  ACPU_PrivErr            = $80000008;
 
110
  ACPU_Trace              = $80000009;
 
111
  ACPU_LineA              = $8000000A;
 
112
  ACPU_LineF              = $8000000B;
 
113
  ACPU_Format             = $8000000E;
 
114
  ACPU_Spurious           = $80000018;
 
115
  ACPU_AutoVec1           = $80000019;
 
116
  ACPU_AutoVec2           = $8000001A;
 
117
  ACPU_AutoVec3           = $8000001B;
 
118
  ACPU_AutoVec4           = $8000001C;
 
119
  ACPU_AutoVec5           = $8000001D;
 
120
  ACPU_AutoVec6           = $8000001E;
 
121
  ACPU_AutoVec7           = $8000001F;
 
122
 
 
123
  AT_DeadEnd              = $80000000;
 
124
  AT_Recovery             = $00000000;
 
125
 
 
126
  AG_NoMemory             = $00010000;
 
127
  AG_MakeLib              = $00020000;
 
128
  AG_OpenLib              = $00030000;
 
129
  AG_OpenDev              = $00040000;
 
130
  AG_OpenRes              = $00050000;
 
131
  AG_IOError              = $00060000;
 
132
  AG_NoSignal             = $00070000;
 
133
  AG_BadParm              = $00080000;
 
134
  AG_CloseLib             = $00090000;
 
135
  AG_CloseDev             = $000A0000;
 
136
  AG_ProcCreate           = $000B0000;
 
137
  AG_MsgPortNotEmpty      = $000C0000  { * V50 * };
 
138
 
 
139
  AO_ExecLib              = $00008001;
 
140
  AO_GraphicsLib          = $00008002;
 
141
  AO_LayersLib            = $00008003;
 
142
  AO_Intuition            = $00008004;
 
143
  AO_MathLib              = $00008005;
 
144
  AO_DOSLib               = $00008007;
 
145
  AO_RAMLib               = $00008008;
 
146
  AO_IconLib              = $00008009;
 
147
  AO_ExpansionLib         = $0000800A;
 
148
  AO_DiskfontLib          = $0000800B;
 
149
  AO_UtilityLib           = $0000800C;
 
150
  AO_KeyMapLib            = $0000800D;
 
151
 
 
152
  AO_AudioDev             = $00008010;
 
153
  AO_ConsoleDev           = $00008011;
 
154
  AO_GamePortDev          = $00008012;
 
155
  AO_KeyboardDev          = $00008013;
 
156
  AO_TrackDiskDev         = $00008014;
 
157
  AO_TimerDev             = $00008015;
 
158
 
 
159
  AO_CIARsrc              = $00008020;
 
160
  AO_DiskRsrc             = $00008021;
 
161
  AO_MiscRsrc             = $00008022;
 
162
 
 
163
  AO_BootStrap            = $00008030;
 
164
  AO_Workbench            = $00008031;
 
165
  AO_DiskCopy             = $00008032;
 
166
  AO_GadTools             = $00008033;
 
167
  AO_Unknown              = $00008035;
 
168
 
 
169
 
 
170
  { *
 
171
    * exec.library
 
172
    * }
 
173
const
 
174
  AN_ExecLib              = $01000000;
 
175
  AN_ExcptVect            = $01000001;
 
176
  AN_BaseChkSum           = $01000002;
 
177
  AN_LibChkSum            = $01000003;
 
178
 
 
179
  AN_MemCorrupt           = $81000005;
 
180
  AN_IntrMem              = $81000006;
 
181
  AN_InitAPtr             = $01000007;
 
182
  AN_SemCorrupt           = $01000008;
 
183
 
 
184
  AN_FreeTwice            = $01000009;
 
185
  AN_BogusExcpt           = $8100000A;
 
186
  AN_IOUsedTwice          = $0100000B;
 
187
  AN_MemoryInsane         = $0100000C;
 
188
 
 
189
  AN_IOAfterClose         = $0100000D;
 
190
  AN_StackProbe           = $0100000E;
 
191
  AN_BadFreeAddr          = $0100000F;
 
192
  AN_BadSemaphore         = $01000010;
 
193
 
 
194
  { *
 
195
    * graphics.library
 
196
    * }
 
197
const
 
198
  AN_GraphicsLib          = $02000000;
 
199
  AN_GfxNoMem             = $82010000;
 
200
  AN_GfxNoMemMspc         = $82010001;
 
201
  AN_LongFrame            = $82010006;
 
202
  AN_ShortFrame           = $82010007;
 
203
  AN_TextTmpRas           = $02010009;
 
204
  AN_BltBitMap            = $8201000A;
 
205
  AN_RegionMemory         = $8201000B;
 
206
  AN_MakeVPort            = $82010030;
 
207
  AN_GfxNewError          = $0200000C;
 
208
  AN_GfxFreeError         = $0200000D;
 
209
 
 
210
  AN_GfxNoLCM             = $82011234;
 
211
 
 
212
  AN_ObsoleteFont         = $02000401;
 
213
 
 
214
  { *
 
215
    * layers.library
 
216
    * }
 
217
const
 
218
  AN_LayersLib            = $03000000;
 
219
  AN_LayersNoMem          = $83010000;
 
220
 
 
221
  { *
 
222
    * intuition.library
 
223
    * }
 
224
const
 
225
  AN_Intuition            = $04000000;
 
226
  AN_GadgetType           = $84000001;
 
227
  AN_BadGadget            = $04000001;
 
228
  AN_CreatePort           = $84010002;
 
229
  AN_ItemAlloc            = $04010003;
 
230
  AN_SubAlloc             = $04010004;
 
231
  AN_PlaneAlloc           = $84010005;
 
232
  AN_ItemBoxTop           = $84000006;
 
233
  AN_OpenScreen           = $84010007;
 
234
  AN_OpenScrnRast         = $84010008;
 
235
  AN_SysScrnType          = $84000009;
 
236
  AN_AddSWGadget          = $8401000A;
 
237
  AN_OpenWindow           = $8401000B;
 
238
  AN_BadState             = $8400000C;
 
239
  AN_BadMessage           = $8400000D;
 
240
  AN_WeirdEcho            = $8400000E;
 
241
  AN_NoConsole            = $8400000F;
 
242
  AN_NoISem               = $04000010;
 
243
  AN_ISemOrder            = $04000011;
 
244
 
 
245
  { *
 
246
    * math.library
 
247
    * }
 
248
const
 
249
  AN_MathLib              = $05000000;
 
250
 
 
251
  { *
 
252
    * dos.library
 
253
    * }
 
254
const
 
255
  AN_DOSLib               = $07000000;
 
256
  AN_StartMem             = $07010001;
 
257
  AN_EndTask              = $07000002;
 
258
  AN_QPktFail             = $07000003;
 
259
  AN_AsyncPkt             = $07000004;
 
260
  AN_FreeVec              = $07000005;
 
261
  AN_DiskBlkSeq           = $07000006;
 
262
  AN_BitMap               = $07000007;
 
263
  AN_KeyFree              = $07000008;
 
264
  AN_BadChkSum            = $07000009;
 
265
  AN_DiskError            = $0700000A;
 
266
  AN_KeyRange             = $0700000B;
 
267
  AN_BadOverlay           = $0700000C;
 
268
  AN_BadInitFunc          = $0700000D;
 
269
  AN_FileReclosed         = $0700000E;
 
270
 
 
271
  { *
 
272
    * ramlib.library
 
273
    * }
 
274
const
 
275
  AN_RAMLib               = $08000000;
 
276
  AN_BadSegList           = $08000001;
 
277
 
 
278
  { *
 
279
    * icon.library
 
280
    * }
 
281
const
 
282
  AN_IconLib              = $09000000;
 
283
 
 
284
  { *
 
285
    * expansion.library
 
286
    * }
 
287
const
 
288
  AN_ExpansionLib         = $0A000000;
 
289
  AN_BadExpansionFree     = $0A000001;
 
290
 
 
291
  { *
 
292
    * diskfont.library
 
293
    * }
 
294
const
 
295
  AN_DiskfontLib          = $0B000000;
 
296
 
 
297
  { *
 
298
    * audio.device
 
299
    * }
 
300
const
 
301
  AN_AudioDev             = $10000000;
 
302
 
 
303
  { *
 
304
    * console.device
 
305
    * }
 
306
const
 
307
  AN_ConsoleDev           = $11000000;
 
308
  AN_NoWindow             = $11000001;
 
309
 
 
310
  { *
 
311
    * gameport.device
 
312
    * }
 
313
const
 
314
  AN_GamePortDev          = $12000000;
 
315
 
 
316
  { *
 
317
    * keyboard.device
 
318
    * }
 
319
const
 
320
  AN_KeyboardDev          = $13000000;
 
321
 
 
322
  { *
 
323
    * trackdisk.device
 
324
    * }
 
325
const
 
326
  AN_TrackDiskDev         = $14000000;
 
327
  AN_TDCalibSeek          = $14000001;
 
328
  AN_TDDelay              = $14000002;
 
329
 
 
330
  { *
 
331
    * timer.device
 
332
    * }
 
333
const
 
334
  AN_TimerDev             = $15000000;
 
335
  AN_TMBadReq             = $15000001;
 
336
  AN_TMBadSupply          = $15000002;
 
337
 
 
338
  { *
 
339
    * cia.resource
 
340
    * }
 
341
const
 
342
  AN_CIARsrc              = $20000000;
 
343
 
 
344
  { *
 
345
    * disk.resource
 
346
    * }
 
347
const
 
348
  AN_DiskRsrc             = $21000000;
 
349
  AN_DRHasDisk            = $21000001;
 
350
  AN_DRIntNoAct           = $21000002;
 
351
 
 
352
  { *
 
353
    * misc.resource
 
354
    * }
 
355
const
 
356
  AN_MiscRsrc             = $22000000;
 
357
 
 
358
  { *
 
359
    * bootstrap
 
360
    * }
 
361
const
 
362
  AN_BootStrap            = $30000000;
 
363
  AN_BootError            = $30000001;
 
364
 
 
365
  { *
 
366
    * Workbench
 
367
    * }
 
368
const
 
369
  AN_Workbench            = $31000000;
 
370
  AN_NoFonts              = $B1000001;
 
371
  AN_WBBadStartupMsg1     = $31000001;
 
372
  AN_WBBadStartupMsg2     = $31000002;
 
373
  AN_WBBadIOMsg           = $31000003;
 
374
  AN_WBReLayoutToolMenu   = $B1010009;
 
375
 
 
376
  { *
 
377
    * DiskCopy
 
378
    * }
 
379
const
 
380
  AN_DiskCopy             = $32000000;
 
381
 
 
382
  { *
 
383
    * toolkit for Intuition
 
384
    * }
 
385
const
 
386
  AN_GadTools             = $33000000;
 
387
 
 
388
  { *
 
389
    * System utility library
 
390
    * }
 
391
const
 
392
  AN_UtilityLib           = $34000000;
 
393
 
 
394
  { *
 
395
    * For use by any application that needs it
 
396
    * }
 
397
const
 
398
  AN_Unknown              = $35000000;
 
399
 
 
400
 
 
401
 
 
402
{ * exec error definitions (V50)
 
403
  *********************************************************************
 
404
  * }
 
405
 
 
406
 
 
407
const
 
408
  IOERR_OPENFAIL      = (-1);
 
409
  IOERR_ABORTED       = (-2);
 
410
  IOERR_NOCMD         = (-3);
 
411
  IOERR_BADLENGTH     = (-4);
 
412
  IOERR_BADADDRESS    = (-5);
 
413
  IOERR_UNITBUSY      = (-6);
 
414
  IOERR_SELFTEST      = (-7);
 
415
  IOERR_NOMEMORY      = (-8);
 
416
 
 
417
 
 
418
 
 
419
{ * exec resident definitions (V50)
 
420
  *********************************************************************
 
421
  * }
 
422
 
 
423
 
 
424
type
 
425
  PResident = ^TResident;
 
426
  TResident = packed record
 
427
    rt_MatchWord: Word;
 
428
    rt_MatchTag : PResident;
 
429
    rt_EndSkip  : Pointer;
 
430
    rt_Flags    : Byte;
 
431
    rt_Version  : Byte;
 
432
    rt_Type     : Byte;
 
433
    rt_Pri      : Byte;
 
434
    rt_Name     : PChar;
 
435
    rt_IdString : PChar;
 
436
    rt_Init     : Pointer;
 
437
    { * Only valid when RTF_EXTENDED is set
 
438
      * }
 
439
    rt_Revision : Word; { * Revision Entry * }
 
440
    rt_Tags     : Pointer;
 
441
  end;
 
442
 
 
443
 
 
444
const
 
445
  RTC_MATCHWORD = $4AFC;
 
446
 
 
447
  RTF_AUTOINIT   = (1 Shl 7);
 
448
  RTF_EXTENDED   = (1 Shl 6);   { * structure extension is valid * }
 
449
  { * rt_Init points to a PPC function which must be defined as
 
450
    *
 
451
    * struct Library* LIB_Init(struct Library  *MyLibBase,
 
452
    *                          BPTR             SegList,
 
453
    *                          struct ExecBase *SysBase)
 
454
    * }
 
455
  RTF_PPC        = (1 Shl 3);
 
456
  RTF_AFTERDOS   = (1 Shl 2);
 
457
  RTF_SINGLETASK = (1 Shl 1);
 
458
  RTF_COLDSTART  = (1 Shl 0);
 
459
 
 
460
  RTW_NEVER      = 0;
 
461
  RTW_COLDSTART  = 1;
 
462
 
 
463
 
 
464
 
 
465
{ * exec memory definitions (V50)
 
466
  *********************************************************************
 
467
  * }
 
468
 
 
469
 
 
470
type
 
471
  PMemChunk = ^TMemChunk;
 
472
  TMemChunk = packed record
 
473
    nc_Next : PMemChunk;
 
474
    nc_Bytes: DWord;
 
475
  end;
 
476
 
 
477
type
 
478
  PMemHeader = ^TMemHeader;
 
479
  TMemHeader = packed record
 
480
    mh_Node      : TNode;
 
481
    mh_Attributes: Word;
 
482
    mh_First     : PMemChunk;
 
483
    mh_Lower     : Pointer;
 
484
    mh_Upper     : Pointer;
 
485
    mh_Free      : DWord;
 
486
  end;
 
487
 
 
488
type
 
489
  PMemEntry = ^TMemEntry;
 
490
  TMemEntry = packed record
 
491
    me_Un: packed record
 
492
    case Byte of
 
493
      0 : (meu_Regs: DWord);
 
494
      1 : (meu_Addr: Pointer)
 
495
    end;
 
496
    me_Length: DWord;
 
497
  end;
 
498
 
 
499
type
 
500
  PMemList = ^TMemList;
 
501
  TMemList = packed record
 
502
    ml_Node      : TNode;
 
503
    ml_NumEntries: Word;
 
504
    ml_ME        : PMemEntry;
 
505
  end;
 
506
 
 
507
 
 
508
const
 
509
  MEMF_ANY           = 0;
 
510
  MEMF_PUBLIC        = (1 Shl 0);
 
511
  MEMF_CHIP          = (1 Shl 1);
 
512
  MEMF_FAST          = (1 Shl 2);
 
513
  MEMF_LOCAL         = (1 Shl 8);
 
514
  MEMF_24BITDMA      = (1 Shl 9);
 
515
  MEMF_KICK          = (1 Shl 10);
 
516
  MEMF_SWAP          = (1 Shl 11); { * Memory that can be swapped out to disk * }
 
517
 
 
518
  MEMF_CLEAR         = (1 Shl 16);
 
519
  MEMF_LARGEST       = (1 Shl 17);
 
520
  MEMF_REVERSE       = (1 Shl 18);
 
521
  MEMF_TOTAL         = (1 Shl 19);
 
522
  MEMF_SEM_PROTECTED = (1 Shl 20); { * Pools: semaphore protection * }
 
523
  MEMF_NO_EXPUNGE    = (1 Shl 31);
 
524
 
 
525
  MEM_BLOCKSIZE      = 8;
 
526
  MEM_BLOCKMASK      = (MEM_BLOCKSIZE - 1);
 
527
 
 
528
 
 
529
type
 
530
  PMemHandlerData = ^TMemHandlerData;
 
531
  TMemHandlerData = packed record
 
532
    memh_RequestSize : DWord;
 
533
    memh_RequestFlags: DWord;
 
534
    memh_Flags       : DWord;
 
535
  end;
 
536
 
 
537
 
 
538
const
 
539
  MEMHF_RECYCLE   = (1 Shl 0);
 
540
 
 
541
  MEM_DID_NOTHING = 0;
 
542
  MEM_ALL_DONE    = -1;
 
543
  MEM_TRY_AGAIN   = 1;
 
544
 
 
545
 
 
546
 
 
547
{ * exec port definitions (V50)
 
548
  *********************************************************************
 
549
  * }
 
550
 
 
551
 
 
552
type
 
553
  PMsgPort = ^TMsgPort;
 
554
  TMsgPort = packed record
 
555
    mp_Node   : TNode;
 
556
    mp_Flags  : Byte;
 
557
    mp_SigBit : Byte;
 
558
    mp_SigTask: Pointer;
 
559
    mp_MsgList: TList;
 
560
  end;
 
561
 
 
562
 
 
563
const
 
564
  PF_ACTION  = 3;
 
565
  PA_SIGNAL  = 0;
 
566
  PA_SOFTINT = 1;
 
567
  PA_IGNORE  = 2;
 
568
 
 
569
 
 
570
type
 
571
  PMessage = ^TMessage;
 
572
  TMessage = packed record
 
573
    mn_Node     : TNode;
 
574
    mn_ReplyPort: PMsgPort;
 
575
    mn_Length   : Word;
 
576
  end;
 
577
 
 
578
 
 
579
 
 
580
{ * exec task definitions (V50)
 
581
  *********************************************************************
 
582
  * }
 
583
 
 
584
 
 
585
type
 
586
  PTask = ^TTask;
 
587
  TTask = packed record
 
588
    tc_Node     : TNode;
 
589
    tc_Flags    : Byte;
 
590
    tc_State    : Byte;
 
591
    tc_IDNestCnt: ShortInt;
 
592
    tc_TDNestCnt: ShortInt;
 
593
    tc_SigAlloc : DWord;
 
594
    tc_SigWait  : DWord;
 
595
    tc_SigRecvd : DWord;
 
596
    tc_SigExcept: DWord;
 
597
    {$IF 0}
 
598
      tc_TrapAlloc: Word;
 
599
      tc_TrapAble : Word;
 
600
    {$ELSE}
 
601
      tc_ETask: Pointer;
 
602
    {$ENDIF}
 
603
    tc_ExceptData: Pointer;
 
604
    tc_ExceptCode: Pointer;
 
605
    tc_TrapData  : Pointer;
 
606
    tc_TrapCode  : Pointer;
 
607
    tc_SPReg     : Pointer;
 
608
    tc_SPLower   : Pointer;
 
609
    tc_SPUpper   : Pointer;
 
610
    tc_Switch    : Pointer; { *** OBSOLETE *** }
 
611
    tc_Launch    : Pointer; { *** OBSOLETE *** }
 
612
    tc_MemEntry  : TList;
 
613
    tc_UserData  : Pointer;
 
614
  end;
 
615
 
 
616
 
 
617
const
 
618
  TB_PROCTIME = 0;
 
619
  TB_ETASK    = 3;
 
620
  TB_STACKCHK = 4;
 
621
  TB_EXCEPT   = 5;
 
622
  TB_SWITCH   = 6;
 
623
  TB_LAUNCH   = 7;
 
624
 
 
625
  TF_PROCTIME = (1 Shl TB_PROCTIME);
 
626
  TF_ETASK    = (1 Shl TB_ETASK);
 
627
  TF_STACKCHK = (1 Shl TB_STACKCHK);
 
628
  TF_EXCEPT   = (1 Shl TB_EXCEPT);
 
629
  TF_SWITCH   = (1 Shl TB_SWITCH);
 
630
  TF_LAUNCH   = (1 Shl TB_LAUNCH);
 
631
 
 
632
  TS_INVALID  = 0;
 
633
  TS_ADDED    = 1;
 
634
  TS_RUN      = 2;
 
635
  TS_READY    = 3;
 
636
  TS_WAIT     = 4;
 
637
  TS_EXCEPT   = 5;
 
638
  TS_REMOVED  = 6;
 
639
 
 
640
  SIGB_ABORT     = 0;
 
641
  SIGB_CHILD     = 1;
 
642
  SIGB_BLIT      = 4;
 
643
  SIGB_SINGLE    = 4;
 
644
  SIGB_INTUITION = 5;
 
645
  SIGB_NET       = 7;
 
646
  SIGB_DOS       = 8;
 
647
 
 
648
  SIGF_ABORT      = (1 Shl SIGB_ABORT);
 
649
  SIGF_CHILD      = (1 Shl SIGB_CHILD);
 
650
  SIGF_BLIT       = (1 Shl SIGB_BLIT);
 
651
  SIGF_SINGLE     = (1 Shl SIGB_SINGLE);
 
652
  SIGF_INTUITION  = (1 Shl SIGB_INTUITION);
 
653
  SIGF_NET        = (1 Shl SIGB_NET);
 
654
  SIGF_DOS        = (1 Shl SIGB_DOS);
 
655
 
 
656
 
 
657
type
 
658
  PTaskTrapMessage = ^TTaskTrapMessage;
 
659
  TTaskTrapMessage = packed record
 
660
    Message: TMessage;    { * Message Header * }
 
661
    Task   : TTask;       { * connected Task * }
 
662
    Version: DWord;       { * version of the structure * }
 
663
    TType   : DWord;      { * Exception Type * }
 
664
    DAR    : DWord;       { * Exception Address Register * }
 
665
    DSISR  : DWord;       { * Exception DSISR Reg * }
 
666
 
 
667
    { * This is undiscovered land...
 
668
      * never assume a size of this structure
 
669
      * }
 
670
  end;
 
671
 
 
672
 
 
673
const
 
674
  VERSION_TASKTRAPMESSAGE = $0;
 
675
 
 
676
 
 
677
type
 
678
  PETask = ^TETask;
 
679
  TETask = packed record
 
680
    Message  : TMessage;
 
681
    Parent   : PTask;
 
682
    UniqueID : DWord;
 
683
    Children : TMinList;
 
684
    TrapAlloc: Word;
 
685
    TrapAble : Word;
 
686
    Result1  : DWord;
 
687
    Result2  : Pointer;
 
688
    MsgPort  : TMsgPort;
 
689
 
 
690
    { * Don't touch!!!!!!!!!..there'll be an interface
 
691
      * sooner than later.
 
692
      * New Entries...most of the above entries
 
693
      * are only their for structure compatability.
 
694
      * They have no meaning as the OS never supported
 
695
      * them.
 
696
      * }
 
697
 
 
698
    { * A Task Pool for the task.
 
699
      * }
 
700
    MemPool: Pointer;
 
701
 
 
702
    { * PPC's Stack Lower Ptr
 
703
      * The initial stack is allocated through
 
704
      * AllocVec, so a FreeVec(ETask^.PPCSPLower);
 
705
      * would work.
 
706
      * If you use PPCStackSwap you must allocate
 
707
      * your stack block with AllocVec();
 
708
      * }
 
709
    PPCSPLower: Pointer;
 
710
 
 
711
    { * PPC's Stack Upper Ptr
 
712
      * }
 
713
    PPCSPUpper : Pointer;
 
714
    PPCRegFrame: Pointer;
 
715
    PPCLibData : Pointer;
 
716
 
 
717
    { * On a PPC exception this msgport
 
718
      * is sent an exception msg...
 
719
      * the task is stopped until somebody
 
720
      * wakes it up again.
 
721
      * (asynchron exception interface)
 
722
      * If this Port is NULL the message is
 
723
      * sent to SysBase->ex_PPCTrapMsgPort.
 
724
      * }
 
725
    PPCTrapMsgPort: PMsgPort;
 
726
    PPCTrapMessage: PTaskTrapMessage;
 
727
 
 
728
    { * This is undiscovered land...
 
729
      * never assume a size of this structure
 
730
      * }
 
731
  end;
 
732
 
 
733
 
 
734
type
 
735
  PTaskInitExtension = ^TTaskInitExtension;
 
736
  TTaskInitExtension = packed record
 
737
    { * Must be filled with TRAP_PPCTASK
 
738
      * }
 
739
    Trap     : Word;
 
740
    Extension: Word; { * Must be set to 0 * }
 
741
    Tags     : Pointer;
 
742
  end;
 
743
 
 
744
 
 
745
const
 
746
  TASKTAG_DUMMY          = (TAG_USER + $100000);
 
747
 
 
748
  { * Ptr to an ULONG Errorfield where a better error description
 
749
    * can be stored.
 
750
    * }
 
751
  TASKTAG_ERROR          = (TASKTAG_DUMMY + $0);
 
752
 
 
753
  { * Code type
 
754
    * can be stored.
 
755
    * }
 
756
  TASKTAG_CODETYPE       = (TASKTAG_DUMMY + $1);
 
757
 
 
758
  { * Start PC
 
759
    * code must be of TASKTAG_CODETYPE
 
760
    * }
 
761
  TASKTAG_PC             = (TASKTAG_DUMMY + $2);
 
762
 
 
763
  { * Final PC
 
764
    * code must be of TASKTAG_CODETYPE
 
765
    * }
 
766
  TASKTAG_FINALPC        = (TASKTAG_DUMMY + $3);
 
767
 
 
768
  { * Stacksize...Default 8192
 
769
    * }
 
770
  TASKTAG_STACKSIZE      = (TASKTAG_DUMMY + $4);
 
771
 
 
772
  { * Std Stacksize...
 
773
    * Default(use the stack defined by tc_SPLower..tc_SPUpper)
 
774
    * }
 
775
  TASKTAG_STACKSIZE_M68K = (TASKTAG_DUMMY + $5);
 
776
 
 
777
  { * specify task name, name is copied
 
778
    * }
 
779
  TASKTAG_NAME           = (TASKTAG_DUMMY + $6);
 
780
 
 
781
  { * tc_UserData
 
782
    * }
 
783
  TASKTAG_USERDATA       = (TASKTAG_DUMMY + $7);
 
784
 
 
785
  { * Task priority
 
786
    * }
 
787
  TASKTAG_PRI            = (TASKTAG_DUMMY + $8);
 
788
 
 
789
  { * Pool's Puddlesize
 
790
    * }
 
791
  TASKTAG_POOLPUDDLE     = (TASKTAG_DUMMY + $9);
 
792
 
 
793
  { * Pool's ThreshSize
 
794
    * }
 
795
  TASKTAG_POOLTHRESH     = (TASKTAG_DUMMY + $a);
 
796
 
 
797
  { * PPC First Argument..gpr3
 
798
    * }
 
799
  TASKTAG_PPC_ARG1       = (TASKTAG_DUMMY + $10);
 
800
 
 
801
  { * PPC First Argument..gpr4
 
802
    * }
 
803
  TASKTAG_PPC_ARG2       = (TASKTAG_DUMMY + $11);
 
804
 
 
805
  { * PPC First Argument..gpr5
 
806
    * }
 
807
  TASKTAG_PPC_ARG3       = (TASKTAG_DUMMY + $12);
 
808
 
 
809
  { * PPC First Argument..gpr6
 
810
    * }
 
811
  TASKTAG_PPC_ARG4       = (TASKTAG_DUMMY + $13);
 
812
 
 
813
  { * PPC First Argument..gpr7
 
814
    * }
 
815
  TASKTAG_PPC_ARG5       = (TASKTAG_DUMMY + $14);
 
816
 
 
817
  { * PPC First Argument..gpr8
 
818
    * }
 
819
  TASKTAG_PPC_ARG6       = (TASKTAG_DUMMY + $15);
 
820
 
 
821
  { * PPC First Argument..gpr9
 
822
    * }
 
823
  TASKTAG_PPC_ARG7       = (TASKTAG_DUMMY + $16);
 
824
 
 
825
  { * PPC First Argument..gpr10
 
826
    * }
 
827
  TASKTAG_PPC_ARG8       = (TASKTAG_DUMMY + $17);
 
828
 
 
829
  { *
 
830
    * Startup message to be passed to task/process, ReplyMsg'd at RemTask()
 
831
    * ti_Data: struct Message *
 
832
    * }
 
833
  TASKTAG_STARTUPMSG     = (TASKTAG_DUMMY + $18);
 
834
 
 
835
  { *
 
836
    * Create internal MsgPort for task/process, deleted at RemTask()
 
837
    * ti_Data: struct MsgPort **, can be NULL
 
838
    * }
 
839
  TASKTAG_TASKMSGPORT    = (TASKTAG_DUMMY + $19);
 
840
 
 
841
 
 
842
const
 
843
  CODETYPE_M68K = $0;
 
844
  { *
 
845
    * System V4 ABI
 
846
    * }
 
847
  CODETYPE_PPC  = $1;
 
848
 
 
849
const
 
850
  TASKERROR_OK       = 0;
 
851
  TASKERROR_NOMEMORY = 1;
 
852
 
 
853
 
 
854
  { *
 
855
    * Stack swap structure as passed to StackSwap() and PPCStackSwap()
 
856
    * }
 
857
type
 
858
  PStackSwapStruct = ^TStackSwapStruct;
 
859
  TStackSwapStruct = packed record
 
860
    stk_Lower  : Pointer; { * Lowest byte of stack * }
 
861
    stk_Upper  : Pointer; { *�Upper end of stack (size + Lowert) * }
 
862
    stk_Pointer: Pointer; { * Stack pointer at switch point * }
 
863
  end;
 
864
 
 
865
type
 
866
  PPPCStackSwapArgs = ^TPPCStackSwapArgs;
 
867
  TPPCStackSwapArgs = packed record
 
868
    Args: Array[0..7] Of DWord; { * The C register arguments from gpr3..gpr11 * }
 
869
  end;
 
870
 
 
871
 
 
872
  { *
 
873
    * NewGetTaskAttrsA(),  NewSetTaskAttrsA() tags
 
874
    * }
 
875
const
 
876
  TASKINFOTYPE_ALLTASK            = $0;
 
877
  TASKINFOTYPE_NAME               = $1;
 
878
  TASKINFOTYPE_PRI                = $2;
 
879
  TASKINFOTYPE_TYPE               = $3;
 
880
  TASKINFOTYPE_STATE              = $4;
 
881
  TASKINFOTYPE_FLAGS              = $5;
 
882
  TASKINFOTYPE_SIGALLOC           = $6;
 
883
  TASKINFOTYPE_SIGWAIT            = $7;
 
884
  TASKINFOTYPE_SIGRECVD           = $8;
 
885
  TASKINFOTYPE_SIGEXCEPT          = $9;
 
886
  TASKINFOTYPE_EXCEPTDATA         = $a;
 
887
  TASKINFOTYPE_EXCEPTCODE         = $b;
 
888
  TASKINFOTYPE_TRAPDATA           = $c;
 
889
  TASKINFOTYPE_TRAPCODE           = $d;
 
890
  TASKINFOTYPE_STACKSIZE_M68K     = $e;
 
891
  TASKINFOTYPE_STACKSIZE          = $f;
 
892
  TASKINFOTYPE_USEDSTACKSIZE_M68K = $10;
 
893
  TASKINFOTYPE_USEDSTACKSIZE      = $11;
 
894
  TASKINFOTYPE_TRAPMSGPORT        = $12;
 
895
  TASKINFOTYPE_STARTUPMSG         = $13;
 
896
  TASKINFOTYPE_TASKMSGPORT        = $14;
 
897
  TASKINFOTYPE_POOLPTR            = $15;
 
898
  TASKINFOTYPE_POOLMEMFLAGS       = $16;
 
899
  TASKINFOTYPE_POOLPUDDLESIZE     = $17;
 
900
  TASKINFOTYPE_POOLTHRESHSIZE     = $18;
 
901
 
 
902
  { *
 
903
    * Task Scheduler statistics (exec 50.42)
 
904
    * }
 
905
  TASKINFOTYPE_NICE                  = $19;
 
906
  TASKINFOTYPE_AGETICKS              = $1a;
 
907
  TASKINFOTYPE_CPUTIME               = $1b;
 
908
  TASKINFOTYPE_LASTSECCPUTIME        = $1c;
 
909
  TASKINFOTYPE_RECENTCPUTIME         = $1d;
 
910
  TASKINFOTYPE_VOLUNTARYCSW          = $1e;
 
911
  TASKINFOTYPE_INVOLUNTARYCSW        = $1f;
 
912
  TASKINFOTYPE_LASTSECVOLUNTARYCSW   = $20;
 
913
  TASKINFOTYPE_LASTSECINVOLUNTARYCSW = $21;
 
914
  { * Added in exec 50.45 * }
 
915
  TASKINFOTYPE_LAUNCHTIMETICKS       = $22;
 
916
  TASKINFOTYPE_LAUNCHTIMETICKS1978   = $23;
 
917
  TASKINFOTYPE_PID                   = $24;
 
918
 
 
919
  TASKINFOTYPE_68K_NEWFRAME  = $50;
 
920
 
 
921
  TASKINFOTYPE_PPC_SRR0      = $100;
 
922
  TASKINFOTYPE_PPC_SRR1      = $101;
 
923
  TASKINFOTYPE_PPC_LR        = $102;
 
924
  TASKINFOTYPE_PPC_CTR       = $103;
 
925
  TASKINFOTYPE_PPC_CR        = $104;
 
926
  TASKINFOTYPE_PPC_XER       = $105;
 
927
  TASKINFOTYPE_PPC_GPR       = $106;
 
928
  TASKINFOTYPE_PPC_FPR       = $107;
 
929
  TASKINFOTYPE_PPC_FPSCR     = $108;
 
930
  TASKINFOTYPE_PPC_VSCR      = $109;
 
931
  TASKINFOTYPE_PPC_VMX       = $10a;
 
932
  TASKINFOTYPE_PPC_VSAVE     = $10b;
 
933
  TASKINFOTYPE_PPC_FRAME     = $10c;
 
934
  TASKINFOTYPE_PPC_FRAMESIZE = $10d;
 
935
  TASKINFOTYPE_PPC_NEWFRAME  = $10e;
 
936
 
 
937
  TASKINFOTAG_DUMMY       = (TAG_USER + $110000);
 
938
  { * Used with TASKINFOTYPE_ALLTASK
 
939
    * }
 
940
  TASKINFOTAG_HOOK        = (TASKINFOTAG_DUMMY + $0);
 
941
  { * Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX
 
942
    * to define the copy area
 
943
    * }
 
944
  TASKINFOTAG_REGSTART    = (TASKINFOTAG_DUMMY + $1);
 
945
  { * Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX
 
946
    * to define the copy area
 
947
    * }
 
948
  TASKINFOTAG_REGCOUNT    = (TASKINFOTAG_DUMMY + $2);
 
949
 
 
950
 
 
951
  { *
 
952
    * NewSetTaskAttrsA(..,@TaskFrame68k,sizeof(TTaskFrame68k),TASKINFOTYPE_68K_NEWFRAME,...);
 
953
    * }
 
954
type
 
955
  PTaskFrame68k = ^TTaskFrame68k;
 
956
  TTaskFrame68k = packed record
 
957
    PC: Pointer;
 
958
    SR: Word;
 
959
    Xn: Array[0..14] Of LongInt;
 
960
  end;
 
961
 
 
962
 
 
963
  { *
 
964
    * Don't depend on these
 
965
    * }
 
966
const
 
967
  DEFAULT_PPCSTACKSIZE   = 32768;
 
968
  DEFAULT_M68KSTACKSIZE  =  2048;
 
969
  DEFAULT_TASKPUDDLESIZE =  4096;
 
970
  DEFAULT_TASKTHRESHSIZE =  4096;
 
971
 
 
972
 
 
973
{ * exec interrupt definitions (V50)
 
974
  *********************************************************************
 
975
  * }
 
976
 
 
977
 
 
978
type
 
979
  PInterrupt = ^TInterrupt;
 
980
  TInterrupt = packed record
 
981
    is_Node: TNode;
 
982
    is_Data: Pointer;
 
983
    is_Code: Pointer;
 
984
  end;
 
985
 
 
986
type
 
987
  PIntVector = ^TIntVector;
 
988
  TIntVector = packed record
 
989
    iv_Data: Pointer;
 
990
    iv_Code: Pointer;
 
991
    iv_Node: PNode;
 
992
  end;
 
993
 
 
994
type
 
995
  PSoftIntList = ^TSoftIntList;
 
996
  TSoftIntList = packed record
 
997
    sh_List: TList;
 
998
    sh_Pad : Word;
 
999
  end;
 
1000
 
 
1001
 
 
1002
const
 
1003
  SIH_PRIMASK = $f0;
 
1004
 
 
1005
  INTB_NMI = 15;
 
1006
  INTF_NMI = (1 Shl INTB_NMI);
 
1007
 
 
1008
 
 
1009
 
 
1010
{ * exec semaphore definitions (V50)
 
1011
  *********************************************************************
 
1012
  * }
 
1013
 
 
1014
 
 
1015
  { *
 
1016
    * Shouldn't be available public..
 
1017
    * }
 
1018
type
 
1019
  PSemaphoreRequest = ^TSemaphoreRequest;
 
1020
  TSemaphoreRequest = packed record
 
1021
    sr_Link  : TMinNode;
 
1022
    sr_Waiter: PTask;
 
1023
  end;
 
1024
 
 
1025
type
 
1026
  PSignalSemaphore = ^TSignalSemaphore;
 
1027
  TSignalSemaphore = packed record
 
1028
    ss_Link        : TNode;
 
1029
    ss_NestCount   : SmallInt;
 
1030
    ss_WaitQueue   : TMinList;
 
1031
    ss_MultipleLink: TSemaphoreRequest;
 
1032
    ss_Owner       : PTask;
 
1033
    ss_QueueCount  : SmallInt;
 
1034
  end;
 
1035
 
 
1036
type
 
1037
  PSemaphoreMessage = ^TSemaphoreMessage;
 
1038
  TSemaphoreMessage = packed record
 
1039
    ssm_Message  : TMessage;
 
1040
    ssm_Semaphore: PSignalSemaphore;
 
1041
  end;
 
1042
 
 
1043
 
 
1044
const
 
1045
  SM_SHARED    = 1;
 
1046
  SM_EXCLUSIVE = 0;
 
1047
 
 
1048
 
 
1049
 
 
1050
{ * exec machine definitions (V50)
 
1051
  *********************************************************************
 
1052
  * }
 
1053
 
 
1054
 
 
1055
const
 
1056
  MACHINE_M68k  = $0;
 
1057
  MACHINE_PPC   = $1;
 
1058
  MACHINE_NO    = $ffffffff;
 
1059
 
 
1060
 
 
1061
 
 
1062
{ * exec library definitions (V50)
 
1063
  *********************************************************************
 
1064
  * }
 
1065
 
 
1066
 
 
1067
const
 
1068
  LIB_VECTSIZE  = 6;
 
1069
  LIB_RESERVED  = 4;
 
1070
  LIB_BASE      = (-LIB_VECTSIZE);
 
1071
  LIB_USERDEF   = (LIB_BASE - (LIB_RESERVED * LIB_VECTSIZE));
 
1072
  LIB_NONSTD    = (LIB_USERDEF);
 
1073
 
 
1074
  LIB_OPEN         = -6;
 
1075
  LIB_CLOSE        = -12;
 
1076
  LIB_EXPUNGE      = -18;
 
1077
  LIB_EXTFUNC      = -24;
 
1078
  LIB_GETQUERYATTR = -24; { * LIBF_QUERY * }
 
1079
 
 
1080
 
 
1081
type
 
1082
  PLibrary = ^TLibrary;
 
1083
  TLibrary = packed record
 
1084
    lib_Node    : TNode;
 
1085
    lib_Flags   : Byte;
 
1086
    lib_pad     : Byte;
 
1087
    lib_MegSize : Word;
 
1088
    lib_PosSize : Word;
 
1089
    lib_Version : Word;
 
1090
    lib_Revision: Word;
 
1091
    lib_IdString: PChar;
 
1092
    lib_Sum     : DWord;
 
1093
    lib_OpenCnt : Word;
 
1094
  end;
 
1095
 
 
1096
 
 
1097
const
 
1098
  LIBF_SUMMING   = (1 Shl 0);
 
1099
  LIBF_CHANGED   = (1 Shl 1);
 
1100
  LIBF_SUMUSED   = (1 Shl 2);
 
1101
  LIBF_DELEXP    = (1 Shl 3);
 
1102
  { *
 
1103
    * private
 
1104
    * }
 
1105
  LIBF_RAMLIB    = (1 Shl 4);
 
1106
  { *
 
1107
    * Needs to be set if the GetQueryAttr function is legal
 
1108
    * }
 
1109
  LIBF_QUERYINFO = (1 Shl 5);
 
1110
  { *
 
1111
    * The remaining bits are reserved and aren`t allowed to be touched
 
1112
    * }
 
1113
 
 
1114
 
 
1115
  { * NewSetFunction extensions
 
1116
    * }
 
1117
const
 
1118
  SETFUNCTAG_Dummy    = (TAG_USER +$01000000);
 
1119
 
 
1120
  { * Set the machine type of the function
 
1121
    * Default is 68k
 
1122
    * }
 
1123
  SETFUNCTAG_MACHINE  = (SETFUNCTAG_Dummy + $1);
 
1124
 
 
1125
  { * Function type specifier
 
1126
    * }
 
1127
  SETFUNCTAG_TYPE     = (SETFUNCTAG_Dummy + $2);
 
1128
 
 
1129
  { * ID String
 
1130
    * }
 
1131
  SETFUNCTAG_IDNAME   = (SETFUNCTAG_Dummy + $3);
 
1132
 
 
1133
  { *
 
1134
    * Set to TRUE if the replaced function will never be used
 
1135
    * again.
 
1136
    * }
 
1137
  SETFUNCTAG_DELETE   = (SETFUNCTAG_Dummy + $4);
 
1138
 
 
1139
 
 
1140
  { * See emul/emulinterface.h for more informations
 
1141
    * }
 
1142
 
 
1143
  { * Save Emulation PPC Registers
 
1144
    * Call Function
 
1145
    * Restore Emulation PPC Registers
 
1146
    * REG_D0 = Result
 
1147
    * }
 
1148
const
 
1149
  SETFUNCTYPE_NORMAL           = 0;
 
1150
  { * Call Function
 
1151
    * Must use the global register settings of the emulation
 
1152
    * REG_D0 = Result
 
1153
    * }
 
1154
  SETFUNCTYPE_QUICK            = 1;
 
1155
  { * Save Emulation PPC Registers
 
1156
    * Call Function
 
1157
    * Restore Emulation PPC Registers
 
1158
    * No Result
 
1159
    * Needed to replace functions like
 
1160
    * forbid,obtainsemaphores which are
 
1161
    * defined as trashing no registers
 
1162
    * }
 
1163
  SETFUNCTYPE_NORMALNR         = 2;
 
1164
  { * Call Function
 
1165
    * Must use the global register settings of the emulation
 
1166
    * No Result
 
1167
    * Needed to replace functions like
 
1168
    * forbid,obtainsemaphores which are
 
1169
    * defined as trashing no registers
 
1170
    * }
 
1171
  SETFUNCTYPE_QUICKNR          = 3;
 
1172
  SETFUNCTYPE_NORMALSR         = 4;
 
1173
  SETFUNCTYPE_NORMALSRNR       = 5;
 
1174
  SETFUNCTYPE_NORMALD0_D1      = 6;
 
1175
  SETFUNCTYPE_NORMALRESTORE    = 7;
 
1176
  SETFUNCTYPE_SYSTEMV          = 8;
 
1177
  SETFUNCTYPE_NORMALD0D1SR     = 9;
 
1178
  SETFUNCTYPE_NORMALD0D1A0A1SR = 10;
 
1179
 
 
1180
 
 
1181
  { * CreateLibrary extensions
 
1182
    * }
 
1183
  LIBTAG_BASE         = (TAG_USER + $01000100);
 
1184
 
 
1185
  { *
 
1186
    * Function/Vector Array
 
1187
    * }
 
1188
  LIBTAG_FUNCTIONINIT = (LIBTAG_BASE+$0);
 
1189
  { *
 
1190
    * Struct Init
 
1191
    * }
 
1192
  LIBTAG_STRUCTINIT   = (LIBTAG_BASE+$1);
 
1193
  { *
 
1194
    * Library Init
 
1195
    * }
 
1196
  LIBTAG_LIBRARYINIT  = (LIBTAG_BASE+$2);
 
1197
  { *
 
1198
    * Init Code Type
 
1199
    * }
 
1200
  LIBTAG_MACHINE      = (LIBTAG_BASE+$3);
 
1201
  { *
 
1202
    * Library Base Size
 
1203
    * }
 
1204
  LIBTAG_BASESIZE     = (LIBTAG_BASE+$4);
 
1205
  { *
 
1206
    * SegList Ptr
 
1207
    * }
 
1208
  LIBTAG_SEGLIST      = (LIBTAG_BASE+$5);
 
1209
  { *
 
1210
    * Library Priority
 
1211
    * }
 
1212
  LIBTAG_PRI          = (LIBTAG_BASE+$6);
 
1213
  { *
 
1214
    * Library Type..Library,Device,Resource,whatever
 
1215
    * }
 
1216
  LIBTAG_TYPE         = (LIBTAG_BASE+$7);
 
1217
  { *
 
1218
    * Library Version
 
1219
    * (UWORD)
 
1220
    * }
 
1221
  LIBTAG_VERSION      = (LIBTAG_BASE+$8);
 
1222
  { *
 
1223
    * Library Flags
 
1224
    * }
 
1225
  LIBTAG_FLAGS        = (LIBTAG_BASE+$9);
 
1226
  { *
 
1227
    * Library Name
 
1228
    * }
 
1229
  LIBTAG_NAME         = (LIBTAG_BASE+$a);
 
1230
  { *
 
1231
    * Library IDString
 
1232
    * }
 
1233
  LIBTAG_IDSTRING     = (LIBTAG_BASE+$b);
 
1234
  { *
 
1235
    * AddDevice(),AddLibrary(),AddResource()..
 
1236
    * depends on LibNode.ln_Type field which
 
1237
    * can be set by some Init function, Struct Scripts
 
1238
    * or LIBTAG_TYPE.
 
1239
    * If you set LIBTAG_PUBLIC the library
 
1240
    * is added to the right system list.
 
1241
    * }
 
1242
  LIBTAG_PUBLIC       = (LIBTAG_BASE+$c);
 
1243
  { *
 
1244
    * Library Revision
 
1245
    * (UWORD)
 
1246
    * }
 
1247
  LIBTAG_REVISION     = (LIBTAG_BASE+$d);
 
1248
  { *
 
1249
    * Library QueryInfo Flag
 
1250
    * (Boolean)
 
1251
    * }
 
1252
  LIBTAG_QUERYINFO    = (LIBTAG_BASE+$e);
 
1253
 
 
1254
 
 
1255
  { * Private
 
1256
    * don`t touch...floating design
 
1257
    * }
 
1258
type
 
1259
  PFuncEntry = ^TFuncEntry;
 
1260
  TFuncEntry = packed record
 
1261
    EmulLibEntry : TEmulLibEntry;
 
1262
    OldFunction  : Pointer;  { * Needed for bookkeeping * }
 
1263
  end;
 
1264
 
 
1265
  PFuncOldEntry = ^TFuncOldEntry;
 
1266
  TFuncOldEntry = packed record
 
1267
    Command  : Word;
 
1268
    FuncEntry: PFuncEntry;
 
1269
  end;
 
1270
 
 
1271
 
 
1272
  { *
 
1273
    * EmulLibEntry.Extension
 
1274
    * }
 
1275
const
 
1276
  FUNCENTRYEXTF_LIBRARY          = $1; { * Entry created by the OS * }
 
1277
 
 
1278
  { *
 
1279
    * Functionarray first ULONG ID defines the format
 
1280
    * of the functionarray for MakeFunctions()/MakeLibrary().
 
1281
    *
 
1282
    * If there`s not such id the functionarray is a
 
1283
    * 32Bit 68k function ptr array.
 
1284
    * (ULONG) $ffffffff stops it
 
1285
    * }
 
1286
 
 
1287
  { * 68k 16bit relative functionarray ptrs
 
1288
    * (UWORD) $ffff stops it
 
1289
    * }
 
1290
 
 
1291
  FUNCARRAY_16BIT_OLD             = $ffffffff;
 
1292
 
 
1293
  { * PPC 32bit functionarray ptrs
 
1294
    * (ULONG) $ffff stops it
 
1295
    * }
 
1296
  FUNCARRAY_32BIT_NATIVE          = $fffefffe;
 
1297
 
 
1298
  { * Starts a functionarray block.
 
1299
    * This way it`s possible to mix 68k and PPC
 
1300
    * function definitions.
 
1301
    * BASE:
 
1302
    *  FUNCTIONARRAY_BEGIN
 
1303
    *   FUNCARRAY_32BIT_NATIVE
 
1304
    *    FUNC0
 
1305
    *    FUNC1
 
1306
    *    .
 
1307
    *    FUNCn
 
1308
    *    $ffffffff
 
1309
    *   FUNCn+1  (No ID->32Bit 68k)
 
1310
    *    FUNCn+2
 
1311
    *    .
 
1312
    *    FUNCm
 
1313
    *    $ffffffff
 
1314
    *   FUNCARRAY_16BIT_OLD
 
1315
    *    FUNCm+1-BASE
 
1316
    *    FUNCm+2-BASE
 
1317
    *    .
 
1318
    *    FUNCo-BASE
 
1319
    *    $ffff
 
1320
    *  FUNCTIONARRAY_END
 
1321
    * }
 
1322
 
 
1323
  FUNCARRAY_BEGIN                = $fffdfffd;
 
1324
 
 
1325
  { * Ends a functionarray block.
 
1326
    * }
 
1327
  FUNCARRAY_END                  = $fffcfffc;
 
1328
 
 
1329
  { * PPC 32bit Quick functionarray ptrs.
 
1330
    * These functions must comply to the emulation's
 
1331
    * register layout which is defined inside the
 
1332
    * emul/emulregs.h. That means the register layout
 
1333
    * MUST also be valid during interrupts/task switches.
 
1334
    * You can't just destroy A7(r31), SR or PC.
 
1335
    *
 
1336
    * You shouldn't use this for any normal code
 
1337
    * as there's no real reason to do so. If you
 
1338
    * really think you need to use it please ask
 
1339
    * us first on the dev mailinglist.
 
1340
    * (ULONG) $ffffffff stops it
 
1341
    * }
 
1342
  FUNCARRAY_32BIT_QUICK_NATIVE   = $fffbfffb;
 
1343
 
 
1344
  { * PPC 32bit QuickNR(No Result) functionarray ptrs
 
1345
    * (ULONG) $ffffffff stops it
 
1346
    * }
 
1347
  FUNCARRAY_32BIT_QUICKNR_NATIVE = $fffafffa;
 
1348
 
 
1349
  { * PPC 32bit no result functionarray ptrs
 
1350
    * (ULONG) $ffffffff stops it
 
1351
    * }
 
1352
  FUNCARRAY_32BIT_NR_NATIVE      = $fff9fff9;
 
1353
 
 
1354
  { * PPC 32bit SR functionarray ptrs
 
1355
    * (ULONG) $ffffffff stops it
 
1356
    * }
 
1357
  FUNCARRAY_32BIT_SR_NATIVE      = $fff8fff8;
 
1358
 
 
1359
  { * PPC 32bit SR(no result) functionarray ptrs
 
1360
    * (ULONG) $ffffffff stops it
 
1361
    * }
 
1362
  FUNCARRAY_32BIT_SRNR_NATIVE    = $fff7fff7;
 
1363
 
 
1364
  { * PPC 32bit D0_D1 functionarray ptrs
 
1365
    * (ULONG) $ffffffff stops it
 
1366
    * }
 
1367
  FUNCARRAY_32BIT_D0D1_NATIVE    = $fff6fff6;
 
1368
 
 
1369
  { * PPC 32bit Restore1 functionarray ptrs
 
1370
    * (ULONG) $ffffffff stops it
 
1371
    * }
 
1372
  FUNCARRAY_32BIT_RESTORE_NATIVE = $fff5fff5;
 
1373
 
 
1374
  { * PPC 32bit SystemV ABI entry
 
1375
    * these function entries DON'T comply
 
1376
    * to the amiga register modell REG_D0-A6
 
1377
    * but comply to the PPC SystemV ABI so
 
1378
    * you can directly use PPC C Argument
 
1379
    * parsing. That way you're also not limited
 
1380
    * with the register count.
 
1381
    * Such library functions can't be used
 
1382
    * by 68k emulation, so you can only use
 
1383
    * them for new code.
 
1384
    * As we allow these new functions to be
 
1385
    * used with old functions we keep the
 
1386
    * 6 bytes function entry steps in the library.
 
1387
    * Layout is
 
1388
    *
 
1389
    * CODE_JMP, &FuncEntry ; Old Entry
 
1390
    * CODE_ILLEGAL, Function ; SystemV ABI Entry
 
1391
    *
 
1392
    *
 
1393
    * (ULONG) $ffffffff stops it
 
1394
    * }
 
1395
  FUNCARRAY_32BIT_SYSTEMV       = $fff4fff4;
 
1396
 
 
1397
  { * PPC 32bit D0D1SR functionarray ptrs
 
1398
    * (ULONG) $ffffffff stops it
 
1399
    * }
 
1400
  FUNCARRAY_32BIT_D0D1SR_NATIVE    = $fff3fff3;
 
1401
 
 
1402
  { * PPC 32bit D0D1A0A1SR functionarray ptrs
 
1403
    * (ULONG) $ffffffff stops it
 
1404
    * }
 
1405
  FUNCARRAY_32BIT_D0D1A0A1SR_NATIVE    = $fff2fff2;
 
1406
 
 
1407
 
 
1408
 
 
1409
{ * exec device definitions (V50)
 
1410
  *********************************************************************
 
1411
  * }
 
1412
 
 
1413
 
 
1414
type
 
1415
  PDevice = ^TDevice;
 
1416
  TDevice = packed record
 
1417
    dd_Library: TLibrary;
 
1418
  end;
 
1419
 
 
1420
type
 
1421
  PUnit = ^TUnit;
 
1422
  TUnit = packed record
 
1423
    unit_MsgPort: TMsgPort;
 
1424
    unit_flags  : Byte;
 
1425
    unit_pad    : Byte;
 
1426
    unit_OpenCnt: Word;
 
1427
  end;
 
1428
 
 
1429
 
 
1430
const
 
1431
  UNITF_ACTIVE = (1 Shl 0);
 
1432
  UNITF_INTASK = (1 Shl 1);
 
1433
 
 
1434
 
 
1435
 
 
1436
{ * exec io definitions (V50)
 
1437
  *********************************************************************
 
1438
  * }
 
1439
 
 
1440
 
 
1441
type
 
1442
  PIORequest = ^TIORequest;
 
1443
  TIORequest = packed record
 
1444
    io_Message: TMessage;
 
1445
    io_Device : PDevice;
 
1446
    io_Unit   : PUnit;
 
1447
    io_Command: Word;
 
1448
    io_Flags  : Byte;
 
1449
    io_Error  : ShortInt;
 
1450
  end;
 
1451
 
 
1452
type
 
1453
  PIOStdReq = ^TIOStdReq;
 
1454
  TIOStdReq = packed record
 
1455
    io_Message: TMessage;
 
1456
    io_Device : PDevice;
 
1457
    io_Unit   : PUnit;
 
1458
    io_Command: Word;
 
1459
    io_Flags  : Byte;
 
1460
    io_Error  : ShortInt;
 
1461
    io_Actual : DWord;
 
1462
    io_Length : DWord;
 
1463
    io_Data   : Pointer;
 
1464
    io_Offset : DWord;
 
1465
  end;
 
1466
 
 
1467
 
 
1468
const
 
1469
  DEV_BEGINIO  = -30;
 
1470
  DEV_ABORTIO  = -36;
 
1471
 
 
1472
  IOB_QUICK  = 0;
 
1473
  IOF_QUICK  = (1 Shl IOB_QUICK);
 
1474
 
 
1475
  CMD_INVALID = 0;
 
1476
  CMD_RESET   = 1;
 
1477
  CMD_READ    = 2;
 
1478
  CMD_WRITE   = 3;
 
1479
  CMD_UPDATE  = 4;
 
1480
  CMD_CLEAR   = 5;
 
1481
  CMD_STOP    = 6;
 
1482
  CMD_START   = 7;
 
1483
  CMD_FLUSH   = 8;
 
1484
  CMD_NONSTD  = 9;
 
1485
 
 
1486
 
 
1487
 
 
1488
{ * exec include (V50)
 
1489
  *********************************************************************
 
1490
  * }
 
1491
 
 
1492
 
 
1493
type
 
1494
  PExecBase = ^TExecBase;
 
1495
  TExecBase = packed record
 
1496
    LIbNode     : TLibrary;
 
1497
    SoftVer     : Word;
 
1498
    LowMemChkSum: SmallInt;
 
1499
    ChkBase     : DWord;
 
1500
    ColdCapture : Pointer;
 
1501
    CoolCapture : Pointer;
 
1502
    WarmCapture : Pointer;
 
1503
    SysStkUpper : Pointer;
 
1504
    SysStkLower : Pointer;
 
1505
    MaxLocMem   : DWord;
 
1506
    DebugEntry  : Pointer;
 
1507
    DebugData   : Pointer;
 
1508
    AlertData   : Pointer;
 
1509
    MaxExtMem   : Pointer;
 
1510
    ChkSum      : Word;
 
1511
    IntVects    : Array[0..15] Of TIntVector;
 
1512
    ThisTask    : PTask;
 
1513
    IdleCount   : DWord;
 
1514
    DispCount   : DWord;
 
1515
    Quantum     : Word;
 
1516
    Elapsed     : Word;
 
1517
    SysFlags    : Word;
 
1518
    IDNestCnt   : ShortInt;
 
1519
    TDNestCnt   : ShortInt;
 
1520
    AttnFlags   : Word;
 
1521
    AttnResched : Word;
 
1522
    ResModules  : Pointer;
 
1523
 
 
1524
    TaskTrapCode  : Pointer;
 
1525
    TaskExceptCode: Pointer;
 
1526
    TaskExitCode  : Pointer;
 
1527
    TaskSigAlloc  : DWord;
 
1528
    TaskTrapAlloc : Word;
 
1529
 
 
1530
    MemList     : TList;
 
1531
    ResourceList: TList;
 
1532
    DeviceList  : TList;
 
1533
    IntrList    : TList;
 
1534
    LibList     : TList;
 
1535
    PortList    : TList;
 
1536
    TaskReady   : TList;
 
1537
    TaskWait    : TList;
 
1538
    SoftInts    : Array[0..5] Of TSoftIntList;
 
1539
    LastAlert   : Array[0..3] Of LongInt;
 
1540
 
 
1541
    VBlankFrequency     : Byte;
 
1542
    PowerSupplyFrequency: Byte;
 
1543
    SemaphoreList       : TList;
 
1544
    KickMemPtr          : Pointer;
 
1545
    KickTagPtr          : Pointer;
 
1546
    KickCheckSum        : Pointer;
 
1547
    ex_Pad0             : Word;
 
1548
    ex_LaunchPoint      : DWord;
 
1549
    ex_RamLibPrivate    : Pointer;
 
1550
    ex_EClockFrequency  : DWord;
 
1551
    ex_CacheControl     : DWord;
 
1552
    ex_TaskID           : DWord;
 
1553
 
 
1554
    { * New ABox Emulation Entries
 
1555
      * }
 
1556
    ex_EmulHandleSize    : DWord;    { * PPC EmulHandleSize..*private* * }
 
1557
    ex_PPCTrapMsgPort    : PMsgPort; { * PPC ABox Exception MsgPort..*private* * }
 
1558
    ex_Reserved1         : Array[0..2] Of DWord;
 
1559
    ex_MMULock           : Pointer;
 
1560
    ex_PatchPool         : Pointer;  { * PatchPool Ptr needed by SetFunction..*private* * }
 
1561
    ex_PPCTaskExitCode   : Pointer;  { * PPC Task exit function * }
 
1562
    ex_DebugFlags        : DWord;    { * Exec Debug Flags..*private* * }
 
1563
 
 
1564
    ex_MemHandlers       : TMinList;
 
1565
    ex_MemHandler        : Pointer;
 
1566
  end;
 
1567
 
 
1568
 
 
1569
  { *
 
1570
    * Outdated 68k cpu informations
 
1571
    *
 
1572
    * }
 
1573
const
 
1574
  AFB_68010   = 0;
 
1575
  AFB_68020   = 1;
 
1576
  AFB_68030   = 2;
 
1577
  AFB_68040   = 3;
 
1578
  AFB_68881   = 4;
 
1579
  AFB_68882   = 5;
 
1580
  AFB_FPU40   = 6;
 
1581
  AFB_68060   = 7;
 
1582
  AFB_PRIVATE = 15;
 
1583
 
 
1584
  AFF_68010   = (1 Shl AFB_68010);
 
1585
  AFF_68020   = (1 Shl AFB_68020);
 
1586
  AFF_68030   = (1 Shl AFB_68030);
 
1587
  AFF_68040   = (1 Shl AFB_68040);
 
1588
  AFF_68881   = (1 Shl AFB_68881);
 
1589
  AFF_68882   = (1 Shl AFB_68882);
 
1590
  AFF_FPU40   = (1 Shl AFB_FPU40);
 
1591
  AFF_68060   = (1 Shl AFB_68060);
 
1592
  AFF_PRIVATE = (1 Shl AFB_PRIVATE);
 
1593
 
 
1594
  { *
 
1595
    * Outdated 68k cache functionality
 
1596
    * Mostly without function.
 
1597
    * }
 
1598
const
 
1599
  CACRF_EnableI       = (1 Shl 0);
 
1600
  CACRF_FreezeI       = (1 Shl 1);
 
1601
  CACRF_ClearI        = (1 Shl 3);
 
1602
  CACRF_IBE           = (1 Shl 4);
 
1603
  CACRF_EnableD       = (1 Shl 8);
 
1604
  CACRF_FreezeD       = (1 Shl 9);
 
1605
  CACRF_ClearD        = (1 Shl 11);
 
1606
  CACRF_DBE           = (1 Shl 12);
 
1607
  CACRF_WriteAllocate = (1 Shl 13);
 
1608
  CACRF_EnableE       = (1 Shl 30);
 
1609
  CACRF_CopyBack      = (1 Shl 31);
 
1610
 
 
1611
  DMA_Continue        = (1 Shl 1);
 
1612
  DMA_NoModify        = (1 Shl 2);
 
1613
  DMA_ReadFromRAM     = (1 Shl 3);
 
1614
 
 
1615
  SB_SAR  = 15;
 
1616
  SB_TQE  = 14;
 
1617
  SB_SINT = 13;
 
1618
 
 
1619
  SF_SAR  = (1 Shl SB_SAR);
 
1620
  SF_TQE  = (1 Shl SB_TQE);
 
1621
  SF_SINT = (1 Shl SB_SINT);
 
1622
 
 
1623
 
 
1624
  { ****** Debug Flags...(don`t depend on them) ********** }
 
1625
const
 
1626
  EXECDEBUGF_INITRESIDENT     = $1;
 
1627
  EXECDEBUGF_INITCODE         = $2;
 
1628
  EXECDEBUGF_FINDRESIDENT     = $4;
 
1629
 
 
1630
  EXECDEBUGF_CREATELIBRARY    = $10;
 
1631
  EXECDEBUGF_SETFUNCTION      = $20;
 
1632
  EXECDEBUGF_NEWSETFUNCTION   = $40;
 
1633
  EXECDEBUGF_CHIPRAM          = $80;
 
1634
 
 
1635
  EXECDEBUGF_ADDTASK          = $100;
 
1636
  EXECDEBUGF_REMTASK          = $200;
 
1637
  EXECDEBUGF_GETTASKATTR      = $400;
 
1638
  EXECDEBUGF_SETTASKATTR      = $800;
 
1639
 
 
1640
  EXECDEBUGF_EXCEPTHANDLER    = $1000;
 
1641
  EXECDEBUGF_ADDDOSNODE       = $2000;
 
1642
  EXECDEBUGF_PCI              = $4000;
 
1643
  EXECDEBUGF_RAMLIB           = $8000;
 
1644
 
 
1645
  EXECDEBUGF_NOLOGSERVER      = $10000;
 
1646
  EXECDEBUGF_NOLOGWINDOW      = $20000;
 
1647
 
 
1648
  { *
 
1649
    * "env:MorphOS/LogPath" contains the logfile path,
 
1650
    * If not specified it`s using "ram:.morphoslog"
 
1651
    * }
 
1652
  EXECDEBUGF_LOGFILE          = $40000;
 
1653
  EXECDEBUGF_LOGKPRINTF       = $80000;
 
1654
 
 
1655
  { * Memory Tracking Flags
 
1656
    * }
 
1657
  EXECDEBUGF_PERMMEMTRACK     = $100000;
 
1658
  EXECDEBUGF_MEMTRACK         = $200000;
 
1659
 
 
1660
  { * CyberGuardPPC Flags
 
1661
    * }
 
1662
  EXECDEBUGF_CYBERGUARDDEADLY = $400000;
 
1663
 
 
1664
  { * PPCLib Flags
 
1665
    * }
 
1666
  EXECDEBUGF_LOADSEG          = $01000000;
 
1667
  EXECDEBUGF_UNLOADSEG        = $02000000;
 
1668
  EXECDEBUGF_PPCSTART         = $04000000;
 
1669
 
 
1670
  { * UserFlags
 
1671
    * }
 
1672
 
 
1673
  { *
 
1674
    * Enables debug output for cybergraphx
 
1675
    * }
 
1676
const
 
1677
  EXECDEBUGF_CGXDEBUG         = $08000000;
 
1678
 
 
1679
  { *
 
1680
    * Should be used to control user LibInit/DevInit Debug output
 
1681
    * }
 
1682
  EXECDEBUGF_INIT             = $40000000;
 
1683
 
 
1684
  { *
 
1685
    * Should be used to control logging
 
1686
    * }
 
1687
  EXECDEBUGF_LOG              = $80000000;
 
1688
 
 
1689
  { *
 
1690
    * Execbase list IDs
 
1691
    * }
 
1692
  EXECLIST_DEVICE       = 0;
 
1693
  EXECLIST_INTERRUPT    = 1;
 
1694
  EXECLIST_LIBRARY      = 2;
 
1695
  EXECLIST_MEMHANDLER   = 3;
 
1696
  EXECLIST_MEMHEADER    = 4;
 
1697
  EXECLIST_PORT         = 5;
 
1698
  EXECLIST_RESOURCE     = 6;
 
1699
  EXECLIST_SEMAPHORE    = 7;
 
1700
  EXECLIST_TASK         = 8;
 
1701
 
 
1702
 
 
1703
  { *
 
1704
    * Execnotify hook message
 
1705
    * }
 
1706
type
 
1707
  PExecNotifyMessage = ^TExecNotifyMessage;
 
1708
  TExecNotifyMessage = packed record
 
1709
    MType    : DWord;
 
1710
    Flags    : DWord;
 
1711
    Extra    : DWord;
 
1712
    Extension: Pointer;
 
1713
  end;
 
1714
 
 
1715
 
 
1716
const
 
1717
  EXECNOTIFYF_REMOVE = (1 Shl 0);  { * if clear, is ADD * }
 
1718
  EXECNOTIFYF_POST   = (1 Shl 1);  { * if clear, is PRE * }
 
1719
 
 
1720
 
 
1721
  { *
 
1722
    * AddExecNodeTagList tags
 
1723
    * }
 
1724
const
 
1725
  SAL_Dummy    = (TAG_USER + 1000);
 
1726
  SAL_Type     = (SAL_Dummy + 1);
 
1727
  SAL_Priority = (SAL_Dummy + 2);
 
1728
  SAL_Name     = (SAL_Dummy + 3);
 
1729
 
 
1730
 
 
1731
{$include utild2.inc}
 
1732
 
 
1733