execd.inc 43 KB

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