execd.inc 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793
  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; // intr disabled nesting
  514. tc_TDNestCnt: Shortint; // task disabled nesting
  515. tc_SigAlloc: LongWord; // sigs allocated
  516. tc_SigWait: LongWord; // sigs we are waiting for
  517. tc_SigRecvd: LongWord; // sigs we have received
  518. tc_SigExcept: LongWord; // sigs we will take excepts for
  519. case boolean of
  520. True:(
  521. tc_TrapAlloc: Word; // traps allocated
  522. tc_TrapAble: Word;); // traps enabled
  523. False:(
  524. tc_ETask: Pointer; // Valid if TF_ETask is set
  525. tc_ExceptData: Pointer; // points to except data
  526. tc_ExceptCode: Pointer; // points to except code
  527. tc_TrapData: Pointer; // points to trap data
  528. tc_TrapCode: Pointer; // points to trap code
  529. tc_SPReg: Pointer; // stack pointer
  530. tc_SPLower: Pointer; // stack lower bound
  531. tc_SPUpper: Pointer; // stack upper bound + 2
  532. tc_Switch: Pointer; // task losing CPU
  533. tc_Launch: Pointer; // task getting CPU
  534. tc_MemEntry: TEList; // allocated memory
  535. tc_UserData: Pointer; // per task data
  536. );
  537. end;
  538. const
  539. TB_PROCTIME = 0;
  540. TB_ETASK = 3;
  541. TB_STACKCHK = 4;
  542. TB_EXCEPT = 5;
  543. TB_SWITCH = 6;
  544. TB_LAUNCH = 7;
  545. TF_PROCTIME = (1 Shl TB_PROCTIME);
  546. TF_ETASK = (1 Shl TB_ETASK);
  547. TF_STACKCHK = (1 Shl TB_STACKCHK);
  548. TF_EXCEPT = (1 Shl TB_EXCEPT);
  549. TF_SWITCH = (1 Shl TB_SWITCH);
  550. TF_LAUNCH = (1 Shl TB_LAUNCH);
  551. TS_INVALID = 0;
  552. TS_ADDED = 1;
  553. TS_RUN = 2;
  554. TS_READY = 3;
  555. TS_WAIT = 4;
  556. TS_EXCEPT = 5;
  557. TS_REMOVED = 6;
  558. SIGB_ABORT = 0;
  559. SIGB_CHILD = 1;
  560. SIGB_BLIT = 4;
  561. SIGB_SINGLE = 4;
  562. SIGB_INTUITION = 5;
  563. SIGB_NET = 7;
  564. SIGB_DOS = 8;
  565. SIGF_ABORT = (1 Shl SIGB_ABORT);
  566. SIGF_CHILD = (1 Shl SIGB_CHILD);
  567. SIGF_BLIT = (1 Shl SIGB_BLIT);
  568. SIGF_SINGLE = (1 Shl SIGB_SINGLE);
  569. SIGF_INTUITION = (1 Shl SIGB_INTUITION);
  570. SIGF_NET = (1 Shl SIGB_NET);
  571. SIGF_DOS = (1 Shl SIGB_DOS);
  572. type
  573. PTaskTrapMessage = ^TTaskTrapMessage;
  574. TTaskTrapMessage = record
  575. Message: TMessage; { * Message Header * }
  576. Task : TTask; { * connected Task * }
  577. Version: DWord; { * version of the structure * }
  578. TType : DWord; { * Exception Type * }
  579. DAR : DWord; { * Exception Address Register * }
  580. DSISR : DWord; { * Exception DSISR Reg * }
  581. { * This is undiscovered land...
  582. * never assume a size of this structure
  583. * }
  584. end;
  585. const
  586. VERSION_TASKTRAPMESSAGE = $0;
  587. type
  588. PETask = ^TETask;
  589. TETask = record
  590. Message : TMessage;
  591. Parent : PTask;
  592. UniqueID : DWord;
  593. Children : TMinList;
  594. TrapAlloc: Word;
  595. TrapAble : Word;
  596. Result1 : DWord;
  597. Result2 : Pointer;
  598. MsgPort : TMsgPort;
  599. { * Don't touch!!!!!!!!!..there'll be an interface
  600. * sooner than later.
  601. * New Entries...most of the above entries
  602. * are only their for structure compatability.
  603. * They have no meaning as the OS never supported
  604. * them.
  605. * }
  606. { * A Task Pool for the task.
  607. * }
  608. MemPool: Pointer;
  609. { * PPC's Stack Lower Ptr
  610. * The initial stack is allocated through
  611. * AllocVec, so a FreeVec(ETask^.PPCSPLower);
  612. * would work.
  613. * If you use PPCStackSwap you must allocate
  614. * your stack block with AllocVec();
  615. * }
  616. PPCSPLower: Pointer;
  617. { * PPC's Stack Upper Ptr
  618. * }
  619. PPCSPUpper : Pointer;
  620. PPCRegFrame: Pointer;
  621. PPCLibData : Pointer;
  622. { * On a PPC exception this msgport
  623. * is sent an exception msg...
  624. * the task is stopped until somebody
  625. * wakes it up again.
  626. * (asynchron exception interface)
  627. * If this Port is NULL the message is
  628. * sent to SysBase->ex_PPCTrapMsgPort.
  629. * }
  630. PPCTrapMsgPort: PMsgPort;
  631. PPCTrapMessage: PTaskTrapMessage;
  632. { * This is undiscovered land...
  633. * never assume a size of this structure
  634. * }
  635. end;
  636. type
  637. PTaskInitExtension = ^TTaskInitExtension;
  638. TTaskInitExtension = record
  639. { * Must be filled with TRAP_PPCTASK
  640. * }
  641. Trap : Word;
  642. Extension: Word; { * Must be set to 0 * }
  643. Tags : Pointer;
  644. end;
  645. const
  646. TASKTAG_DUMMY = (TAG_USER + $100000);
  647. { * Ptr to an ULONG Errorfield where a better error description
  648. * can be stored.
  649. * }
  650. TASKTAG_ERROR = (TASKTAG_DUMMY + $0);
  651. { * Code type
  652. * can be stored.
  653. * }
  654. TASKTAG_CODETYPE = (TASKTAG_DUMMY + $1);
  655. { * Start PC
  656. * code must be of TASKTAG_CODETYPE
  657. * }
  658. TASKTAG_PC = (TASKTAG_DUMMY + $2);
  659. { * Final PC
  660. * code must be of TASKTAG_CODETYPE
  661. * }
  662. TASKTAG_FINALPC = (TASKTAG_DUMMY + $3);
  663. { * Stacksize...Default 8192
  664. * }
  665. TASKTAG_STACKSIZE = (TASKTAG_DUMMY + $4);
  666. { * Std Stacksize...
  667. * Default(use the stack defined by tc_SPLower..tc_SPUpper)
  668. * }
  669. TASKTAG_STACKSIZE_M68K = (TASKTAG_DUMMY + $5);
  670. { * specify task name, name is copied
  671. * }
  672. TASKTAG_NAME = (TASKTAG_DUMMY + $6);
  673. { * tc_UserData
  674. * }
  675. TASKTAG_USERDATA = (TASKTAG_DUMMY + $7);
  676. { * Task priority
  677. * }
  678. TASKTAG_PRI = (TASKTAG_DUMMY + $8);
  679. { * Pool's Puddlesize
  680. * }
  681. TASKTAG_POOLPUDDLE = (TASKTAG_DUMMY + $9);
  682. { * Pool's ThreshSize
  683. * }
  684. TASKTAG_POOLTHRESH = (TASKTAG_DUMMY + $a);
  685. { * PPC First Argument..gpr3
  686. * }
  687. TASKTAG_PPC_ARG1 = (TASKTAG_DUMMY + $10);
  688. { * PPC First Argument..gpr4
  689. * }
  690. TASKTAG_PPC_ARG2 = (TASKTAG_DUMMY + $11);
  691. { * PPC First Argument..gpr5
  692. * }
  693. TASKTAG_PPC_ARG3 = (TASKTAG_DUMMY + $12);
  694. { * PPC First Argument..gpr6
  695. * }
  696. TASKTAG_PPC_ARG4 = (TASKTAG_DUMMY + $13);
  697. { * PPC First Argument..gpr7
  698. * }
  699. TASKTAG_PPC_ARG5 = (TASKTAG_DUMMY + $14);
  700. { * PPC First Argument..gpr8
  701. * }
  702. TASKTAG_PPC_ARG6 = (TASKTAG_DUMMY + $15);
  703. { * PPC First Argument..gpr9
  704. * }
  705. TASKTAG_PPC_ARG7 = (TASKTAG_DUMMY + $16);
  706. { * PPC First Argument..gpr10
  707. * }
  708. TASKTAG_PPC_ARG8 = (TASKTAG_DUMMY + $17);
  709. { *
  710. * Startup message to be passed to task/process, ReplyMsg'd at RemTask()
  711. * ti_Data: struct Message *
  712. * }
  713. TASKTAG_STARTUPMSG = (TASKTAG_DUMMY + $18);
  714. { *
  715. * Create internal MsgPort for task/process, deleted at RemTask()
  716. * ti_Data: struct MsgPort **, can be NULL
  717. * }
  718. TASKTAG_TASKMSGPORT = (TASKTAG_DUMMY + $19);
  719. const
  720. CODETYPE_M68K = $0;
  721. { *
  722. * System V4 ABI
  723. * }
  724. CODETYPE_PPC = $1;
  725. const
  726. TASKERROR_OK = 0;
  727. TASKERROR_NOMEMORY = 1;
  728. { *
  729. * Stack swap structure as passed to StackSwap() and PPCStackSwap()
  730. * }
  731. type
  732. PStackSwapStruct = ^TStackSwapStruct;
  733. TStackSwapStruct = record
  734. stk_Lower : Pointer; { * Lowest byte of stack * }
  735. stk_Upper : Pointer; { * Upper end of stack (size + Lowert) * }
  736. stk_Pointer: Pointer; { * Stack pointer at switch point * }
  737. end;
  738. type
  739. PStackSwapArgs = ^TStackSwapArgs;
  740. TStackSwapArgs = record
  741. Args: Array[0..7] Of Pointer;
  742. end;
  743. { *
  744. * NewGetTaskAttrsA(), NewSetTaskAttrsA() tags
  745. * }
  746. const
  747. TASKINFOTYPE_ALLTASK = $0;
  748. TASKINFOTYPE_NAME = $1;
  749. TASKINFOTYPE_PRI = $2;
  750. TASKINFOTYPE_TYPE = $3;
  751. TASKINFOTYPE_STATE = $4;
  752. TASKINFOTYPE_FLAGS = $5;
  753. TASKINFOTYPE_SIGALLOC = $6;
  754. TASKINFOTYPE_SIGWAIT = $7;
  755. TASKINFOTYPE_SIGRECVD = $8;
  756. TASKINFOTYPE_SIGEXCEPT = $9;
  757. TASKINFOTYPE_EXCEPTDATA = $a;
  758. TASKINFOTYPE_EXCEPTCODE = $b;
  759. TASKINFOTYPE_TRAPDATA = $c;
  760. TASKINFOTYPE_TRAPCODE = $d;
  761. TASKINFOTYPE_STACKSIZE_M68K = $e;
  762. TASKINFOTYPE_STACKSIZE = $f;
  763. TASKINFOTYPE_USEDSTACKSIZE_M68K = $10;
  764. TASKINFOTYPE_USEDSTACKSIZE = $11;
  765. TASKINFOTYPE_TRAPMSGPORT = $12;
  766. TASKINFOTYPE_STARTUPMSG = $13;
  767. TASKINFOTYPE_TASKMSGPORT = $14;
  768. TASKINFOTYPE_POOLPTR = $15;
  769. TASKINFOTYPE_POOLMEMFLAGS = $16;
  770. TASKINFOTYPE_POOLPUDDLESIZE = $17;
  771. TASKINFOTYPE_POOLTHRESHSIZE = $18;
  772. { *
  773. * Task Scheduler statistics (exec 50.42)
  774. * }
  775. TASKINFOTYPE_NICE = $19;
  776. TASKINFOTYPE_AGETICKS = $1a;
  777. TASKINFOTYPE_CPUTIME = $1b;
  778. TASKINFOTYPE_LASTSECCPUTIME = $1c;
  779. TASKINFOTYPE_RECENTCPUTIME = $1d;
  780. TASKINFOTYPE_VOLUNTARYCSW = $1e;
  781. TASKINFOTYPE_INVOLUNTARYCSW = $1f;
  782. TASKINFOTYPE_LASTSECVOLUNTARYCSW = $20;
  783. TASKINFOTYPE_LASTSECINVOLUNTARYCSW = $21;
  784. { * Added in exec 50.45 * }
  785. TASKINFOTYPE_LAUNCHTIMETICKS = $22;
  786. TASKINFOTYPE_LAUNCHTIMETICKS1978 = $23;
  787. TASKINFOTYPE_PID = $24;
  788. TASKINFOTYPE_68K_NEWFRAME = $50;
  789. TASKINFOTYPE_PPC_SRR0 = $100;
  790. TASKINFOTYPE_PPC_SRR1 = $101;
  791. TASKINFOTYPE_PPC_LR = $102;
  792. TASKINFOTYPE_PPC_CTR = $103;
  793. TASKINFOTYPE_PPC_CR = $104;
  794. TASKINFOTYPE_PPC_XER = $105;
  795. TASKINFOTYPE_PPC_GPR = $106;
  796. TASKINFOTYPE_PPC_FPR = $107;
  797. TASKINFOTYPE_PPC_FPSCR = $108;
  798. TASKINFOTYPE_PPC_VSCR = $109;
  799. TASKINFOTYPE_PPC_VMX = $10a;
  800. TASKINFOTYPE_PPC_VSAVE = $10b;
  801. TASKINFOTYPE_PPC_FRAME = $10c;
  802. TASKINFOTYPE_PPC_FRAMESIZE = $10d;
  803. TASKINFOTYPE_PPC_NEWFRAME = $10e;
  804. TASKINFOTAG_DUMMY = (TAG_USER + $110000);
  805. { * Used with TASKINFOTYPE_ALLTASK
  806. * }
  807. TASKINFOTAG_HOOK = (TASKINFOTAG_DUMMY + $0);
  808. { * Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX
  809. * to define the copy area
  810. * }
  811. TASKINFOTAG_REGSTART = (TASKINFOTAG_DUMMY + $1);
  812. { * Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX
  813. * to define the copy area
  814. * }
  815. TASKINFOTAG_REGCOUNT = (TASKINFOTAG_DUMMY + $2);
  816. { *
  817. * NewSetTaskAttrsA(..,@TaskFrame68k,sizeof(TTaskFrame68k),TASKINFOTYPE_68K_NEWFRAME,...);
  818. * }
  819. type
  820. PTaskFrame68k = ^TTaskFrame68k;
  821. TTaskFrame68k = record
  822. PC: Pointer;
  823. SR: Word;
  824. Xn: Array[0..14] Of LongInt;
  825. end;
  826. { *
  827. * Don't depend on these
  828. * }
  829. const
  830. DEFAULT_PPCSTACKSIZE = 32768;
  831. DEFAULT_M68KSTACKSIZE = 2048;
  832. DEFAULT_TASKPUDDLESIZE = 4096;
  833. DEFAULT_TASKTHRESHSIZE = 4096;
  834. { * exec interrupt definitions
  835. *********************************************************************
  836. * }
  837. type // Checked OK 05.08.2011 ALB
  838. PInterrupt = ^TInterrupt;
  839. TInterrupt = record
  840. is_Node: TNode;
  841. is_Data: Pointer;
  842. is_Code: Pointer; // server code entry
  843. end;
  844. type // Checked OK 05.08.2011 ALB
  845. PIntVector = ^TIntVector;
  846. TIntVector = record
  847. iv_Data: Pointer;
  848. iv_Code: Pointer;
  849. iv_Node: PNode;
  850. end;
  851. type // Checked OK 05.08.2011 ALB
  852. PSoftIntList = ^TSoftIntList;
  853. TSoftIntList = record
  854. sh_List: TEList;
  855. sh_Pad : Word;
  856. end;
  857. const // Checked OK 05.08.2011 ALB
  858. SIH_PRIMASK = $f0;
  859. INTB_NMI = 15;
  860. INTF_NMI = (1 Shl INTB_NMI);
  861. { * exec semaphore definitions (V50)
  862. *********************************************************************
  863. * }
  864. { *
  865. * Shouldn't be available public..
  866. * }
  867. type
  868. PSemaphoreRequest = ^TSemaphoreRequest;
  869. TSemaphoreRequest = record
  870. sr_Link : TMinNode;
  871. sr_Waiter: PTask;
  872. end;
  873. type
  874. PSignalSemaphore = ^TSignalSemaphore;
  875. TSignalSemaphore = record
  876. ss_Link : TNode;
  877. ss_NestCount : SmallInt;
  878. ss_WaitQueue : TMinList;
  879. ss_MultipleLink: TSemaphoreRequest;
  880. ss_Owner : PTask;
  881. ss_QueueCount : SmallInt;
  882. end;
  883. type
  884. PSemaphoreMessage = ^TSemaphoreMessage;
  885. TSemaphoreMessage = record
  886. ssm_Message : TMessage;
  887. ssm_Semaphore: PSignalSemaphore;
  888. end;
  889. const
  890. SM_SHARED = 1;
  891. SM_EXCLUSIVE = 0;
  892. { * exec machine definitions (V50)
  893. *********************************************************************
  894. * }
  895. const
  896. MACHINE_M68k = $0;
  897. MACHINE_PPC = $1;
  898. MACHINE_NO = $ffffffff;
  899. { * exec library definitions
  900. *********************************************************************
  901. * }
  902. const // Checked OK 05.08.2011 ALB
  903. LIB_VECTSIZE = 6;
  904. LIB_RESERVED = 4;
  905. LIB_BASE = (-LIB_VECTSIZE);
  906. LIB_USERDEF = (LIB_BASE - (LIB_RESERVED * LIB_VECTSIZE));
  907. LIB_NONSTD = (LIB_USERDEF);
  908. LIB_OPEN = (LIB_BASE * 1);
  909. LIB_CLOSE = (LIB_BASE * 2);
  910. LIB_EXPUNGE = (LIB_BASE * 3);
  911. LIB_EXTFUNC = (LIB_BASE * 4);
  912. type // Checked OK 05.08.2011 ALB
  913. PLibrary = ^TLibrary;
  914. TLibrary = record
  915. lib_Node : TNode;
  916. lib_Flags : Byte;
  917. lib_pad : Byte;
  918. lib_NegSize : Word;
  919. lib_PosSize : Word;
  920. lib_Version : Word;
  921. lib_Revision: Word;
  922. lib_IdString: PChar;
  923. lib_Sum : DWord;
  924. lib_OpenCnt : Word;
  925. end;
  926. const // Checked OK 05.08.2011 ALB
  927. LIBF_SUMMING = (1 shl 0);
  928. LIBF_CHANGED = (1 shl 1);
  929. LIBF_SUMUSED = (1 shl 2);
  930. LIBF_DELEXP = (1 shl 3);
  931. const // Checked OK 05.08.2011 ALB
  932. {* ID numbers for Exec/TaggedOpenLibrary
  933. *}
  934. TAGGEDOPEN_GRAPHICS = 1;
  935. TAGGEDOPEN_LAYERS = 2;
  936. TAGGEDOPEN_INTUITION = 3;
  937. TAGGEDOPEN_DOS = 4;
  938. TAGGEDOPEN_ICON = 5;
  939. TAGGEDOPEN_EXPANSION = 6;
  940. TAGGEDOPEN_UTILITY = 7;
  941. TAGGEDOPEN_KEYMAP = 8;
  942. TAGGEDOPEN_GADTOOLS = 9;
  943. TAGGEDOPEN_WORKBENCH = 10;
  944. const
  945. SETFUNCTAG_Dummy = (TAG_USER +$01000000);
  946. { * Set the machine type of the function
  947. * Default is 68k
  948. * }
  949. SETFUNCTAG_MACHINE = (SETFUNCTAG_Dummy + $1);
  950. { * Function type specifier
  951. * }
  952. SETFUNCTAG_TYPE = (SETFUNCTAG_Dummy + $2);
  953. { * ID String
  954. * }
  955. SETFUNCTAG_IDNAME = (SETFUNCTAG_Dummy + $3);
  956. { *
  957. * Set to TRUE if the replaced function will never be used
  958. * again.
  959. * }
  960. SETFUNCTAG_DELETE = (SETFUNCTAG_Dummy + $4);
  961. { * See emul/emulinterface.h for more informations
  962. * }
  963. { * Save Emulation PPC Registers
  964. * Call Function
  965. * Restore Emulation PPC Registers
  966. * REG_D0 = Result
  967. * }
  968. const
  969. SETFUNCTYPE_NORMAL = 0;
  970. { * Call Function
  971. * Must use the global register settings of the emulation
  972. * REG_D0 = Result
  973. * }
  974. SETFUNCTYPE_QUICK = 1;
  975. { * Save Emulation PPC Registers
  976. * Call Function
  977. * Restore Emulation PPC Registers
  978. * No Result
  979. * Needed to replace functions like
  980. * forbid,obtainsemaphores which are
  981. * defined as trashing no registers
  982. * }
  983. SETFUNCTYPE_NORMALNR = 2;
  984. { * Call Function
  985. * Must use the global register settings of the emulation
  986. * No Result
  987. * Needed to replace functions like
  988. * forbid,obtainsemaphores which are
  989. * defined as trashing no registers
  990. * }
  991. SETFUNCTYPE_QUICKNR = 3;
  992. SETFUNCTYPE_NORMALSR = 4;
  993. SETFUNCTYPE_NORMALSRNR = 5;
  994. SETFUNCTYPE_NORMALD0_D1 = 6;
  995. SETFUNCTYPE_NORMALRESTORE = 7;
  996. SETFUNCTYPE_SYSTEMV = 8;
  997. SETFUNCTYPE_NORMALD0D1SR = 9;
  998. SETFUNCTYPE_NORMALD0D1A0A1SR = 10;
  999. { * CreateLibrary extensions
  1000. * }
  1001. LIBTAG_BASE = (TAG_USER + $01000100);
  1002. { *
  1003. * Function/Vector Array
  1004. * }
  1005. LIBTAG_FUNCTIONINIT = (LIBTAG_BASE+$0);
  1006. { *
  1007. * Struct Init
  1008. * }
  1009. LIBTAG_STRUCTINIT = (LIBTAG_BASE+$1);
  1010. { *
  1011. * Library Init
  1012. * }
  1013. LIBTAG_LIBRARYINIT = (LIBTAG_BASE+$2);
  1014. { *
  1015. * Init Code Type
  1016. * }
  1017. LIBTAG_MACHINE = (LIBTAG_BASE+$3);
  1018. { *
  1019. * Library Base Size
  1020. * }
  1021. LIBTAG_BASESIZE = (LIBTAG_BASE+$4);
  1022. { *
  1023. * SegList Ptr
  1024. * }
  1025. LIBTAG_SEGLIST = (LIBTAG_BASE+$5);
  1026. { *
  1027. * Library Priority
  1028. * }
  1029. LIBTAG_PRI = (LIBTAG_BASE+$6);
  1030. { *
  1031. * Library Type..Library,Device,Resource,whatever
  1032. * }
  1033. LIBTAG_TYPE = (LIBTAG_BASE+$7);
  1034. { *
  1035. * Library Version
  1036. * (UWORD)
  1037. * }
  1038. LIBTAG_VERSION = (LIBTAG_BASE+$8);
  1039. { *
  1040. * Library Flags
  1041. * }
  1042. LIBTAG_FLAGS = (LIBTAG_BASE+$9);
  1043. { *
  1044. * Library Name
  1045. * }
  1046. LIBTAG_NAME = (LIBTAG_BASE+$a);
  1047. { *
  1048. * Library IDString
  1049. * }
  1050. LIBTAG_IDSTRING = (LIBTAG_BASE+$b);
  1051. { *
  1052. * AddDevice(),AddLibrary(),AddResource()..
  1053. * depends on LibNode.ln_Type field which
  1054. * can be set by some Init function, Struct Scripts
  1055. * or LIBTAG_TYPE.
  1056. * If you set LIBTAG_PUBLIC the library
  1057. * is added to the right system list.
  1058. * }
  1059. LIBTAG_PUBLIC = (LIBTAG_BASE+$c);
  1060. { *
  1061. * Library Revision
  1062. * (UWORD)
  1063. * }
  1064. LIBTAG_REVISION = (LIBTAG_BASE+$d);
  1065. { *
  1066. * Library QueryInfo Flag
  1067. * (Boolean)
  1068. * }
  1069. LIBTAG_QUERYINFO = (LIBTAG_BASE+$e);
  1070. { * Private
  1071. * don`t touch...floating design
  1072. * }
  1073. {
  1074. type
  1075. PFuncEntry = ^TFuncEntry;
  1076. TFuncEntry = record
  1077. EmulLibEntry : TEmulLibEntry;
  1078. OldFunction : Pointer; { * Needed for bookkeeping * }
  1079. end;
  1080. PFuncOldEntry = ^TFuncOldEntry;
  1081. TFuncOldEntry = record
  1082. Command : Word;
  1083. FuncEntry: PFuncEntry;
  1084. end;
  1085. }
  1086. { *
  1087. * EmulLibEntry.Extension
  1088. * }
  1089. const
  1090. FUNCENTRYEXTF_LIBRARY = $1; { * Entry created by the OS * }
  1091. { *
  1092. * Functionarray first ULONG ID defines the format
  1093. * of the functionarray for MakeFunctions()/MakeLibrary().
  1094. *
  1095. * If there`s not such id the functionarray is a
  1096. * 32Bit 68k function ptr array.
  1097. * (ULONG) $ffffffff stops it
  1098. * }
  1099. { * 68k 16bit relative functionarray ptrs
  1100. * (UWORD) $ffff stops it
  1101. * }
  1102. FUNCARRAY_16BIT_OLD = $ffffffff;
  1103. { * PPC 32bit functionarray ptrs
  1104. * (ULONG) $ffff stops it
  1105. * }
  1106. FUNCARRAY_32BIT_NATIVE = $fffefffe;
  1107. { * Starts a functionarray block.
  1108. * This way it`s possible to mix 68k and PPC
  1109. * function definitions.
  1110. * BASE:
  1111. * FUNCTIONARRAY_BEGIN
  1112. * FUNCARRAY_32BIT_NATIVE
  1113. * FUNC0
  1114. * FUNC1
  1115. * .
  1116. * FUNCn
  1117. * $ffffffff
  1118. * FUNCn+1 (No ID->32Bit 68k)
  1119. * FUNCn+2
  1120. * .
  1121. * FUNCm
  1122. * $ffffffff
  1123. * FUNCARRAY_16BIT_OLD
  1124. * FUNCm+1-BASE
  1125. * FUNCm+2-BASE
  1126. * .
  1127. * FUNCo-BASE
  1128. * $ffff
  1129. * FUNCTIONARRAY_END
  1130. * }
  1131. FUNCARRAY_BEGIN = $fffdfffd;
  1132. { * Ends a functionarray block.
  1133. * }
  1134. FUNCARRAY_END = $fffcfffc;
  1135. { * PPC 32bit Quick functionarray ptrs.
  1136. * These functions must comply to the emulation's
  1137. * register layout which is defined inside the
  1138. * emul/emulregs.h. That means the register layout
  1139. * MUST also be valid during interrupts/task switches.
  1140. * You can't just destroy A7(r31), SR or PC.
  1141. *
  1142. * You shouldn't use this for any normal code
  1143. * as there's no real reason to do so. If you
  1144. * really think you need to use it please ask
  1145. * us first on the dev mailinglist.
  1146. * (ULONG) $ffffffff stops it
  1147. * }
  1148. FUNCARRAY_32BIT_QUICK_NATIVE = $fffbfffb;
  1149. { * PPC 32bit QuickNR(No Result) functionarray ptrs
  1150. * (ULONG) $ffffffff stops it
  1151. * }
  1152. FUNCARRAY_32BIT_QUICKNR_NATIVE = $fffafffa;
  1153. { * PPC 32bit no result functionarray ptrs
  1154. * (ULONG) $ffffffff stops it
  1155. * }
  1156. FUNCARRAY_32BIT_NR_NATIVE = $fff9fff9;
  1157. { * PPC 32bit SR functionarray ptrs
  1158. * (ULONG) $ffffffff stops it
  1159. * }
  1160. FUNCARRAY_32BIT_SR_NATIVE = $fff8fff8;
  1161. { * PPC 32bit SR(no result) functionarray ptrs
  1162. * (ULONG) $ffffffff stops it
  1163. * }
  1164. FUNCARRAY_32BIT_SRNR_NATIVE = $fff7fff7;
  1165. { * PPC 32bit D0_D1 functionarray ptrs
  1166. * (ULONG) $ffffffff stops it
  1167. * }
  1168. FUNCARRAY_32BIT_D0D1_NATIVE = $fff6fff6;
  1169. { * PPC 32bit Restore1 functionarray ptrs
  1170. * (ULONG) $ffffffff stops it
  1171. * }
  1172. FUNCARRAY_32BIT_RESTORE_NATIVE = $fff5fff5;
  1173. { * PPC 32bit SystemV ABI entry
  1174. * these function entries DON'T comply
  1175. * to the amiga register modell REG_D0-A6
  1176. * but comply to the PPC SystemV ABI so
  1177. * you can directly use PPC C Argument
  1178. * parsing. That way you're also not limited
  1179. * with the register count.
  1180. * Such library functions can't be used
  1181. * by 68k emulation, so you can only use
  1182. * them for new code.
  1183. * As we allow these new functions to be
  1184. * used with old functions we keep the
  1185. * 6 bytes function entry steps in the library.
  1186. * Layout is
  1187. *
  1188. * CODE_JMP, &FuncEntry ; Old Entry
  1189. * CODE_ILLEGAL, Function ; SystemV ABI Entry
  1190. *
  1191. *
  1192. * (ULONG) $ffffffff stops it
  1193. * }
  1194. FUNCARRAY_32BIT_SYSTEMV = $fff4fff4;
  1195. { * PPC 32bit D0D1SR functionarray ptrs
  1196. * (ULONG) $ffffffff stops it
  1197. * }
  1198. FUNCARRAY_32BIT_D0D1SR_NATIVE = $fff3fff3;
  1199. { * PPC 32bit D0D1A0A1SR functionarray ptrs
  1200. * (ULONG) $ffffffff stops it
  1201. * }
  1202. FUNCARRAY_32BIT_D0D1A0A1SR_NATIVE = $fff2fff2;
  1203. { * exec device definitions
  1204. *********************************************************************
  1205. * }
  1206. type // Checked OK 04.08.2011 ALB
  1207. PDevice = ^TDevice;
  1208. TDevice = record
  1209. dd_Library: TLibrary;
  1210. end;
  1211. type // Checked OK 04.08.2011 ALB
  1212. PUnit = ^TUnit;
  1213. TUnit = record
  1214. unit_MsgPort: TMsgPort;
  1215. unit_flags : Byte;
  1216. unit_pad : Byte;
  1217. unit_OpenCnt: Word;
  1218. end;
  1219. const // Checked OK 04.08.2011 ALB
  1220. UNITF_ACTIVE = (1 shl 0);
  1221. UNITF_INTASK = (1 shl 1);
  1222. { * exec io definitions
  1223. *********************************************************************
  1224. * }
  1225. type // Checked OK 05.08.2011 ALB
  1226. PIORequest = ^TIORequest;
  1227. TIORequest = record
  1228. io_Message: TMessage;
  1229. io_Device : PDevice;
  1230. io_Unit : PUnit;
  1231. io_Command: Word;
  1232. io_Flags : Byte;
  1233. io_Error : ShortInt;
  1234. end;
  1235. type // Checked OK 05.08.2011 ALB
  1236. PIOStdReq = ^TIOStdReq;
  1237. TIOStdReq = record
  1238. io_Message: TMessage;
  1239. io_Device : PDevice;
  1240. io_Unit : PUnit;
  1241. io_Command: Word;
  1242. io_Flags : Byte;
  1243. io_Error : ShortInt;
  1244. io_Actual : DWord;
  1245. io_Length : DWord;
  1246. io_Data : Pointer;
  1247. io_Offset : DWord;
  1248. end;
  1249. const // Checked OK 05.08.2011 ALB
  1250. DEV_BEGINIO = -30;
  1251. DEV_ABORTIO = -36;
  1252. IOB_QUICK = 0;
  1253. IOF_QUICK = (1 Shl IOB_QUICK);
  1254. CMD_INVALID = 0;
  1255. CMD_RESET = 1;
  1256. CMD_READ = 2;
  1257. CMD_WRITE = 3;
  1258. CMD_UPDATE = 4;
  1259. CMD_CLEAR = 5;
  1260. CMD_STOP = 6;
  1261. CMD_START = 7;
  1262. CMD_FLUSH = 8;
  1263. CMD_NONSTD = 9;
  1264. type
  1265. PArosSupportBase = ^TArosSupportBase;
  1266. TArosSupportBase = record
  1267. StdOut: Pointer;
  1268. kPrintfPtr: Pointer;
  1269. rkPrintfPtr: Pointer;
  1270. vkPrintfPtr: Pointer;
  1271. DebugConfig: Pointer;
  1272. end;
  1273. { * exec include
  1274. *********************************************************************
  1275. * }
  1276. type // Checked OK 05.08.2011 ALB
  1277. PExecBase = ^TExecBase;
  1278. TExecBase = record
  1279. // lib structure for Exec
  1280. LIbNode : TLibrary;
  1281. // system constants
  1282. SoftVer : Word; // obsolete
  1283. LowMemChkSum: SmallInt;
  1284. ChkBase : PtrUInt;
  1285. ColdCapture : Pointer;
  1286. CoolCapture : Pointer;
  1287. WarmCapture : Pointer;
  1288. SysStkUpper : Pointer; // System Stack Bounds
  1289. SysStkLower : Pointer;
  1290. MaxLocMem : PtrUInt; // Chip Memory Pointer
  1291. DebugEntry : Pointer;
  1292. DebugData : Pointer;
  1293. AlertData : Pointer;
  1294. MaxExtMem : Pointer; // Extended Memory Pointer (may be nil)
  1295. ChkSum : Word; // SoftVer to MaxExtMem
  1296. // interrupts
  1297. IntVects : Array[0..15] Of TIntVector;
  1298. // System Variables
  1299. ThisTask : PTask; // Pointer to currently running Task READONLY
  1300. IdleCount : DWord;
  1301. DispCount : DWord;
  1302. Quantum : Word; // # of ticks a task may run
  1303. Elapsed : Word; // # of ticks the current task has run
  1304. SysFlags : Word;
  1305. IDNestCnt : ShortInt;
  1306. TDNestCnt : ShortInt;
  1307. AttnFlags : Word; // Attention Flags .. se below
  1308. AttnResched : Word;
  1309. ResModules : Pointer;
  1310. TaskTrapCode : Pointer;
  1311. TaskExceptCode: Pointer;
  1312. TaskExitCode : Pointer;
  1313. TaskSigAlloc : DWord;
  1314. TaskTrapAlloc : Word;
  1315. // Private Lists
  1316. MemList : TEList;
  1317. ResourceList: TEList;
  1318. DeviceList : TEList;
  1319. IntrList : TEList;
  1320. LibList : TEList;
  1321. PortList : TEList;
  1322. TaskReady : TEList;
  1323. TaskWait : TEList;
  1324. SoftInts : Array[0..4] Of TSoftIntList;
  1325. //stuff
  1326. LastAlert : Array[0..3] Of LongInt;
  1327. VBlankFrequency : Byte;
  1328. PowerSupplyFrequency: Byte; // AROS PRIVATE: VBlankFreq * PowerSupplyFreq = Timer Tick Rate
  1329. SemaphoreList : TEList;
  1330. // Kickstart
  1331. KickMemPtr : Pointer;
  1332. KickTagPtr : Pointer;
  1333. KickCheckSum : Pointer;
  1334. // Miscellaneous stuff
  1335. ex_Pad0 : Word;
  1336. ex_LaunchPoint : PtrUInt;
  1337. ex_RamLibPrivate : Pointer;
  1338. ex_EClockFrequency : DWord;
  1339. ex_CacheControl : DWord;
  1340. ex_TaskID : DWord;
  1341. ex_Reserved1 : Array[0..4] Of DWord;
  1342. ex_MMULock : Pointer;
  1343. ex_Reserved2 : Array[0..1] Of DWord;
  1344. ex_DebugFlags : DWord; { * Exec Debug Flags..*private* * }
  1345. ex_MemHandlers : TMinList;
  1346. ex_MemHandler : Pointer;
  1347. // Additional field for AROS
  1348. DebugAROSBase : PArosSupportBase;
  1349. end;
  1350. { *
  1351. * Outdated 68k cpu informations
  1352. *
  1353. * }
  1354. const // Checked OK 05.08.2011 ALB
  1355. AFB_68010 = 0;
  1356. AFB_68020 = 1;
  1357. AFB_68030 = 2;
  1358. AFB_68040 = 3;
  1359. AFB_68881 = 4;
  1360. AFB_68882 = 5;
  1361. AFB_FPU40 = 6;
  1362. AFB_68060 = 7;
  1363. AFB_PRIVATE = 15;
  1364. AFF_68010 = (1 shl AFB_68010);
  1365. AFF_68020 = (1 shl AFB_68020);
  1366. AFF_68030 = (1 shl AFB_68030);
  1367. AFF_68040 = (1 shl AFB_68040);
  1368. AFF_68881 = (1 shl AFB_68881);
  1369. AFF_68882 = (1 shl AFB_68882);
  1370. AFF_FPU40 = (1 shl AFB_FPU40);
  1371. AFF_68060 = (1 shl AFB_68060);
  1372. AFF_PRIVATE = (1 shl AFB_PRIVATE);
  1373. { *
  1374. * Outdated 68k cache functionality
  1375. * Mostly without function.
  1376. * }
  1377. const // Checked OK 05.08.2011 ALB
  1378. CACRF_EnableI = (1 shl 0);
  1379. CACRF_FreezeI = (1 shl 1);
  1380. CACRF_ClearI = (1 shl 3);
  1381. CACRF_IBE = (1 shl 4);
  1382. CACRF_EnableD = (1 shl 8);
  1383. CACRF_FreezeD = (1 shl 9);
  1384. CACRF_ClearD = (1 shl 11);
  1385. CACRF_DBE = (1 shl 12);
  1386. CACRF_WriteAllocate = (1 shl 13);
  1387. CACRF_EnableE = (1 shl 30);
  1388. CACRF_CopyBack = (1 shl 31);
  1389. DMA_Continue = (1 shl 1);
  1390. DMA_NoModify = (1 shl 2);
  1391. DMA_ReadFromRAM = (1 shl 3);
  1392. (*
  1393. SB_SAR = 15;
  1394. SB_TQE = 14;
  1395. SB_SINT = 13;
  1396. SF_SAR = (1 shl SB_SAR);
  1397. SF_TQE = (1 shl SB_TQE);
  1398. SF_SINT = (1 shl SB_SINT);
  1399. *)
  1400. { ****** Debug Flags...(don`t depend on them) ********** }
  1401. const // Checked OK 05.08.2011 ALB
  1402. EXECDEBUGF_INITRESIDENT = $1;
  1403. EXECDEBUGF_INITCODE = $2;
  1404. EXECDEBUGF_FINDRESIDENT = $4;
  1405. EXECDEBUGF_CREATELIBRARY = $10;
  1406. EXECDEBUGF_SETFUNCTION = $20;
  1407. EXECDEBUGF_NEWSETFUNCTION = $40;
  1408. EXECDEBUGF_CHIPRAM = $80;
  1409. EXECDEBUGF_ADDTASK = $100;
  1410. EXECDEBUGF_REMTASK = $200;
  1411. EXECDEBUGF_GETTASKATTR = $400;
  1412. EXECDEBUGF_SETTASKATTR = $800;
  1413. EXECDEBUGF_EXCEPTHANDLER = $1000;
  1414. EXECDEBUGF_ADDDOSNODE = $2000;
  1415. EXECDEBUGF_PCI = $4000;
  1416. EXECDEBUGF_RAMLIB = $8000;
  1417. EXECDEBUGF_NOLOGSERVER = $10000;
  1418. EXECDEBUGF_NOLOGWINDOW = $20000;
  1419. { *
  1420. * "env:MorphOS/LogPath" contains the logfile path,
  1421. * If not specified it`s using "ram:.morphoslog"
  1422. * }
  1423. EXECDEBUGF_LOGFILE = $40000;
  1424. EXECDEBUGF_LOGKPRINTF = $80000;
  1425. { * Memory Tracking Flags
  1426. * }
  1427. EXECDEBUGF_PERMMEMTRACK = $100000;
  1428. EXECDEBUGF_MEMTRACK = $200000;
  1429. { * CyberGuardPPC Flags
  1430. * }
  1431. EXECDEBUGF_CYBERGUARDDEADLY = $400000;
  1432. { * PPCLib Flags
  1433. * }
  1434. EXECDEBUGF_LOADSEG = $01000000;
  1435. EXECDEBUGF_UNLOADSEG = $02000000;
  1436. EXECDEBUGF_PPCSTART = $04000000;
  1437. { * UserFlags
  1438. * }
  1439. { *
  1440. * Enables debug output for cybergraphx
  1441. * }
  1442. const // Checked OK 05.08.2011 ALB
  1443. EXECDEBUGF_CGXDEBUG = $08000000;
  1444. { *
  1445. * Should be used to control user LibInit/DevInit Debug output
  1446. * }
  1447. EXECDEBUGF_INIT = $40000000;
  1448. { *
  1449. * Should be used to control logging
  1450. * }
  1451. EXECDEBUGF_LOG = $80000000;
  1452. {*
  1453. * The following definitions are private!
  1454. *}
  1455. const // Checked OK 05.08.2011 ALB
  1456. // SysFlags
  1457. SFF_SoftInt = (1 shl 5); // There is a software interrupt
  1458. SFF_QuantumOver = (1 shl 13); // Task's time slice is over
  1459. // AttnFlags
  1460. ARF_AttnSwitch = (1 shl 7); // Delayed Switch() pending
  1461. ARF_AttnDispatch = (1 shl 15); // Delayed Dispatch() pending
  1462. const
  1463. { *
  1464. * Execbase list IDs
  1465. * }
  1466. EXECLIST_DEVICE = 0;
  1467. EXECLIST_INTERRUPT = 1;
  1468. EXECLIST_LIBRARY = 2;
  1469. EXECLIST_MEMHANDLER = 3;
  1470. EXECLIST_MEMHEADER = 4;
  1471. EXECLIST_PORT = 5;
  1472. EXECLIST_RESOURCE = 6;
  1473. EXECLIST_SEMAPHORE = 7;
  1474. EXECLIST_TASK = 8;
  1475. { *
  1476. * Execnotify hook message
  1477. * }
  1478. type
  1479. PExecNotifyMessage = ^TExecNotifyMessage;
  1480. TExecNotifyMessage = record
  1481. MType : DWord;
  1482. Flags : DWord;
  1483. Extra : DWord;
  1484. Extension: Pointer;
  1485. end;
  1486. const
  1487. EXECNOTIFYF_REMOVE = (1 Shl 0); { * if clear, is ADD * }
  1488. EXECNOTIFYF_POST = (1 Shl 1); { * if clear, is PRE * }
  1489. { *
  1490. * AddExecNodeTagList tags
  1491. * }
  1492. const
  1493. SAL_Dummy = (TAG_USER + 1000);
  1494. SAL_Type = (SAL_Dummy + 1);
  1495. SAL_Priority = (SAL_Dummy + 2);
  1496. SAL_Name = (SAL_Dummy + 3);
  1497. {$include utild2.inc}