~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to rtl/morphos/execd.inc

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2005-05-30 11:59:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050530115910-x5pbzm4qqta4i94h
Tags: 2.0.0-2
debian/fp-compiler.postinst.in: forgot to reapply the patch that
correctly creates the slave link to pc(1).  (Closes: #310907)

Show diffs side-by-side

added added

removed removed

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