exec.pas 76 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2004 Karoly Balogh for Genesi S.a.r.l. <www.genesi.lu>
  4. exec.library interface unit for MorphOS/PowerPC
  5. MorphOS port was done on a free Pegasos II/G4 machine
  6. provided by Genesi S.a.r.l. <www.genesi.lu>
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. unit exec;
  14. interface
  15. var
  16. ExecBase: Pointer;
  17. { Some types for classic Amiga and AROS compatibility }
  18. type
  19. STRPTR = PChar;
  20. WSTRPTR = PWideChar;
  21. ULONG = Longword;
  22. LONG = Longint;
  23. APTR = Pointer;
  24. BPTR = Longint;
  25. BSTR = Longint;
  26. BOOL = Smallint; { I think this could be changed to WordBool (KB) }
  27. UWORD = Word;
  28. WORDBITS = Word;
  29. LONGBITS = Longword;
  30. PLONGBITS = ^LONGBITS;
  31. UBYTE = Byte;
  32. PULONG = ^Longword;
  33. PAPTR = ^APTR;
  34. PLONG = ^LONG;
  35. // some AROS stuff
  36. IPTR = PtrUInt;
  37. SIPTR = PtrInt;
  38. { Some constants for classic Amiga and AROS compatibility }
  39. const
  40. LTrue : Longint = 1;
  41. LFalse : Longint = 0;
  42. { * emulinterface consts from MorphOS SDK * }
  43. const
  44. TRAP_MASK = $00ff;
  45. TRAP_AREA_START = $ff00; { * $ff00 .. $ffff area * }
  46. TRAP_LIB = $ff00;
  47. TRAP_LIB_QUICK = $ff01;
  48. TRAP_LIBNR = $ff05;
  49. TRAP_LIBNR_QUICK = $ff06;
  50. TRAP_ISYNC = $ff0f;
  51. TRAP_SYNC = $ff10;
  52. TRAP_EIEIO = $ff11;
  53. TRAP_LIBSR = $ff12;
  54. TRAP_LIBSRNR = $ff13;
  55. TRAP_LIBD0_D1 = $ff14;
  56. TRAP_LIBRESTORE = $ff15;
  57. TRAP_LIBD0D1SR = $ff17;
  58. TRAP_LIBD0D1A0A1SR = $ff18;
  59. const
  60. EMULTAG_NAME = $0; { * Gives back a Name Ptr * }
  61. EMULTAG_VERSION = $1; { * Gives back a Version * }
  62. EMULTAG_REVISION = $2; { * Gives back a Revision * }
  63. EMULTAG_OPCODETABLE = $3; { * Gives back the 16 Bit Opcodetable Ptr or NULL * }
  64. EMULTAG_TYPE = $4; { * Gives back the emulation type * }
  65. EMULTAG_EMULHANDLE = $5; { * Gives back the EmulHandle Ptr * }
  66. EMULTAG_EMULHANDLESIZE = $6; { * Gives back the EmulHandle Size * }
  67. EMULTAG_SUPERHANDLE = $7; { * Gives back the SuperHandle Ptr * }
  68. EMULTAG_SUPERHANDLESIZE = $8; { * Gives back the SuperHandle Size * }
  69. { * emulinterface structures from MorphOS SDK * }
  70. type
  71. PEmulLibEntry = ^TEmulLibEntry;
  72. TEmulLibEntry = packed record
  73. Trap : Word;
  74. Extension: Word; { * MUST be set to 0 if you create it by hand * }
  75. Func : Pointer;
  76. end;
  77. type
  78. TEmulRegs = (regD0,regD1,regD2,regD3,regD4,regD5,regD6,regD7,regA0,regA1,regA2,regA3,regA4,regA5,regA6,regA7,regPC,regSR);
  79. type
  80. PEmulHandle = ^TEmulHandle;
  81. TEmulHandle = packed record
  82. reg: array[TEmulRegs] of LongWord; {* 0x00-0x44 68k emulation registers *}
  83. SuperHandle: Pointer; {* 0x48 pointer to SuperHandle *}
  84. _Type: ULONG; {* 0x4c EmulHandle type *}
  85. Flags: ULONG; {* 0x50 Flags *}
  86. EmulFunc: procedure; cdecl; {* 0x54 *}
  87. EmulCallOS: function(EmulCaos: pointer): ULONG; cdecl; {* 0x58 *}
  88. EmulCall68k: function(EmulCaos: pointer): ULONG; cdecl; {* 0x5c *}
  89. EmulCallQuick68k: function(EmulCaos: pointer): ULONG; cdecl; {* 0x60 *}
  90. EmulCallDirectOS: function(arg: LONG): ULONG; cdecl; {* 0x64 *}
  91. EmulCallDirect68k: function(arg: Pointer): ULONG; cdecl; {* 0x68 *}
  92. OldEmulHandle: PEmulHandle; {* 0x6c Here we record the previous EmulHandle *}
  93. { * TODO: but wait, there's more... * }
  94. end;
  95. function GetEmulHandle: PEmulHandle;
  96. function REG_D0: DWord;
  97. function REG_D1: DWord;
  98. function REG_D2: DWord;
  99. function REG_D3: DWord;
  100. function REG_D4: DWord;
  101. function REG_D5: DWord;
  102. function REG_D6: DWord;
  103. function REG_D7: DWord;
  104. function REG_A0: Pointer;
  105. function REG_A1: Pointer;
  106. function REG_A2: Pointer;
  107. function REG_A3: Pointer;
  108. function REG_A4: Pointer;
  109. function REG_A5: Pointer;
  110. function REG_A6: Pointer;
  111. function REG_A7: Pointer;
  112. function REG_PC: Pointer;
  113. function REG_SR: DWord;
  114. { * "dummy" definitions from utility, which we can't include here because it
  115. * would create a circular dependency (KB) }
  116. type
  117. PTagItem = Pointer;
  118. PHook = Pointer;
  119. { * exec node definitions (V50)
  120. *********************************************************************
  121. * }
  122. type
  123. PNode = ^TNode;
  124. TNode = packed record
  125. ln_Succ: PNode;
  126. ln_Pred: PNode;
  127. ln_Type: Byte;
  128. ln_Pri : ShortInt;
  129. ln_Name: PChar;
  130. end;
  131. type
  132. PMinNode = ^TMinNode;
  133. TMinNode = packed record
  134. mln_Succ: PMinNode;
  135. mln_Pred: PMinNode;
  136. end;
  137. const
  138. NT_UNKNOWN = 0;
  139. NT_TASK = 1;
  140. NT_INTERRUPT = 2;
  141. NT_DEVICE = 3;
  142. NT_MSGPORT = 4;
  143. NT_MESSAGE = 5;
  144. NT_FREEMSG = 6;
  145. NT_REPLYMSG = 7;
  146. NT_RESOURCE = 8;
  147. NT_LIBRARY = 9;
  148. NT_MEMORY = 10;
  149. NT_SOFTINT = 11;
  150. NT_FONT = 12;
  151. NT_PROCESS = 13;
  152. NT_SEMAPHORE = 14;
  153. NT_SIGNALSEM = 15;
  154. NT_BOOTNODE = 16;
  155. NT_KICKMEM = 17;
  156. NT_GRAPHICS = 18;
  157. NT_DEATHMESSAGE = 19;
  158. NT_USER = 254;
  159. NT_EXTENDED = 255;
  160. { * exec list definitions (V50)
  161. *********************************************************************
  162. * }
  163. type
  164. PList = ^TList;
  165. TList = packed record
  166. lh_Head : PNode;
  167. lh_Tail : PNode;
  168. lh_TailPred: PNode;
  169. lh_Type : Byte;
  170. lh_pad : Byte;
  171. end;
  172. type
  173. PMinList = ^TMinList;
  174. TMinList = packed record
  175. mlh_Head : PMinNode;
  176. mlh_Tail : PMinNode;
  177. mlh_TailPred: PMinNode;
  178. end;
  179. { * exec error definitions (V50)
  180. *********************************************************************
  181. * }
  182. const
  183. IOERR_OPENFAIL = -1;
  184. IOERR_ABORTED = -2;
  185. IOERR_NOCMD = -3;
  186. IOERR_BADLENGTH = -4;
  187. IOERR_BADADDRESS = -5;
  188. IOERR_UNITBUSY = -6;
  189. IOERR_SELFTEST = -7;
  190. IOERR_NOMEMORY = -8;
  191. { * exec resident definitions (V50)
  192. *********************************************************************
  193. * }
  194. type
  195. PResident = ^TResident;
  196. TResident = packed record
  197. rt_MatchWord: Word;
  198. rt_MatchTag : PResident;
  199. rt_EndSkip : APTR;
  200. rt_Flags : Byte;
  201. rt_Version : Byte;
  202. rt_Type : Byte;
  203. rt_Pri : ShortInt;
  204. rt_Name : PChar;
  205. rt_IdString : PChar;
  206. rt_Init : APTR;
  207. // Only valid when RTF_EXTENDED is set
  208. rt_Revision : Word; // Revision Entry
  209. rt_Tags : PTagItem;
  210. end;
  211. const
  212. RTC_MATCHWORD = $4AFC;
  213. RTF_AUTOINIT = 1 Shl 7;
  214. RTF_EXTENDED = 1 Shl 6; { * structure extension is valid * }
  215. { rt_Init points to a PPC function which must be defined as
  216. function LIB_Init(MyLibBase: PLibrary, SegList: BPTR; SysBase: PExecBase): PLibrary;}
  217. RTF_PPC = 1 Shl 3;
  218. RTF_AFTERDOS = 1 Shl 2;
  219. RTF_SINGLETASK = 1 Shl 1;
  220. RTF_COLDSTART = 1 Shl 0;
  221. RTW_NEVER = 0;
  222. RTW_COLDSTART = 1;
  223. { * exec memory definitions (V50)
  224. *********************************************************************
  225. * }
  226. type
  227. PMemChunk = ^TMemChunk;
  228. TMemChunk = packed record
  229. mc_Next : PMemChunk;
  230. mc_Bytes: LongWord;
  231. end;
  232. type
  233. PMemHeader = ^TMemHeader;
  234. TMemHeader = packed record
  235. mh_Node : TNode;
  236. mh_Attributes: Word;
  237. mh_First : PMemChunk;
  238. mh_Lower : APTR;
  239. mh_Upper : APTR;
  240. mh_Free : LongWord;
  241. end;
  242. type
  243. PMemEntry = ^TMemEntry;
  244. TMemEntry = packed record
  245. me_Un: packed record
  246. case Byte of
  247. 0 : (meu_Reqs: LongWord);
  248. 1 : (meu_Addr: APTR)
  249. end;
  250. me_Length: LongWord;
  251. end;
  252. type
  253. PMemList = ^TMemList;
  254. TMemList = packed record
  255. ml_Node : TNode;
  256. ml_NumEntries: Word;
  257. ml_ME : array [0..0] of TMemEntry;
  258. end;
  259. const
  260. MEMF_ANY = 0;
  261. MEMF_PUBLIC = 1 Shl 0;
  262. MEMF_CHIP = 1 Shl 1;
  263. MEMF_FAST = 1 Shl 2;
  264. MEMF_LOCAL = 1 Shl 8;
  265. MEMF_24BITDMA = 1 Shl 9;
  266. MEMF_KICK = 1 Shl 10;
  267. MEMF_SWAP = 1 Shl 11; // Memory that can be swapped out to disk
  268. MEMF_31BIT = 1 Shl 12; // Memory that is in <2GiB area (V51)
  269. MEMF_CLEAR = 1 Shl 16;
  270. MEMF_LARGEST = 1 Shl 17;
  271. MEMF_REVERSE = 1 Shl 18;
  272. MEMF_TOTAL = 1 Shl 19;
  273. MEMF_SEM_PROTECTED = 1 Shl 20; // Pools: semaphore protection
  274. MEMF_NO_EXPUNGE = 1 Shl 31;
  275. MEM_BLOCKSIZE = 8;
  276. MEM_BLOCKMASK = MEM_BLOCKSIZE - 1;
  277. type
  278. PMemHandlerData = ^TMemHandlerData;
  279. TMemHandlerData = packed record
  280. memh_RequestSize : LongWord;
  281. memh_RequestFlags: LongWord;
  282. memh_Flags : LongWord;
  283. end;
  284. const
  285. MEMHF_RECYCLE = 1 Shl 0;
  286. MEM_DID_NOTHING = 0;
  287. MEM_ALL_DONE = -1;
  288. MEM_TRY_AGAIN = 1;
  289. type
  290. TFreeBlocksData = record
  291. fbd_NumBlocks: LongWord;
  292. fbd_Blocks: array[0..0] of TMemEntry; // fbd_NumBlocks entries
  293. end;
  294. PFreeBlocksData = ^TFreeBlocksData;
  295. { * exec port definitions (V50)
  296. *********************************************************************
  297. * }
  298. type
  299. PMsgPort = ^TMsgPort;
  300. TMsgPort = packed record
  301. mp_Node : TNode;
  302. mp_Flags : Byte;
  303. mp_SigBit : Byte;
  304. mp_SigTask: Pointer;
  305. mp_MsgList: TList;
  306. end;
  307. const
  308. PF_ACTION = 3;
  309. PA_SIGNAL = 0;
  310. PA_SOFTINT = 1;
  311. PA_IGNORE = 2;
  312. type
  313. PMessage = ^TMessage;
  314. TMessage = packed record
  315. mn_Node : TNode;
  316. mn_ReplyPort: PMsgPort;
  317. mn_Length : Word;
  318. end;
  319. type
  320. PTask = ^TTask;
  321. PETask = ^TETask;
  322. PTaskTrapMessage = ^TTaskTrapMessage;
  323. TTask = packed record
  324. tc_Node : TNode;
  325. tc_Flags : Byte;
  326. tc_State : Byte;
  327. tc_IDNestCnt: ShortInt;
  328. tc_TDNestCnt: ShortInt;
  329. tc_SigAlloc : LongWord;
  330. tc_SigWait : LongWord;
  331. tc_SigRecvd : LongWord;
  332. tc_SigExcept: LongWord;
  333. {$IF 0}
  334. tc_TrapAlloc: Word;
  335. tc_TrapAble : Word;
  336. {$ELSE}
  337. tc_ETask: PETask;
  338. {$ENDIF}
  339. tc_ExceptData: APTR;
  340. tc_ExceptCode: APTR;
  341. tc_TrapData : APTR;
  342. tc_TrapCode : APTR;
  343. tc_SPReg : APTR;
  344. tc_SPLower : APTR;
  345. tc_SPUpper : APTR;
  346. tc_Switch : Pointer; { *** OBSOLETE *** }
  347. tc_Launch : Pointer; { *** OBSOLETE *** }
  348. tc_MemEntry : TList;
  349. tc_UserData : APTR;
  350. end;
  351. TETask = packed record
  352. Message : TMessage;
  353. Parent : PTask;
  354. UniqueID : LongWord;
  355. Children : TMinList;
  356. TrapAlloc: Word;
  357. TrapAble : Word;
  358. Result1 : LongWord;
  359. Result2 : Pointer;
  360. MsgPort : TMsgPort;
  361. { * Don't touch!!!!!!!!!..there'll be an interface
  362. * sooner than later.
  363. * New Entries...most of the above entries
  364. * are only their for structure compatability.
  365. * They have no meaning as the OS never supported
  366. * them.
  367. * }
  368. { * A Task Pool for the task.
  369. * }
  370. MemPool: Pointer;
  371. { * PPC's Stack Lower Ptr
  372. * The initial stack is allocated through
  373. * AllocVec, so a FreeVec(ETask^.PPCSPLower);
  374. * would work.
  375. * If you use PPCStackSwap you must allocate
  376. * your stack block with AllocVec();
  377. * }
  378. PPCSPLower: Pointer;
  379. { * PPC's Stack Upper Ptr
  380. * }
  381. PPCSPUpper : Pointer;
  382. PPCRegFrame: Pointer;
  383. PPCLibData : Pointer;
  384. { * On a PPC exception this msgport
  385. * is sent an exception msg...
  386. * the task is stopped until somebody
  387. * wakes it up again.
  388. * (asynchron exception interface)
  389. * If this Port is NULL the message is
  390. * sent to SysBase->ex_PPCTrapMsgPort.
  391. * }
  392. PPCTrapMsgPort: PMsgPort;
  393. PPCTrapMessage: PTaskTrapMessage;
  394. { * This is undiscovered land...
  395. * never assume a size of this structure
  396. * }
  397. end;
  398. TTaskTrapMessage = packed record
  399. Message: TMessage; // Message Header
  400. Task: TTask; // connected Task
  401. Version: LongWord; // version of the structure VERSION_TASKTRAPMESSAGE
  402. TType: LongWord; // Exception Type
  403. DAR: LongWord; // Exception Address Register
  404. DSISR: LongWord; // Exception DSISR Reg
  405. // This is undiscovered land... never assume a size of this structure
  406. end;
  407. type
  408. PTaskInitExtension = ^TTaskInitExtension;
  409. TTaskInitExtension = packed record
  410. // Must be filled with TRAP_PPCTASK
  411. Trap : Word;
  412. Extension: Word; // Must be set to 0
  413. Tags : Pointer;
  414. end;
  415. { * This is normally in utility headers, but in Pascal that would
  416. * cause a circular dependency, so have it duplicated here... (KB) }
  417. const
  418. TAG_USER = 1 Shl 31;
  419. const
  420. TASKTAG_DUMMY = TAG_USER + $100000;
  421. TASKTAG_ERROR = TASKTAG_DUMMY + $0; // Ptr to an ULONG Errorfield where a better error description can be stored.
  422. TASKTAG_CODETYPE = TASKTAG_DUMMY + $1; // Code type can be stored.
  423. TASKTAG_PC = TASKTAG_DUMMY + $2; // Start PC code must be of TASKTAG_CODETYPE
  424. TASKTAG_FINALPC = TASKTAG_DUMMY + $3; // Final PC code must be of TASKTAG_CODETYPE
  425. TASKTAG_STACKSIZE = TASKTAG_DUMMY + $4; // Stacksize...Default 8192
  426. TASKTAG_STACKSIZE_M68K = TASKTAG_DUMMY + $5; // Std Stacksize... Default(use the stack defined by tc_SPLower..tc_SPUpper)
  427. TASKTAG_NAME = TASKTAG_DUMMY + $6; // specify task name, name is copied
  428. TASKTAG_USERDATA = TASKTAG_DUMMY + $7; // tc_UserData
  429. TASKTAG_PRI = TASKTAG_DUMMY + $8; // Task priority
  430. TASKTAG_POOLPUDDLE = TASKTAG_DUMMY + $9; // Pool's Puddlesize
  431. TASKTAG_POOLTHRESH = TASKTAG_DUMMY + $a; // Pool's ThreshSize
  432. TASKTAG_PPC_ARG1 = TASKTAG_DUMMY + $10; // PPC First Argument..gpr3
  433. TASKTAG_PPC_ARG2 = TASKTAG_DUMMY + $11; // PPC First Argument..gpr4
  434. TASKTAG_PPC_ARG3 = TASKTAG_DUMMY + $12; // PPC First Argument..gpr5
  435. TASKTAG_PPC_ARG4 = TASKTAG_DUMMY + $13; // PPC First Argument..gpr6
  436. TASKTAG_PPC_ARG5 = TASKTAG_DUMMY + $14; // PPC First Argument..gpr7
  437. TASKTAG_PPC_ARG6 = TASKTAG_DUMMY + $15; // PPC First Argument..gpr8
  438. TASKTAG_PPC_ARG7 = TASKTAG_DUMMY + $16; // PPC First Argument..gpr9
  439. TASKTAG_PPC_ARG8 = TASKTAG_DUMMY + $17; // PPC First Argument..gpr10
  440. TASKTAG_STARTUPMSG = TASKTAG_DUMMY + $18; // Startup message to be passed to task/process, ReplyMsg'd at RemTask() ti_Data: PMessage
  441. TASKTAG_TASKMSGPORT = TASKTAG_DUMMY + $19; // Create internal MsgPort for task/process, deleted at RemTask() ti_Data: PPMsgPort, can be nil
  442. TASKTAG_FLAGS = TASKTAG_DUMMY + $1a; // Set unitial tc_Flags ti_Data: Byte
  443. TASKTAG_TCBEXTRASIZE = TASKTAG_DUMMY + $1c; // Extra memory to allocate after task structure, the extra memory is cleared ti_Data: LongWord
  444. const
  445. CODETYPE_M68K = $0;
  446. // System V4 ABI
  447. CODETYPE_PPC = $1;
  448. const
  449. TASKERROR_OK = 0;
  450. TASKERROR_NOMEMORY = 1;
  451. { * exec task definitions (V50)
  452. *********************************************************************
  453. * }
  454. const
  455. TB_PROCTIME = 0;
  456. TB_ETASK = 3;
  457. TB_STACKCHK = 4;
  458. TB_EXCEPT = 5;
  459. TB_SWITCH = 6;
  460. TB_LAUNCH = 7;
  461. TF_PROCTIME = 1 Shl TB_PROCTIME;
  462. TF_ETASK = 1 Shl TB_ETASK;
  463. TF_STACKCHK = 1 Shl TB_STACKCHK;
  464. TF_EXCEPT = 1 Shl TB_EXCEPT;
  465. TF_SWITCH = 1 Shl TB_SWITCH;
  466. TF_LAUNCH = 1 Shl TB_LAUNCH;
  467. TS_INVALID = 0;
  468. TS_ADDED = 1;
  469. TS_RUN = 2;
  470. TS_READY = 3;
  471. TS_WAIT = 4;
  472. TS_EXCEPT = 5;
  473. TS_REMOVED = 6;
  474. SIGB_ABORT = 0;
  475. SIGB_CHILD = 1;
  476. SIGB_BLIT = 4;
  477. SIGB_SINGLE = 4;
  478. SIGB_INTUITION = 5;
  479. SIGB_NET = 7;
  480. SIGB_DOS = 8;
  481. SIGF_ABORT = 1 Shl SIGB_ABORT;
  482. SIGF_CHILD = 1 Shl SIGB_CHILD;
  483. SIGF_BLIT = 1 Shl SIGB_BLIT;
  484. SIGF_SINGLE = 1 Shl SIGB_SINGLE;
  485. SIGF_INTUITION = 1 Shl SIGB_INTUITION;
  486. SIGF_NET = 1 Shl SIGB_NET;
  487. SIGF_DOS = 1 Shl SIGB_DOS;
  488. // Added in exec 50.67
  489. // Exec has now a more sophisticated 68k(emulation) trap management.
  490. // In reality it's just a new system wide traphandler who sends logserver
  491. // the msg and if this msg is replied it uses the new emulation state.
  492. type
  493. PTaskTrapMessage_68k = ^TTaskTrapMessage_68k;
  494. TTaskTrapMessage_68k = packed record
  495. Message: TMessage; // Message Header
  496. Task: TTask; // connected Task
  497. Version: LongWord; // version of the structure VERSION_TASKTRAPMESSAGE_68k
  498. TType: LongWord; // Exception Type
  499. Format: LongWord; // Exception Stackframe Format
  500. Address: Pointer; // Hit Address
  501. FLSW: LongWord;
  502. MyEmulHandle: PEmulHandle;
  503. end;
  504. const
  505. VERSION_TASKTRAPMESSAGE_68k = $0;
  506. VERSION_TASKTRAPMESSAGE = $0;
  507. { *
  508. * Stack swap structure as passed to StackSwap() and PPCStackSwap()
  509. * }
  510. type
  511. PStackSwapStruct = ^TStackSwapStruct;
  512. TStackSwapStruct = packed record
  513. stk_Lower : APTR; // Lowest byte of stack
  514. stk_Upper : LongWord; // Upper end of stack (size + Lowert)
  515. stk_Pointer: APTR; // Stack pointer at switch point
  516. end;
  517. type
  518. PPPCStackSwapArgs = ^TPPCStackSwapArgs;
  519. TPPCStackSwapArgs = packed record
  520. Args: Array[0..7] Of LongWord; // The C register arguments from gpr3..gpr11
  521. end;
  522. { *
  523. * NewGetTaskAttrsA(), NewSetTaskAttrsA() tags
  524. * }
  525. const
  526. TASKINFOTYPE_ALLTASK = $0;
  527. TASKINFOTYPE_NAME = $1;
  528. TASKINFOTYPE_PRI = $2;
  529. TASKINFOTYPE_TYPE = $3;
  530. TASKINFOTYPE_STATE = $4;
  531. TASKINFOTYPE_FLAGS = $5;
  532. TASKINFOTYPE_SIGALLOC = $6;
  533. TASKINFOTYPE_SIGWAIT = $7;
  534. TASKINFOTYPE_SIGRECVD = $8;
  535. TASKINFOTYPE_SIGEXCEPT = $9;
  536. TASKINFOTYPE_EXCEPTDATA = $a;
  537. TASKINFOTYPE_EXCEPTCODE = $b;
  538. TASKINFOTYPE_TRAPDATA = $c;
  539. TASKINFOTYPE_TRAPCODE = $d;
  540. TASKINFOTYPE_STACKSIZE_M68K = $e;
  541. TASKINFOTYPE_STACKSIZE = $f;
  542. TASKINFOTYPE_USEDSTACKSIZE_M68K = $10;
  543. TASKINFOTYPE_USEDSTACKSIZE = $11;
  544. TASKINFOTYPE_TRAPMSGPORT = $12;
  545. TASKINFOTYPE_STARTUPMSG = $13;
  546. TASKINFOTYPE_TASKMSGPORT = $14;
  547. TASKINFOTYPE_POOLPTR = $15;
  548. TASKINFOTYPE_POOLMEMFLAGS = $16;
  549. TASKINFOTYPE_POOLPUDDLESIZE = $17;
  550. TASKINFOTYPE_POOLTHRESHSIZE = $18;
  551. { *
  552. * Task Scheduler statistics (exec 50.42)
  553. * }
  554. TASKINFOTYPE_NICE = $19;
  555. TASKINFOTYPE_AGETICKS = $1a;
  556. TASKINFOTYPE_CPUTIME = $1b;
  557. TASKINFOTYPE_LASTSECCPUTIME = $1c;
  558. TASKINFOTYPE_RECENTCPUTIME = $1d;
  559. TASKINFOTYPE_VOLUNTARYCSW = $1e;
  560. TASKINFOTYPE_INVOLUNTARYCSW = $1f;
  561. TASKINFOTYPE_LASTSECVOLUNTARYCSW = $20;
  562. TASKINFOTYPE_LASTSECINVOLUNTARYCSW = $21;
  563. // Added in exec 50.45
  564. TASKINFOTYPE_LAUNCHTIMETICKS = $22;
  565. TASKINFOTYPE_LAUNCHTIMETICKS1978 = $23;
  566. TASKINFOTYPE_PID_CLI = $24;
  567. // Added in exec 50.54
  568. TASKINFOTYPE_SPLOWER = $26;
  569. TASKINFOTYPE_SPUPPER = $27;
  570. TASKINFOTYPE_SPLOWER_M68K = $28;
  571. TASKINFOTYPE_SPUPPER_M68K = $29;
  572. TASKINFOTYPE_NAMECOPY = $2a;
  573. // Added in exec 50.63
  574. TASKINFOTYPE_USERDATA = $2b; // Get/Set task tc_UserData (LongWord)
  575. TASKINFOTYPE_RESURRECT_TASK = $2c; // Tag used to restart a suspended task (LongWord)
  576. TASKINFOTYPE_EMULHANDLE = $2d; // Get/Set task emulhandle (APTR)
  577. TASKINFOTYPE_EXCEPTIONCOUNT = $2e; // Get task exception count (LongWord)
  578. TASKINFOTYPE_HITCOUNT = $2f; // Get task hit count (LongWord)
  579. TASKINFOTYPE_MAXHITCOUNT = $30; // Get/Set task max hit count. If more hits happen the task is put to sleep. (LongWord)
  580. TASKINFOTYPE_ALERTCOUNT = $31; // Get task alert count (LongWord)
  581. TASKINFOTYPE_MAXALERTCOUNT = $32; // Get/Set task max alert count. If more alerts happen the task is put to sleep. (LongWord)
  582. TASKINFOTYPE_PID = $33; // Get task unique ID. This ID is unique to every task. (LongWord)
  583. TASKINFOTYPE_68K_NEWFRAME = $50;
  584. TASKINFOTYPE_PPC_SRR0 = $100;
  585. TASKINFOTYPE_PPC_SRR1 = $101;
  586. TASKINFOTYPE_PPC_LR = $102;
  587. TASKINFOTYPE_PPC_CTR = $103;
  588. TASKINFOTYPE_PPC_CR = $104;
  589. TASKINFOTYPE_PPC_XER = $105;
  590. TASKINFOTYPE_PPC_GPR = $106;
  591. TASKINFOTYPE_PPC_FPR = $107;
  592. TASKINFOTYPE_PPC_FPSCR = $108;
  593. TASKINFOTYPE_PPC_VSCR = $109;
  594. TASKINFOTYPE_PPC_VMX = $10a;
  595. TASKINFOTYPE_PPC_VSAVE = $10b;
  596. TASKINFOTYPE_PPC_FRAME = $10c;
  597. TASKINFOTYPE_PPC_FRAMESIZE = $10d;
  598. TASKINFOTYPE_PPC_NEWFRAME = $10e;
  599. TASKINFOTAG_DUMMY = (TAG_USER + $110000);
  600. TASKINFOTAG_HOOK = (TASKINFOTAG_DUMMY + $0); // Used with TASKINFOTYPE_ALLTASK
  601. TASKINFOTAG_REGSTART = (TASKINFOTAG_DUMMY + $1); // Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX to define the copy area
  602. TASKINFOTAG_REGCOUNT = (TASKINFOTAG_DUMMY + $2); // Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX to define the copy area
  603. { *
  604. * NewSetTaskAttrsA(..,@TaskFrame68k, sizeof(TTaskFrame68k), TASKINFOTYPE_68K_NEWFRAME,...);
  605. * }
  606. type
  607. PTaskFrame68k = ^TTaskFrame68k;
  608. TTaskFrame68k = packed record
  609. PC: Pointer;
  610. SR: Word;
  611. Xn: Array[0..14] Of LongWord;
  612. end;
  613. { *
  614. * Don't depend on these
  615. * }
  616. const
  617. DEFAULT_PPCSTACKSIZE = 32768;
  618. DEFAULT_M68KSTACKSIZE = 2048;
  619. DEFAULT_TASKPUDDLESIZE = 4096;
  620. DEFAULT_TASKTHRESHSIZE = 4096;
  621. PID_CURRENT = 0;
  622. { * exec alert definitions (V50)
  623. *********************************************************************
  624. * }
  625. const
  626. ACPU_BusErr = $80000002;
  627. ACPU_AddressErr = $80000003;
  628. ACPU_InstErr = $80000004;
  629. ACPU_DivZero = $80000005;
  630. ACPU_CHK = $80000006;
  631. ACPU_TRAPV = $80000007;
  632. ACPU_PrivErr = $80000008;
  633. ACPU_Trace = $80000009;
  634. ACPU_LineA = $8000000A;
  635. ACPU_LineF = $8000000B;
  636. ACPU_Format = $8000000E;
  637. ACPU_Spurious = $80000018;
  638. ACPU_AutoVec1 = $80000019;
  639. ACPU_AutoVec2 = $8000001A;
  640. ACPU_AutoVec3 = $8000001B;
  641. ACPU_AutoVec4 = $8000001C;
  642. ACPU_AutoVec5 = $8000001D;
  643. ACPU_AutoVec6 = $8000001E;
  644. ACPU_AutoVec7 = $8000001F;
  645. AT_DeadEnd = $80000000;
  646. AT_Recovery = $00000000;
  647. AG_NoMemory = $00010000;
  648. AG_MakeLib = $00020000;
  649. AG_OpenLib = $00030000;
  650. AG_OpenDev = $00040000;
  651. AG_OpenRes = $00050000;
  652. AG_IOError = $00060000;
  653. AG_NoSignal = $00070000;
  654. AG_BadParm = $00080000;
  655. AG_CloseLib = $00090000;
  656. AG_CloseDev = $000A0000;
  657. AG_ProcCreate = $000B0000;
  658. AG_MsgPortNotEmpty = $000C0000 { * V50 * };
  659. AO_ExecLib = $00008001;
  660. AO_GraphicsLib = $00008002;
  661. AO_LayersLib = $00008003;
  662. AO_Intuition = $00008004;
  663. AO_MathLib = $00008005;
  664. AO_DOSLib = $00008007;
  665. AO_RAMLib = $00008008;
  666. AO_IconLib = $00008009;
  667. AO_ExpansionLib = $0000800A;
  668. AO_DiskfontLib = $0000800B;
  669. AO_UtilityLib = $0000800C;
  670. AO_KeyMapLib = $0000800D;
  671. AO_AudioDev = $00008010;
  672. AO_ConsoleDev = $00008011;
  673. AO_GamePortDev = $00008012;
  674. AO_KeyboardDev = $00008013;
  675. AO_TrackDiskDev = $00008014;
  676. AO_TimerDev = $00008015;
  677. AO_CIARsrc = $00008020;
  678. AO_DiskRsrc = $00008021;
  679. AO_MiscRsrc = $00008022;
  680. AO_BootStrap = $00008030;
  681. AO_Workbench = $00008031;
  682. AO_DiskCopy = $00008032;
  683. AO_GadTools = $00008033;
  684. AO_Unknown = $00008035;
  685. // exec.library
  686. AN_ExecLib = $01000000;
  687. AN_ExcptVect = $01000001;
  688. AN_BaseChkSum = $01000002;
  689. AN_LibChkSum = $01000003;
  690. AN_MemCorrupt = $81000005;
  691. AN_IntrMem = $81000006;
  692. AN_InitAPtr = $01000007;
  693. AN_SemCorrupt = $01000008;
  694. AN_FreeTwice = $01000009;
  695. AN_BogusExcpt = $8100000A;
  696. AN_IOUsedTwice = $0100000B;
  697. AN_MemoryInsane = $0100000C;
  698. AN_IOAfterClose = $0100000D;
  699. AN_StackProbe = $0100000E;
  700. AN_BadFreeAddr = $0100000F;
  701. AN_BadSemaphore = $01000010;
  702. // graphics.library
  703. AN_GraphicsLib = $02000000;
  704. AN_GfxNoMem = $82010000;
  705. AN_GfxNoMemMspc = $82010001;
  706. AN_LongFrame = $82010006;
  707. AN_ShortFrame = $82010007;
  708. AN_TextTmpRas = $02010009;
  709. AN_BltBitMap = $8201000A;
  710. AN_RegionMemory = $8201000B;
  711. AN_MakeVPort = $82010030;
  712. AN_GfxNewError = $0200000C;
  713. AN_GfxFreeError = $0200000D;
  714. AN_GfxNoLCM = $82011234;
  715. AN_ObsoleteFont = $02000401;
  716. // layers.library
  717. AN_LayersLib = $03000000;
  718. AN_LayersNoMem = $83010000;
  719. // intuition.library
  720. AN_Intuition = $04000000;
  721. AN_GadgetType = $84000001;
  722. AN_BadGadget = $04000001;
  723. AN_CreatePort = $84010002;
  724. AN_ItemAlloc = $04010003;
  725. AN_SubAlloc = $04010004;
  726. AN_PlaneAlloc = $84010005;
  727. AN_ItemBoxTop = $84000006;
  728. AN_OpenScreen = $84010007;
  729. AN_OpenScrnRast = $84010008;
  730. AN_SysScrnType = $84000009;
  731. AN_AddSWGadget = $8401000A;
  732. AN_OpenWindow = $8401000B;
  733. AN_BadState = $8400000C;
  734. AN_BadMessage = $8400000D;
  735. AN_WeirdEcho = $8400000E;
  736. AN_NoConsole = $8400000F;
  737. AN_NoISem = $04000010;
  738. AN_ISemOrder = $04000011;
  739. // math.library
  740. AN_MathLib = $05000000;
  741. // dos.library
  742. AN_DOSLib = $07000000;
  743. AN_StartMem = $07010001;
  744. AN_EndTask = $07000002;
  745. AN_QPktFail = $07000003;
  746. AN_AsyncPkt = $07000004;
  747. AN_FreeVec = $07000005;
  748. AN_DiskBlkSeq = $07000006;
  749. AN_BitMap = $07000007;
  750. AN_KeyFree = $07000008;
  751. AN_BadChkSum = $07000009;
  752. AN_DiskError = $0700000A;
  753. AN_KeyRange = $0700000B;
  754. AN_BadOverlay = $0700000C;
  755. AN_BadInitFunc = $0700000D;
  756. AN_FileReclosed = $0700000E;
  757. // ramlib.library
  758. AN_RAMLib = $08000000;
  759. AN_BadSegList = $08000001;
  760. // icon.library
  761. AN_IconLib = $09000000;
  762. // expansion.library
  763. AN_ExpansionLib = $0A000000;
  764. AN_BadExpansionFree = $0A000001;
  765. // diskfont.library
  766. AN_DiskfontLib = $0B000000;
  767. // audio.device
  768. AN_AudioDev = $10000000;
  769. // console.device
  770. AN_ConsoleDev = $11000000;
  771. AN_NoWindow = $11000001;
  772. // gameport.device
  773. AN_GamePortDev = $12000000;
  774. // keyboard.device
  775. AN_KeyboardDev = $13000000;
  776. // trackdisk.device
  777. AN_TrackDiskDev = $14000000;
  778. AN_TDCalibSeek = $14000001;
  779. AN_TDDelay = $14000002;
  780. // timer.device
  781. AN_TimerDev = $15000000;
  782. AN_TMBadReq = $15000001;
  783. AN_TMBadSupply = $15000002;
  784. // cia.resource
  785. AN_CIARsrc = $20000000;
  786. // disk.resource
  787. AN_DiskRsrc = $21000000;
  788. AN_DRHasDisk = $21000001;
  789. AN_DRIntNoAct = $21000002;
  790. // misc.resource
  791. AN_MiscRsrc = $22000000;
  792. // bootstrap
  793. AN_BootStrap = $30000000;
  794. AN_BootError = $30000001;
  795. // Workbench
  796. AN_Workbench = $31000000;
  797. AN_NoFonts = $B1000001;
  798. AN_WBBadStartupMsg1 = $31000001;
  799. AN_WBBadStartupMsg2 = $31000002;
  800. AN_WBBadIOMsg = $31000003;
  801. AN_WBReLayoutToolMenu = $B1010009;
  802. // DiskCopy
  803. AN_DiskCopy = $32000000;
  804. // toolkit for Intuition
  805. AN_GadTools = $33000000;
  806. // System utility library
  807. AN_UtilityLib = $34000000;
  808. // For use by any application that needs it
  809. AN_Unknown = $35000000;
  810. type
  811. TAlertMessage = packed record
  812. Message: TMessage; // Message Header
  813. Task: PTask; // connected Task
  814. Version: LongWord; // version of the structure
  815. ID: LongWord; // AlertID
  816. // some more things following, do not assume size of structure
  817. end;
  818. const
  819. VERSION_ALERTMESSAGE = 0;
  820. { * exec interrupt definitions (V50)
  821. *********************************************************************
  822. * }
  823. type
  824. PInterrupt = ^TInterrupt;
  825. TInterrupt = packed record
  826. is_Node: TNode;
  827. is_Data: APTR;
  828. is_Code: Pointer;
  829. end;
  830. PIntVector = ^TIntVector;
  831. TIntVector = packed record
  832. iv_Data: APTR;
  833. iv_Code: Pointer;
  834. iv_Node: PNode;
  835. end;
  836. PSoftIntList = ^TSoftIntList;
  837. TSoftIntList = packed record
  838. sh_List: TList;
  839. sh_Pad: Word;
  840. end;
  841. const
  842. SIH_PRIMASK = $f0;
  843. INTB_NMI = 15;
  844. INTF_NMI = 1 Shl INTB_NMI;
  845. { * exec semaphore definitions (V50)
  846. *********************************************************************
  847. * }
  848. { *
  849. * Shouldn't be available public..
  850. * }
  851. type
  852. PSemaphoreRequest = ^TSemaphoreRequest;
  853. TSemaphoreRequest = packed record
  854. sr_Link : TMinNode;
  855. sr_Waiter: PTask;
  856. end;
  857. PSignalSemaphore = ^TSignalSemaphore;
  858. TSignalSemaphore = packed record
  859. ss_Link : TNode;
  860. ss_NestCount : SmallInt;
  861. ss_WaitQueue : TMinList;
  862. ss_MultipleLink: TSemaphoreRequest;
  863. ss_Owner : PTask;
  864. ss_QueueCount : SmallInt;
  865. end;
  866. PSemaphoreMessage = ^TSemaphoreMessage;
  867. TSemaphoreMessage = packed record
  868. ssm_Message : TMessage;
  869. ssm_Semaphore: PSignalSemaphore;
  870. end;
  871. const
  872. SM_SHARED = 1;
  873. SM_EXCLUSIVE = 0;
  874. { * exec machine definitions (V50)
  875. *********************************************************************
  876. * }
  877. const
  878. MACHINE_M68k = $0;
  879. MACHINE_PPC = $1;
  880. MACHINE_NO = $ffffffff;
  881. { * exec library definitions (V50)
  882. *********************************************************************
  883. * }
  884. const
  885. LIB_VECTSIZE = 6;
  886. LIB_RESERVED = 4;
  887. LIB_BASE = -LIB_VECTSIZE;
  888. LIB_USERDEF = LIB_BASE - (LIB_RESERVED * LIB_VECTSIZE);
  889. LIB_NONSTD = LIB_USERDEF;
  890. LIB_OPEN = -6;
  891. LIB_CLOSE = -12;
  892. LIB_EXPUNGE = -18;
  893. LIB_EXTFUNC = -24;
  894. LIB_GETQUERYATTR = -24; { * LIBF_QUERY * }
  895. type
  896. PLibrary = ^TLibrary;
  897. TLibrary = packed record
  898. lib_Node : TNode;
  899. lib_Flags : Byte;
  900. lib_pad : Byte;
  901. lib_NegSize : Word;
  902. lib_PosSize : Word;
  903. lib_Version : Word;
  904. lib_Revision: Word;
  905. lib_IdString: PChar;
  906. lib_Sum : LongWord;
  907. lib_OpenCnt : Word;
  908. end;
  909. const
  910. LIBF_SUMMING = 1 Shl 0;
  911. LIBF_CHANGED = 1 Shl 1;
  912. LIBF_SUMUSED = 1 Shl 2;
  913. LIBF_DELEXP = 1 Shl 3;
  914. // private
  915. LIBF_RAMLIB = 1 Shl 4;
  916. // Needs to be set if the GetQueryAttr function is legal
  917. LIBF_QUERYINFO = 1 Shl 5;
  918. // The remaining bits are reserved and aren`t allowed to be touched
  919. const
  920. // NewSetFunction extensions
  921. SETFUNCTAG_Dummy = TAG_USER +$01000000;
  922. SETFUNCTAG_MACHINE = SETFUNCTAG_Dummy + $1; // Set the machine type of the function Default is 68k
  923. SETFUNCTAG_TYPE = SETFUNCTAG_Dummy + $2; // Function type specifier
  924. SETFUNCTAG_IDNAME = SETFUNCTAG_Dummy + $3; // ID String
  925. SETFUNCTAG_DELETE = SETFUNCTAG_Dummy + $4; // Set to TRUE if the replaced function will never be used again.
  926. SETFUNCTYPE_NORMAL = 0; // Save Emulation PPC Registers, Call Function, Restore Emulation PPC Registers, REG_D0 = Result
  927. SETFUNCTYPE_QUICK = 1; // Call Function, Must use the global register settings of the emulation, REG_D0 = Result
  928. { Save Emulation PPC Registers, Call Function, Restore Emulation PPC Registers
  929. No Result, Needed to replace functions like, forbid,obtainsemaphores which are
  930. defined as trashing no registers}
  931. SETFUNCTYPE_NORMALNR = 2;
  932. { Call Function, Must use the global register settings of the emulation
  933. No Result, Needed to replace functions like forbid,obtainsemaphores which are
  934. defined as trashing no registers }
  935. SETFUNCTYPE_QUICKNR = 3;
  936. SETFUNCTYPE_NORMALSR = 4;
  937. SETFUNCTYPE_NORMALSRNR = 5;
  938. SETFUNCTYPE_NORMALD0_D1 = 6;
  939. SETFUNCTYPE_NORMALRESTORE = 7;
  940. SETFUNCTYPE_SYSTEMV = 8;
  941. SETFUNCTYPE_NORMALD0D1SR = 9;
  942. SETFUNCTYPE_NORMALD0D1A0A1SR = 10;
  943. // CreateLibrary extensions
  944. LIBTAG_BASE = TAG_USER + $01000100;
  945. LIBTAG_FUNCTIONINIT = LIBTAG_BASE+$0; // Function/Vector Array
  946. LIBTAG_STRUCTINIT = LIBTAG_BASE+$1; // Struct Init
  947. LIBTAG_LIBRARYINIT = LIBTAG_BASE+$2; // Library Init
  948. LIBTAG_MACHINE = LIBTAG_BASE+$3; // Init Code Type
  949. LIBTAG_BASESIZE = LIBTAG_BASE+$4; // Library Base Size
  950. LIBTAG_SEGLIST = LIBTAG_BASE+$5; // SegList Ptr
  951. LIBTAG_PRI = LIBTAG_BASE+$6; // Library Priority
  952. LIBTAG_TYPE = LIBTAG_BASE+$7; // Library Type..Library,Device,Resource,whatever
  953. LIBTAG_VERSION = LIBTAG_BASE+$8; // Library Version (LongWord)
  954. LIBTAG_FLAGS = LIBTAG_BASE+$9; // Library Flags
  955. LIBTAG_NAME = LIBTAG_BASE+$a; // Library Name
  956. LIBTAG_IDSTRING = LIBTAG_BASE+$b; // Library IDString
  957. { AddDevice(),AddLibrary(),AddResource()..
  958. depends on LibNode.ln_Type field which can be set by some Init function, Struct Scripts
  959. or LIBTAG_TYPE. If you set LIBTAG_PUBLIC the library is added to the right system list.}
  960. LIBTAG_PUBLIC = LIBTAG_BASE+$c;
  961. LIBTAG_REVISION = (LIBTAG_BASE+$d); // Library Revision (LongWord)
  962. LIBTAG_QUERYINFO = (LIBTAG_BASE+$e); // Library QueryInfo Flag (Boolean)
  963. type
  964. // Private don`t touch...floating design
  965. PFuncEntry = ^TFuncEntry;
  966. TFuncEntry = packed record
  967. EmulLibEntry : TEmulLibEntry;
  968. OldFunction : Pointer; { * Needed for bookkeeping * }
  969. end;
  970. PFuncOldEntry = ^TFuncOldEntry;
  971. TFuncOldEntry = packed record
  972. Command : Word;
  973. FuncEntry: PFuncEntry;
  974. end;
  975. // EmulLibEntry.Extension
  976. const
  977. FUNCENTRYEXTF_LIBRARY = $1; // Entry created by the OS
  978. FUNCENTRYEXTF_SETFUNCTION = $2; // Entry created by SetFunction, otherwise MakeFunction
  979. { *
  980. * Functionarray first ULONG ID defines the format
  981. * of the functionarray for MakeFunctions()/MakeLibrary().
  982. *
  983. * If there`s not such id the functionarray is a
  984. * 32Bit 68k function ptr array.
  985. * (LongWord) $ffffffff stops it
  986. * }
  987. { * 68k 16bit relative functionarray ptrs
  988. * (Word) $ffff stops it
  989. * }
  990. FUNCARRAY_16BIT_OLD = $ffffffff;
  991. { * PPC 32bit functionarray ptrs
  992. * (ULONG) $ffff stops it
  993. * }
  994. FUNCARRAY_32BIT_NATIVE = $fffefffe;
  995. { * Starts a functionarray block.
  996. * This way it`s possible to mix 68k and PPC
  997. * function definitions.
  998. * BASE:
  999. * FUNCTIONARRAY_BEGIN
  1000. * FUNCARRAY_32BIT_NATIVE
  1001. * FUNC0
  1002. * FUNC1
  1003. * .
  1004. * FUNCn
  1005. * $ffffffff
  1006. * FUNCn+1 (No ID->32Bit 68k)
  1007. * FUNCn+2
  1008. * .
  1009. * FUNCm
  1010. * $ffffffff
  1011. * FUNCARRAY_16BIT_OLD
  1012. * FUNCm+1-BASE
  1013. * FUNCm+2-BASE
  1014. * .
  1015. * FUNCo-BASE
  1016. * $ffff
  1017. * FUNCTIONARRAY_END
  1018. * }
  1019. FUNCARRAY_BEGIN = $fffdfffd;
  1020. { * Ends a functionarray block.
  1021. * }
  1022. FUNCARRAY_END = $fffcfffc;
  1023. { * PPC 32bit Quick functionarray ptrs.
  1024. * These functions must comply to the emulation's
  1025. * register layout which is defined inside the
  1026. * emul/emulregs.h. That means the register layout
  1027. * MUST also be valid during interrupts/task switches.
  1028. * You can't just destroy A7(r31), SR or PC.
  1029. *
  1030. * You shouldn't use this for any normal code
  1031. * as there's no real reason to do so. If you
  1032. * really think you need to use it please ask
  1033. * us first on the dev mailinglist.
  1034. * (ULONG) $ffffffff stops it
  1035. * }
  1036. FUNCARRAY_32BIT_QUICK_NATIVE = $fffbfffb;
  1037. { * PPC 32bit QuickNR(No Result) functionarray ptrs
  1038. * (ULONG) $ffffffff stops it
  1039. * }
  1040. FUNCARRAY_32BIT_QUICKNR_NATIVE = $fffafffa;
  1041. { * PPC 32bit no result functionarray ptrs
  1042. * (ULONG) $ffffffff stops it
  1043. * }
  1044. FUNCARRAY_32BIT_NR_NATIVE = $fff9fff9;
  1045. { * PPC 32bit SR functionarray ptrs
  1046. * (ULONG) $ffffffff stops it
  1047. * }
  1048. FUNCARRAY_32BIT_SR_NATIVE = $fff8fff8;
  1049. { * PPC 32bit SR(no result) functionarray ptrs
  1050. * (ULONG) $ffffffff stops it
  1051. * }
  1052. FUNCARRAY_32BIT_SRNR_NATIVE = $fff7fff7;
  1053. { * PPC 32bit D0_D1 functionarray ptrs
  1054. * (ULONG) $ffffffff stops it
  1055. * }
  1056. FUNCARRAY_32BIT_D0D1_NATIVE = $fff6fff6;
  1057. { * PPC 32bit Restore1 functionarray ptrs
  1058. * (ULONG) $ffffffff stops it
  1059. * }
  1060. FUNCARRAY_32BIT_RESTORE_NATIVE = $fff5fff5;
  1061. { * PPC 32bit SystemV ABI entry
  1062. * these function entries DON'T comply
  1063. * to the amiga register modell REG_D0-A6
  1064. * but comply to the PPC SystemV ABI so
  1065. * you can directly use PPC C Argument
  1066. * parsing. That way you're also not limited
  1067. * with the register count.
  1068. * Such library functions can't be used
  1069. * by 68k emulation, so you can only use
  1070. * them for new code.
  1071. * As we allow these new functions to be
  1072. * used with old functions we keep the
  1073. * 6 bytes function entry steps in the library.
  1074. * Layout is
  1075. *
  1076. * CODE_JMP, &FuncEntry ; Old Entry
  1077. * CODE_ILLEGAL, Function ; SystemV ABI Entry
  1078. *
  1079. *
  1080. * (ULONG) $ffffffff stops it
  1081. * }
  1082. FUNCARRAY_32BIT_SYSTEMV = $fff4fff4;
  1083. { * PPC 32bit D0D1SR functionarray ptrs
  1084. * (ULONG) $ffffffff stops it
  1085. * }
  1086. FUNCARRAY_32BIT_D0D1SR_NATIVE = $fff3fff3;
  1087. { * PPC 32bit D0D1A0A1SR functionarray ptrs
  1088. * (ULONG) $ffffffff stops it
  1089. * }
  1090. FUNCARRAY_32BIT_D0D1A0A1SR_NATIVE = $fff2fff2;
  1091. { * exec device definitions (V50)
  1092. *********************************************************************
  1093. * }
  1094. type
  1095. PDevice = ^TDevice;
  1096. TDevice = packed record
  1097. dd_Library: TLibrary;
  1098. end;
  1099. type
  1100. PUnit = ^TUnit;
  1101. TUnit = packed record
  1102. unit_MsgPort: TMsgPort;
  1103. unit_flags : Byte;
  1104. unit_pad : Byte;
  1105. unit_OpenCnt: Word;
  1106. end;
  1107. const
  1108. UNITF_ACTIVE = 1 Shl 0;
  1109. UNITF_INTASK = 1 Shl 1;
  1110. { * exec io definitions (V50)
  1111. *********************************************************************
  1112. * }
  1113. type
  1114. PIORequest = ^TIORequest;
  1115. TIORequest = packed record
  1116. io_Message: TMessage;
  1117. io_Device : PDevice;
  1118. io_Unit : PUnit;
  1119. io_Command: Word;
  1120. io_Flags : Byte;
  1121. io_Error : ShortInt;
  1122. end;
  1123. type
  1124. PIOStdReq = ^TIOStdReq;
  1125. TIOStdReq = packed record
  1126. io_Message: TMessage;
  1127. io_Device : PDevice;
  1128. io_Unit : PUnit;
  1129. io_Command: Word;
  1130. io_Flags : Byte;
  1131. io_Error : ShortInt;
  1132. io_Actual : DWord;
  1133. io_Length : DWord;
  1134. io_Data : Pointer;
  1135. io_Offset : DWord;
  1136. end;
  1137. const
  1138. DEV_BEGINIO = -30;
  1139. DEV_ABORTIO = -36;
  1140. IOB_QUICK = 0;
  1141. IOF_QUICK = 1 Shl IOB_QUICK;
  1142. CMD_INVALID = 0;
  1143. CMD_RESET = 1;
  1144. CMD_READ = 2;
  1145. CMD_WRITE = 3;
  1146. CMD_UPDATE = 4;
  1147. CMD_CLEAR = 5;
  1148. CMD_STOP = 6;
  1149. CMD_START = 7;
  1150. CMD_FLUSH = 8;
  1151. CMD_NONSTD = 9;
  1152. { * exec include (V50)
  1153. *********************************************************************
  1154. * }
  1155. const
  1156. CPUTBSTACKTRACECOUNT = 16;
  1157. type
  1158. PExecBase = ^TExecBase;
  1159. TExecBase = packed record
  1160. LIbNode : TLibrary;
  1161. SoftVer : Word;
  1162. LowMemChkSum: SmallInt;
  1163. ChkBase : LongWord;
  1164. ColdCapture : APTR;
  1165. CoolCapture : APTR;
  1166. WarmCapture : APTR;
  1167. SysStkUpper : APTR;
  1168. SysStkLower : APTR;
  1169. MaxLocMem : LongWord;
  1170. DebugEntry : APTR;
  1171. DebugData : APTR;
  1172. AlertData : APTR;
  1173. MaxExtMem : APTR;
  1174. ChkSum : Word;
  1175. IntVects : Array[0..15] Of TIntVector;
  1176. ThisTask : PTask;
  1177. IdleCount : LongWord;
  1178. DispCount : LongWord;
  1179. Quantum : Word;
  1180. Elapsed : Word;
  1181. SysFlags : Word;
  1182. IDNestCnt : ShortInt;
  1183. TDNestCnt : ShortInt;
  1184. AttnFlags : Word;
  1185. AttnResched : Word;
  1186. ResModules : APTR;
  1187. TaskTrapCode : APTR;
  1188. TaskExceptCode: APTR;
  1189. TaskExitCode : APTR;
  1190. TaskSigAlloc : LongWord;
  1191. TaskTrapAlloc : Word;
  1192. MemList : TList;
  1193. ResourceList: TList;
  1194. DeviceList : TList;
  1195. IntrList : TList;
  1196. LibList : TList;
  1197. PortList : TList;
  1198. TaskReady : TList;
  1199. TaskWait : TList;
  1200. SoftInts : Array[0..4] Of TSoftIntList;
  1201. LastAlert : Array[0..3] Of LongInt;
  1202. VBlankFrequency : Byte;
  1203. PowerSupplyFrequency: Byte;
  1204. SemaphoreList : TList;
  1205. KickMemPtr : APTR;
  1206. KickTagPtr : APTR;
  1207. KickCheckSum : APTR;
  1208. ex_Pad0 : Word;
  1209. ex_LaunchPoint : LongWord;
  1210. ex_RamLibPrivate : APTR;
  1211. ex_EClockFrequency : LongWord;
  1212. ex_CacheControl : LongWord;
  1213. ex_TaskID : LongWord;
  1214. { * New ABox Emulation Entries
  1215. * }
  1216. ex_EmulHandleSize : LongWord; { * PPC EmulHandleSize..*private* * }
  1217. ex_PPCTrapMsgPort : PMsgPort; { * PPC ABox Exception MsgPort..*private* * }
  1218. ex_Reserved1 : Array[0..2] Of LongWord;
  1219. ex_MMULock : APTR;
  1220. ex_PatchPool : APTR; { * PatchPool Ptr needed by SetFunction..*private* * }
  1221. ex_PPCTaskExitCode : APTR; { * PPC Task exit function * }
  1222. ex_DebugFlags : LongWord; { * Exec Debug Flags..*private* * }
  1223. ex_MemHandlers : TMinList;
  1224. ex_MemHandler : APTR;
  1225. end;
  1226. { *
  1227. * Outdated 68k cpu informations
  1228. *
  1229. * }
  1230. const
  1231. AFB_68010 = 0;
  1232. AFB_68020 = 1;
  1233. AFB_68030 = 2;
  1234. AFB_68040 = 3;
  1235. AFB_68881 = 4;
  1236. AFB_68882 = 5;
  1237. AFB_FPU40 = 6;
  1238. AFB_68060 = 7;
  1239. AFB_PRIVATE = 15;
  1240. AFF_68010 = 1 Shl AFB_68010;
  1241. AFF_68020 = 1 Shl AFB_68020;
  1242. AFF_68030 = 1 Shl AFB_68030;
  1243. AFF_68040 = 1 Shl AFB_68040;
  1244. AFF_68881 = 1 Shl AFB_68881;
  1245. AFF_68882 = 1 Shl AFB_68882;
  1246. AFF_FPU40 = 1 Shl AFB_FPU40;
  1247. AFF_68060 = 1 Shl AFB_68060;
  1248. AFF_PRIVATE = 1 Shl AFB_PRIVATE;
  1249. { *
  1250. * Outdated 68k cache functionality
  1251. * Mostly without function.
  1252. * }
  1253. const
  1254. CACRF_EnableI = 1 Shl 0;
  1255. CACRF_FreezeI = 1 Shl 1;
  1256. CACRF_ClearI = 1 Shl 3;
  1257. CACRF_IBE = 1 Shl 4;
  1258. CACRF_EnableD = 1 Shl 8;
  1259. CACRF_FreezeD = 1 Shl 9;
  1260. CACRF_ClearD = 1 Shl 11;
  1261. CACRF_DBE = 1 Shl 12;
  1262. CACRF_WriteAllocate = 1 Shl 13;
  1263. CACRF_EnableE = 1 Shl 30;
  1264. CACRF_CopyBack = 1 Shl 31;
  1265. DMA_Continue = 1 Shl 1;
  1266. DMA_NoModify = 1 Shl 2;
  1267. DMA_ReadFromRAM = 1 Shl 3;
  1268. SB_SAR = 15;
  1269. SB_TQE = 14;
  1270. SB_SINT = 13;
  1271. SF_SAR = 1 Shl SB_SAR;
  1272. SF_TQE = 1 Shl SB_TQE;
  1273. SF_SINT = 1 Shl SB_SINT;
  1274. { ****** Debug Flags...(don`t depend on them) ********** }
  1275. const
  1276. EXECDEBUGF_INITRESIDENT = $1;
  1277. EXECDEBUGF_INITCODE = $2;
  1278. EXECDEBUGF_FINDRESIDENT = $4;
  1279. EXECDEBUGF_CREATELIBRARY = $10;
  1280. EXECDEBUGF_SETFUNCTION = $20;
  1281. EXECDEBUGF_NEWSETFUNCTION = $40;
  1282. EXECDEBUGF_CHIPRAM = $80;
  1283. EXECDEBUGF_ADDTASK = $100;
  1284. EXECDEBUGF_REMTASK = $200;
  1285. EXECDEBUGF_GETTASKATTR = $400;
  1286. EXECDEBUGF_SETTASKATTR = $800;
  1287. EXECDEBUGF_EXCEPTHANDLER = $1000;
  1288. EXECDEBUGF_ADDDOSNODE = $2000;
  1289. EXECDEBUGF_PCI = $4000;
  1290. EXECDEBUGF_RAMLIB = $8000;
  1291. EXECDEBUGF_NOLOGSERVER = $10000;
  1292. EXECDEBUGF_NOLOGWINDOW = $20000;
  1293. { *
  1294. * "env:MorphOS/LogPath" contains the logfile path,
  1295. * If not specified it`s using "ram:.morphoslog"
  1296. * }
  1297. EXECDEBUGF_LOGFILE = $40000;
  1298. EXECDEBUGF_LOGKPRINTF = $80000;
  1299. { * Memory Tracking Flags
  1300. * }
  1301. EXECDEBUGF_PERMMEMTRACK = $100000;
  1302. EXECDEBUGF_MEMTRACK = $200000;
  1303. { * CyberGuardPPC Flags
  1304. * }
  1305. EXECDEBUGF_CYBERGUARDDEADLY = $400000;
  1306. { * PPCLib Flags
  1307. * }
  1308. EXECDEBUGF_LOADSEG = $01000000;
  1309. EXECDEBUGF_UNLOADSEG = $02000000;
  1310. EXECDEBUGF_PPCSTART = $04000000;
  1311. { * UserFlags
  1312. * }
  1313. { *
  1314. * Enables debug output for cybergraphx
  1315. * }
  1316. const
  1317. EXECDEBUGF_CGXDEBUG = $08000000;
  1318. { *
  1319. * Should be used to control user LibInit/DevInit Debug output
  1320. * }
  1321. EXECDEBUGF_INIT = $40000000;
  1322. { *
  1323. * Should be used to control logging
  1324. * }
  1325. EXECDEBUGF_LOG = $80000000;
  1326. { *
  1327. * Execbase list IDs
  1328. * }
  1329. EXECLIST_DEVICE = 0;
  1330. EXECLIST_INTERRUPT = 1;
  1331. EXECLIST_LIBRARY = 2;
  1332. EXECLIST_MEMHANDLER = 3;
  1333. EXECLIST_MEMHEADER = 4;
  1334. EXECLIST_PORT = 5;
  1335. EXECLIST_RESOURCE = 6;
  1336. EXECLIST_SEMAPHORE = 7;
  1337. EXECLIST_TASK = 8;
  1338. { *
  1339. * Execnotify hook message
  1340. * }
  1341. type
  1342. PExecNotifyMessage = ^TExecNotifyMessage;
  1343. TExecNotifyMessage = packed record
  1344. MType : LongWord;
  1345. Flags : LongWord;
  1346. Extra : LongWord;
  1347. Extension: PTagItem;
  1348. end;
  1349. const
  1350. EXECNOTIFYF_REMOVE = 1 Shl 0; { * if clear, is ADD * }
  1351. EXECNOTIFYF_POST = 1 Shl 1; { * if clear, is PRE * }
  1352. { *
  1353. * AddExecNodeTagList tags
  1354. * }
  1355. const
  1356. SAL_Dummy = TAG_USER + 1000;
  1357. SAL_Type = SAL_Dummy + 1;
  1358. SAL_Priority = SAL_Dummy + 2;
  1359. SAL_Name = SAL_Dummy + 3;
  1360. // exec rawfmt (V50)
  1361. RAWFMTFUNC_STRING = 0; // Used to act like sprintf
  1362. RAWFMTFUNC_SERIAL = 1; // Used to act like kprintf
  1363. RAWFMTFUNC_COUNT = 2; // Used to count the chars needed. PutChData = PLongWord to the counter
  1364. // exec system definitions (V50)
  1365. SYSTEMINFOTYPE_SYSTEM = $0;
  1366. SYSTEMINFOTYPE_MACHINE = $1;
  1367. SYSTEMINFOTYPE_PPC_CPUVERSION = $2;
  1368. SYSTEMINFOTYPE_PPC_CPUREVISION = $3;
  1369. SYSTEMINFOTYPE_PPC_CPUCLOCK = $4;
  1370. SYSTEMINFOTYPE_PPC_BUSCLOCK = $5;
  1371. SYSTEMINFOTYPE_PPC_ICACHEL1SIZE = $10;
  1372. SYSTEMINFOTYPE_PPC_ICACHEL1LINES = $11;
  1373. SYSTEMINFOTYPE_PPC_ICACHEL1LINESIZE = $12;
  1374. SYSTEMINFOTYPE_PPC_DCACHEL1SIZE = $13;
  1375. SYSTEMINFOTYPE_PPC_DCACHEL1LINES = $14;
  1376. SYSTEMINFOTYPE_PPC_DCACHEL1LINESIZE = $15;
  1377. SYSTEMINFOTYPE_PPC_CACHEL1TYPE = $16;
  1378. SYSTEMINFOTYPE_PPC_CACHEL1FLAGS = $17;
  1379. SYSTEMINFOTYPE_PPC_ICACHEL2SIZE = $20;
  1380. SYSTEMINFOTYPE_PPC_ICACHEL2LINES = $21;
  1381. SYSTEMINFOTYPE_PPC_ICACHEL2LINESIZE = $22;
  1382. SYSTEMINFOTYPE_PPC_DCACHEL2SIZE = $23;
  1383. SYSTEMINFOTYPE_PPC_DCACHEL2LINES = $24;
  1384. SYSTEMINFOTYPE_PPC_DCACHEL2LINESIZE = $25;
  1385. SYSTEMINFOTYPE_PPC_CACHEL2TYPE = $26;
  1386. SYSTEMINFOTYPE_PPC_CACHEL2FLAGS = $27;
  1387. SYSTEMINFOTYPE_PPC_ICACHEL3SIZE = $30;
  1388. SYSTEMINFOTYPE_PPC_ICACHEL3LINES = $31;
  1389. SYSTEMINFOTYPE_PPC_ICACHEL3LINESIZE = $32;
  1390. SYSTEMINFOTYPE_PPC_DCACHEL3SIZE = $33;
  1391. SYSTEMINFOTYPE_PPC_DCACHEL3LINES = $34;
  1392. SYSTEMINFOTYPE_PPC_DCACHEL3LINESIZE = $35;
  1393. SYSTEMINFOTYPE_PPC_CACHEL3TYPE = $36;
  1394. SYSTEMINFOTYPE_PPC_CACHEL3FLAGS = $37;
  1395. SYSTEMINFOTYPE_PPC_TLBENTRIES = $40;
  1396. SYSTEMINFOTYPE_PPC_TLBSETS = $41;
  1397. SYSTEMINFOTYPE_PPC_FPU = $50; // PowerPC has a FPU
  1398. SYSTEMINFOTYPE_PPC_ALTIVEC = $51; // PowerPC has an Altivec unit
  1399. SYSTEMINFOTYPE_PPC_PERFMONITOR = $52; // PowerPC has performance measurement cpu extension
  1400. SYSTEMINFOTYPE_PPC_DATASTREAM = $53; // PowerPC has datastream cpu extension.
  1401. SYSTEMINFOTYPE_PPC_RESERVATIONSIZE = $60; // Reservation Size
  1402. SYSTEMINFOTYPE_PPC_BUSTICKS = $61; // Bus Timer Ticks
  1403. SYSTEMINFOTYPE_PPC_CPUTEMP = $62; // CPU Temperature in 8.24 fixedpoint, degrees celcius
  1404. SYSTEMINFOTYPE_PPC_DABR = $63; // PowerPC has Data Address Breakpoint Register (DABR)
  1405. SYSTEMINFOTYPE_PAGESIZE = $100; // MMU Page Size
  1406. SYSTEMINFOTYPE_CPUCOUNT = $101; // Number of CPUs, doesn't mean they are all supported by exec
  1407. // Global Scheduler statistics = exec 50.42;
  1408. SYSTEMINFOTYPE_TBCLOCKFREQUENCY = $200;
  1409. SYSTEMINFOTYPE_UPTIMETICKS = $201;
  1410. SYSTEMINFOTYPE_LASTSECTICKS = $202;
  1411. SYSTEMINFOTYPE_RECENTTICKS = $203;
  1412. SYSTEMINFOTYPE_CPUTIME = $204;
  1413. SYSTEMINFOTYPE_LASTSECCPUTIME = $205;
  1414. SYSTEMINFOTYPE_RECENTCPUTIME = $206;
  1415. SYSTEMINFOTYPE_VOLUNTARYCSW = $207;
  1416. SYSTEMINFOTYPE_INVOLUNTARYCSW = $208;
  1417. SYSTEMINFOTYPE_LASTSECVOLUNTARYCSW = $209;
  1418. SYSTEMINFOTYPE_LASTSECINVOLUNTARYCSW = $20a;
  1419. SYSTEMINFOTYPE_LOADAVG1 = $20b;
  1420. SYSTEMINFOTYPE_LOADAVG2 = $20c;
  1421. SYSTEMINFOTYPE_LOADAVG3 = $20d;
  1422. // Added in exec 50.45
  1423. SYSTEMINFOTYPE_TASKSCREATED = $20e;
  1424. SYSTEMINFOTYPE_TASKSFINISHED = $20f;
  1425. SYSTEMINFOTYPE_LAUNCHTIMETICKS = $210;
  1426. SYSTEMINFOTYPE_LAUNCHTIMETICKS1978 = $211;
  1427. SYSTEMINFOTYPE_TASKSRUNNING = $212;
  1428. SYSTEMINFOTYPE_TASKSSLEEPING = $213;
  1429. // Added in exec 50.54
  1430. SYSTEMINFOTYPE_EMULHANDLESIZE = $217; // read only
  1431. SYSTEMINFOTYPE_EXCEPTIONMSGPORT = $218; // The system's global native exception handler's msgport. Is overruled by task's native exception handler msgports.
  1432. SYSTEMINFOTYPE_TASKEXITCODE = $219; // The system's global task exit code. Is overruled by a custom exitcode in task generation.
  1433. SYSTEMINFOTYPE_TASKEXITCODE_M68K = $21a; // The system's global 68k task exit code. Is overruled by a custom exitcode in task generation.
  1434. // Added in exec 50.58
  1435. SYSTEMINFOTYPE_EMULATION_START = $230; // emulation area start read only
  1436. SYSTEMINFOTYPE_EMULATION_SIZE = $231; // emulation area size read only
  1437. SYSTEMINFOTYPE_MODULE_START = $232; // module area address read only
  1438. SYSTEMINFOTYPE_MODULE_SIZE = $233; // module area size read only
  1439. // Added in exec 50.67
  1440. SYSTEMINFOTYPE_EXCEPTIONMSGPORT_68K = $234; // The system's global 68k exception handler's msgport.
  1441. // Is overruled by task's native exception 68k handler msgports
  1442. // and that's overruled by the task's 68k traphandler
  1443. SYSTEMINFOTYPE_ALERTMSGPORT = $235; // The system's global alert handler's msgport.
  1444. // Added in exec 50.68
  1445. SYSTEMINFOTYPE_VENDOR = $236; // The system vendor string
  1446. SYSTEMINFOTYPE_REVISION = $237; // The system revision string
  1447. // Added in exec 50.73
  1448. SYSTEMINFOTYPE_MAGIC1 = $238; // Magic fields in execbase
  1449. SYSTEMINFOTYPE_MAGIC2 = $239;
  1450. // Added in exec 51.3
  1451. SYSTEMINFOTYPE_MAXHITCOUNT = $23a;
  1452. // Added in exec 51.13
  1453. SYSTEMINFOTYPE_MAXALERTCOUNT = $23b;
  1454. // Added in exec 51.25
  1455. SYSTEMINFOTYPE_REGUSER = $23c;
  1456. {
  1457. Fills 'struct FreeBlocksData' structure, with each struct MemEntry
  1458. representing single free block. Normally all free blocks in all memory
  1459. headers are scanned, but SYSTEMINFOTAG_MEMHEADER can be used to limit
  1460. the scanning to a single memory header. If successfull,
  1461. NewGetSystemAttrs return TRUE, and then fbd_NumBlocks contains the
  1462. number of struct MemEntry entries filled.
  1463. You can also use SYSTEMINFOTAG_HOOK to have your custom hook called
  1464. rather than having array being filled. The hook is called within
  1465. Forbid() and the forbid must NOT be broken. The hook is called with:
  1466. A0 - PHook
  1467. A1 - PMemEntry
  1468. A2 - PMemHeader
  1469. The hook must return success/failure indicator, returning FALSE causes
  1470. the NewGetSystemAttrs call to abort instantly and return FALSE.
  1471. }
  1472. // Added in exec 51.32
  1473. SYSTEMINFOTYPE_FREEBLOCKS = $23d;
  1474. // Added in exec 51.38
  1475. SYSTEMINFOTYPE_CPUNAME = $23e; // CPU name as a string e.g. "603E", "7448", "970FX", "Unknown" read only
  1476. SYSTEMINFOTYPE_CPUFAMILYNAME = $23f; // CPU family name as a string e.g. "G1", "G2", "G4", "G5", "Unknown" read only
  1477. SYSTEMINFOTAG_DUMMY = TAG_USER + $112000;
  1478. SYSTEMINFOTAG_CPUINDEX = SYSTEMINFOTAG_DUMMY + $0;
  1479. SYSTEMINFOTAG_MEMHEADER = SYSTEMINFOTAG_DUMMY + $1;
  1480. SYSTEMINFOTAG_HOOK = SYSTEMINFOTAG_DUMMY + $2;
  1481. function Supervisor(userFunction: Pointer location 'a5'): Cardinal;
  1482. SysCall MOS_ExecBase 030;
  1483. procedure InitCode(startClass: Cardinal location 'd0';
  1484. version : Cardinal location 'd1');
  1485. SysCall MOS_ExecBase 072;
  1486. procedure InitStruct(initTable: Pointer location 'a1';
  1487. memory : Pointer location 'a2';
  1488. size : Cardinal location 'd0');
  1489. SysCall MOS_ExecBase 078;
  1490. function MakeLibrary(funcInit : Pointer location 'a0';
  1491. structInit: Pointer location 'a1';
  1492. libInit : Pointer location 'a2';
  1493. dataSize : Cardinal location 'd0';
  1494. segList : Cardinal location 'd1'): PLibrary;
  1495. SysCall MOS_ExecBase 084;
  1496. procedure MakeFunctions(target : Pointer location 'a0';
  1497. functionArray: Pointer location 'a1';
  1498. funcDispBase : Pointer location 'a2');
  1499. SysCall MOS_ExecBase 090;
  1500. function FindResident(name: PChar location 'a1'): PResident;
  1501. SysCall MOS_ExecBase 096;
  1502. function InitResident(resident: PResident location 'a1';
  1503. segList : Cardinal location 'd1'): Pointer;
  1504. SysCall MOS_ExecBase 102;
  1505. procedure Alert(alertNum: Cardinal location 'd7');
  1506. SysCall MOS_ExecBase 108;
  1507. procedure Debug(flags: Cardinal location 'd0');
  1508. SysCall MOS_ExecBase 114;
  1509. procedure Disable;
  1510. SysCall MOS_ExecBase 120;
  1511. procedure Enable;
  1512. SysCall MOS_ExecBase 126;
  1513. procedure Forbid;
  1514. SysCall MOS_ExecBase 132;
  1515. procedure Permit;
  1516. SysCall MOS_ExecBase 138;
  1517. function SetSR(newSR: Cardinal location 'd0';
  1518. mask : Cardinal location 'd1'): Cardinal;
  1519. SysCall MOS_ExecBase 144;
  1520. function SuperState : Pointer;
  1521. SysCall MOS_ExecBase 150;
  1522. procedure UserState(sysStack: Pointer location 'd0');
  1523. SysCall MOS_ExecBase 156;
  1524. function SetIntVector(intNumber: LongInt location 'd0';
  1525. interrupt: PInterrupt location 'a1'): PInterrupt;
  1526. SysCall MOS_ExecBase 162;
  1527. procedure AddIntServer(intNumber: LongInt location 'd0';
  1528. interrupt: PInterrupt location 'a1');
  1529. SysCall MOS_ExecBase 168;
  1530. procedure RemIntServer(intNumber: LongInt location 'd0';
  1531. interrupt: PInterrupt location 'a1');
  1532. SysCall MOS_ExecBase 174;
  1533. procedure Cause(interrupt: PInterrupt location 'a1');
  1534. SysCall MOS_ExecBase 180;
  1535. function Allocate(freeList: PMemHeader location 'a0';
  1536. byteSize: Cardinal location 'd0'): Pointer;
  1537. SysCall MOS_ExecBase 186;
  1538. procedure Deallocate(freeList : PMemHeader location 'a0';
  1539. memoryBlock: Pointer location 'a1';
  1540. byteSize : Cardinal location 'd0');
  1541. SysCall MOS_ExecBase 192;
  1542. { * Name changed to avoid conflict with heap manager... * }
  1543. function execAllocMem(byteSize : Cardinal location 'd0';
  1544. requirements: Cardinal location 'd1'): Pointer;
  1545. SysCall MOS_ExecBase 198;
  1546. function AllocAbs(byteSize: Cardinal location 'd0';
  1547. location: Pointer location 'a1'): Pointer;
  1548. SysCall MOS_ExecBase 204;
  1549. { * Name changed to avoid conflict with heap manager... * }
  1550. procedure execFreeMem(memoryBlock: Pointer location 'a1';
  1551. byteSize : Cardinal location 'd0');
  1552. SysCall MOS_ExecBase 210;
  1553. function AvailMem(requirements: Cardinal location 'd1'): Cardinal;
  1554. SysCall MOS_ExecBase 216;
  1555. function AllocEntry(entry: PMemList location 'a0'): PMemList;
  1556. SysCall MOS_ExecBase 222;
  1557. procedure FreeEntry(entry: PMemList location 'a0');
  1558. SysCall MOS_ExecBase 228;
  1559. { * Name changed to avoid conflict with other System unit call... * }
  1560. procedure execInsert(list: PList location 'a0';
  1561. node: PNode location 'a1';
  1562. pred: PNode location 'a2');
  1563. SysCall MOS_ExecBase 234;
  1564. procedure AddHead(list: PList location 'a0';
  1565. node: PNode location 'a1');
  1566. SysCall MOS_ExecBase 240;
  1567. procedure AddTail(list: PList location 'a0';
  1568. node: PNode location 'a1');
  1569. SysCall MOS_ExecBase 246;
  1570. procedure Remove(node: PNode location 'a1');
  1571. SysCall MOS_ExecBase 252;
  1572. function RemHead(list: PList location 'a0'): PNode;
  1573. SysCall MOS_ExecBase 258;
  1574. function RemTail(list: PList location 'a0'): PNode;
  1575. SysCall MOS_ExecBase 264;
  1576. procedure Enqueue(list: PList location 'a0';
  1577. node: PNode location 'a1');
  1578. SysCall MOS_ExecBase 270;
  1579. function FindName(list: PList location 'a0';
  1580. name: PChar location 'a1'): PNode;
  1581. SysCall MOS_ExecBase 276;
  1582. function AddTask(task : PTask location 'a1';
  1583. initPC : Pointer location 'a2';
  1584. finalPC: Pointer location 'a3'): Pointer;
  1585. SysCall MOS_ExecBase 282;
  1586. procedure RemTask(task: PTask location 'a1');
  1587. SysCall MOS_ExecBase 288;
  1588. function FindTask(name: PChar location 'a1'): PTask;
  1589. SysCall MOS_ExecBase 294;
  1590. function SetTaskPri(task : PTask location 'a1';
  1591. priority: LongInt location 'd0'): ShortInt;
  1592. SysCall MOS_ExecBase 300;
  1593. function SetSignal(newSignals: Cardinal location 'd0';
  1594. signalSet : Cardinal location 'd1'): Cardinal;
  1595. SysCall MOS_ExecBase 306;
  1596. function SetExcept(newSignals: Cardinal location 'd0';
  1597. signalSet : Cardinal location 'd1'): Cardinal;
  1598. SysCall MOS_ExecBase 312;
  1599. function Wait(signalSet: Cardinal location 'd0'): Cardinal;
  1600. SysCall MOS_ExecBase 318;
  1601. procedure Signal(task : PTask location 'a1';
  1602. signalSet: Cardinal location 'd0');
  1603. SysCall MOS_ExecBase 324;
  1604. function AllocSignal(signalNum: LongInt location 'd0'): ShortInt;
  1605. SysCall MOS_ExecBase 330;
  1606. procedure FreeSignal(signalNum: LongInt location 'd0');
  1607. SysCall MOS_ExecBase 336;
  1608. function AllocTrap(trapNum: LongInt location 'd0'): LongInt;
  1609. SysCall MOS_ExecBase 342;
  1610. procedure FreeTrap(trapNum: LongInt location 'd0');
  1611. SysCall MOS_ExecBase 348;
  1612. procedure AddPort(port: PMsgPort location 'a1');
  1613. SysCall MOS_ExecBase 354;
  1614. procedure RemPort(port: PMsgPort location 'a1');
  1615. SysCall MOS_ExecBase 360;
  1616. procedure PutMsg(port : PMsgPort location 'a0';
  1617. message: PMessage location 'a1');
  1618. SysCall MOS_ExecBase 366;
  1619. function GetMsg(port: PMsgPort location 'a0'): PMessage;
  1620. SysCall MOS_ExecBase 372;
  1621. procedure ReplyMsg(message : PMessage location 'a1');
  1622. SysCall MOS_ExecBase 378;
  1623. function WaitPort(port: PMsgPort location 'a0'): PMessage;
  1624. SysCall MOS_ExecBase 384;
  1625. function FindPort(name: PChar location 'a1'): PMsgPort;
  1626. SysCall MOS_ExecBase 390;
  1627. procedure AddLibrary(libHandle: PLibrary location 'a1');
  1628. SysCall MOS_ExecBase 396;
  1629. procedure RemLibrary(libHandle: PLibrary location 'a1');
  1630. SysCall MOS_ExecBase 402;
  1631. function OldOpenLibrary(libName: PChar location 'a1'): PLibrary;
  1632. SysCall MOS_ExecBase 408;
  1633. procedure CloseLibrary(libHandle: PLibrary location 'a1');
  1634. SysCall MOS_ExecBase 414;
  1635. function SetFunction(libHandle : PLibrary location 'a1';
  1636. funcOffset : LongInt location 'a0';
  1637. newFunction: Pointer location 'd0'): Pointer;
  1638. SysCall MOS_ExecBase 420;
  1639. procedure SumLibrary(libHandle: PLibrary location 'a1');
  1640. SysCall MOS_ExecBase 426;
  1641. procedure AddDevice(device: PDevice location 'a1');
  1642. SysCall MOS_ExecBase 432;
  1643. procedure RemDevice(device: PDevice location 'a1');
  1644. SysCall MOS_ExecBase 438;
  1645. function OpenDevice(devName : PChar location 'a0';
  1646. numunit : Cardinal location 'd0';
  1647. ioRequest: pIORequest location 'a1';
  1648. flags : Cardinal location 'd1'): ShortInt;
  1649. SysCall MOS_ExecBase 444;
  1650. procedure CloseDevice(ioRequest: PIORequest location 'a1');
  1651. SysCall MOS_ExecBase 450;
  1652. function DoIO(ioRequest: PIORequest location 'a1'): ShortInt;
  1653. SysCall MOS_ExecBase 456;
  1654. procedure SendIO(ioRequest: PIORequest location 'a1');
  1655. SysCall MOS_ExecBase 462;
  1656. function CheckIO(ioRequest: PIORequest location 'a1'): PIORequest;
  1657. SysCall MOS_ExecBase 468;
  1658. function WaitIO(ioRequest: PIORequest location 'a1'): ShortInt;
  1659. SysCall MOS_ExecBase 474;
  1660. procedure AbortIO(ioRequest: PIORequest location 'a1');
  1661. SysCall MOS_ExecBase 480;
  1662. procedure AddResource(resource: Pointer location 'a1');
  1663. SysCall MOS_ExecBase 486;
  1664. procedure RemResource(resource: Pointer location 'a1');
  1665. SysCall MOS_ExecBase 492;
  1666. function OpenResource(resName: PChar location 'a1'): Pointer;
  1667. SysCall MOS_ExecBase 498;
  1668. procedure RawIOInit;
  1669. SysCall MOS_ExecBase 504;
  1670. function RawMayGetChar: Char;
  1671. SysCall MOS_ExecBase 510;
  1672. procedure RawPutChar(d0arg: Char location 'd0');
  1673. SysCall MOS_ExecBase 516;
  1674. function RawDoFmt(formatString: PChar location 'a0';
  1675. dataStream : Pointer location 'a1';
  1676. putChProc : Pointer location 'a2';
  1677. putChData : Pointer location 'a3'): Pointer;
  1678. SysCall MOS_ExecBase 522;
  1679. function GetCC: Cardinal;
  1680. SysCall MOS_ExecBase 528;
  1681. function TypeOfMem(address: Pointer location 'a1'): Cardinal;
  1682. SysCall MOS_ExecBase 534;
  1683. function Procure(sigSem: PSignalSemaphore location 'a0';
  1684. bidMsg: PSemaphoreMessage location 'a1'): Cardinal;
  1685. SysCall MOS_ExecBase 540;
  1686. procedure Vacate(sigSem: PSignalSemaphore location 'a0';
  1687. bidMsg: PSemaphoreMessage location 'a1');
  1688. SysCall MOS_ExecBase 546;
  1689. function OpenLibrary(libname: PChar location 'a1';
  1690. libver : Cardinal location 'd0'): Pointer;
  1691. SysCall MOS_ExecBase 552;
  1692. procedure InitSemaphore(sigSem: PSignalSemaphore location 'a0');
  1693. SysCall MOS_ExecBase 558;
  1694. procedure ObtainSemaphore(sigSem: PSignalSemaphore location 'a0');
  1695. SysCall MOS_ExecBase 564;
  1696. procedure ReleaseSemaphore(sigSem: PSignalSemaphore location 'a0');
  1697. SysCall MOS_ExecBase 570;
  1698. function AttemptSemaphore(sigSem: PSignalSemaphore location 'a0'): Cardinal;
  1699. SysCall MOS_ExecBase 576;
  1700. procedure ObtainSemaphoreList(sigSem: PList location 'a0');
  1701. SysCall MOS_ExecBase 582;
  1702. procedure ReleaseSemaphoreList(sigSem: PList location 'a0');
  1703. SysCall MOS_ExecBase 588;
  1704. function FindSemaphore(sigSem: PChar location 'a1'): PSignalSemaphore;
  1705. SysCall MOS_ExecBase 594;
  1706. procedure AddSemaphore(sigSem: PSignalSemaphore location 'a1');
  1707. SysCall MOS_ExecBase 600;
  1708. procedure RemSemaphore(sigSem: PSignalSemaphore location 'a1');
  1709. SysCall MOS_ExecBase 606;
  1710. function SumKickData: Cardinal;
  1711. SysCall MOS_ExecBase 612;
  1712. procedure AddMemList(size : Cardinal location 'd0';
  1713. attributes: Cardinal location 'd1';
  1714. pri : LongInt location 'd2';
  1715. base : Pointer location 'a0';
  1716. name : PChar location 'a1');
  1717. SysCall MOS_ExecBase 618;
  1718. procedure CopyMem(source: Pointer location 'a0';
  1719. dest : Pointer location 'a1';
  1720. size : Cardinal location 'd0');
  1721. SysCall MOS_ExecBase 624;
  1722. procedure CopyMemQuick(source: Pointer location 'a0';
  1723. dest : Pointer location 'a1';
  1724. size : Cardinal location 'd0');
  1725. SysCall MOS_ExecBase 630;
  1726. procedure CacheClearU;
  1727. SysCall MOS_ExecBase 636;
  1728. procedure CacheClearE(address: Pointer location 'a0';
  1729. length : Cardinal location 'd0';
  1730. caches : Cardinal location 'd1');
  1731. SysCall MOS_ExecBase 642;
  1732. function CacheControl(cacheBits: Cardinal location 'd0';
  1733. cacheMask: Cardinal location 'd1'): Cardinal;
  1734. SysCall MOS_ExecBase 648;
  1735. function CreateIORequest(port: PMsgPort location 'a0';
  1736. size: Cardinal location 'd0'): Pointer;
  1737. SysCall MOS_ExecBase 654;
  1738. procedure DeleteIORequest(iorequest: Pointer location 'a0');
  1739. SysCall MOS_ExecBase 660;
  1740. function CreateMsgPort: PMsgPort;
  1741. SysCall MOS_ExecBase 666;
  1742. procedure DeleteMsgPort(port: PMsgPort location 'a0');
  1743. SysCall MOS_ExecBase 672;
  1744. procedure ObtainSemaphoreShared(sigSem: PSignalSemaphore location 'a0');
  1745. SysCall MOS_ExecBase 678;
  1746. function AllocVec(byteSize : Cardinal location 'd0';
  1747. requirements: Cardinal location 'd1'): Pointer;
  1748. SysCall MOS_ExecBase 684;
  1749. procedure FreeVec(memoryBlock: Pointer location 'a1');
  1750. SysCall MOS_ExecBase 690;
  1751. function CreatePool(requirements: Cardinal location 'd0';
  1752. puddleSize : Cardinal location 'd1';
  1753. threshSize : Cardinal location 'd2'): Pointer;
  1754. SysCall MOS_ExecBase 696;
  1755. procedure DeletePool(poolHeader: Pointer location 'a0');
  1756. SysCall MOS_ExecBase 702;
  1757. function AllocPooled(poolHeader: Pointer location 'a0';
  1758. memSize : Cardinal location 'd0'): Pointer;
  1759. SysCall MOS_ExecBase 708;
  1760. procedure FreePooled(poolHeader: Pointer location 'a0';
  1761. memory : Pointer location 'a1';
  1762. memSize : Cardinal location 'd0');
  1763. SysCall MOS_ExecBase 714;
  1764. function AttemptSemaphoreShared(sigSem: pSignalSemaphore location 'a0'): Cardinal;
  1765. SysCall MOS_ExecBase 720;
  1766. procedure ColdReboot;
  1767. SysCall MOS_ExecBase 726;
  1768. procedure StackSwap(newStack: PStackSwapStruct location 'a0');
  1769. SysCall MOS_ExecBase 732;
  1770. function NewGetTaskAttrsA(Task : PTask location 'a0';
  1771. Data : APTR location 'a1';
  1772. DataSize: LongWord location 'd0';
  1773. TType : LongWord location 'd1';
  1774. Tags : PTagItem location 'a2'): LongWord;
  1775. SysCall MOS_ExecBase 738;
  1776. function NewSetTaskAttrsA(Task : PTask location 'a0';
  1777. Data : APTR location 'a1';
  1778. DataSize: LongWord location 'd0';
  1779. TType : LongWord location 'd1';
  1780. Tags : PTagItem location 'a2'): LongWord;
  1781. SysCall MOS_ExecBase 744;
  1782. function CachePreDMA(address : Pointer location 'a0';
  1783. var length: Cardinal location 'a1';
  1784. flags : Cardinal location 'd0'): Pointer;
  1785. SysCall MOS_ExecBase 762;
  1786. procedure CachePostDMA(address : Pointer location 'a0';
  1787. var length: Cardinal location 'a1';
  1788. flags : Cardinal location 'd0');
  1789. SysCall MOS_ExecBase 768;
  1790. procedure AddMemHandler(memhand: PInterrupt location 'a1');
  1791. SysCall MOS_ExecBase 774;
  1792. procedure RemMemHandler(memhand: PInterrupt location 'a1');
  1793. SysCall MOS_ExecBase 780;
  1794. function ObtainQuickVector(interruptCode: Pointer location 'a0'): Cardinal;
  1795. SysCall MOS_ExecBase 786;
  1796. function NewSetFunction(libHandle : PLibrary location 'a0';
  1797. newfunction: Pointer location 'a1';
  1798. offset : LongInt location 'd0';
  1799. tags : PTagItem location 'a2'): Pointer;
  1800. SysCall MOS_ExecBase 792;
  1801. function NewCreateLibrary(Tags: PTagItem location 'a0'): PLibrary;
  1802. SysCall MOS_ExecBase 798;
  1803. function NewPPCStackSwap(newStack : PStackSwapStruct location 'a0';
  1804. sfunction: Pointer location 'a1';
  1805. args : PPPCStackSwapArgs location 'a2'): Cardinal;
  1806. SysCall MOS_ExecBase 804;
  1807. function TaggedOpenLibrary(d0arg: LongInt location 'd0'): Pointer;
  1808. SysCall MOS_ExecBase 810;
  1809. function ReadGayle: Cardinal;
  1810. SysCall MOS_ExecBase 816;
  1811. function VNewRawDoFmt(FmtString: PChar;
  1812. PutChProc: Pointer;
  1813. PutChData: PChar;
  1814. args : PChar): PChar;
  1815. SysCall BaseSysV MOS_ExecBase 822;
  1816. procedure CacheFlushDataArea(Address: Pointer location 'a0';
  1817. Size : Cardinal location 'd0');
  1818. SysCall MOS_ExecBase 828;
  1819. procedure CacheInvalidInstArea(Address: Pointer location 'a0';
  1820. Size : Cardinal location 'd0');
  1821. SysCall MOS_ExecBase 834;
  1822. procedure CacheInvalidDataArea(Address: Pointer location 'a0';
  1823. Size : Cardinal location 'd0');
  1824. SysCall MOS_ExecBase 840;
  1825. procedure CacheFlushDataInstArea(Address: Pointer location 'a0';
  1826. Size : Cardinal location 'd0');
  1827. SysCall MOS_ExecBase 846;
  1828. procedure CacheTrashCacheArea(Address: Pointer location 'a0';
  1829. Size : Cardinal location 'd0');
  1830. SysCall MOS_ExecBase 852;
  1831. function AllocTaskPooled(Size: Cardinal location 'd0'): Pointer;
  1832. SysCall MOS_ExecBase 858;
  1833. procedure FreeTaskPooled(Address: Pointer location 'a1';
  1834. Size : Cardinal location 'd0');
  1835. SysCall MOS_ExecBase 864;
  1836. function AllocVecTaskPooled(Size: Cardinal location 'd0'): Pointer;
  1837. SysCall MOS_ExecBase 870;
  1838. procedure FreeVecTaskPooled(Address: Pointer location 'a1');
  1839. SysCall MOS_ExecBase 876;
  1840. procedure FlushPool(poolHeader: Pointer location 'a0');
  1841. SysCall MOS_ExecBase 882;
  1842. procedure FlushTaskPool;
  1843. SysCall MOS_ExecBase 888;
  1844. function AllocVecPooled(poolHeader: APTR location 'a0';
  1845. memSize : LongWord location 'd0'): Pointer;
  1846. SysCall MOS_ExecBase 894;
  1847. function FreeVecPooled(poolHeader: APTR location 'a0';
  1848. memory : APTR location 'd0'): Pointer;
  1849. SysCall MOS_ExecBase 900;
  1850. function NewGetSystemAttrsA(Data : Pointer location 'a0';
  1851. DataSize: Cardinal location 'd0';
  1852. TType : Cardinal location 'd1';
  1853. Tags : PTagItem location 'a1'): Cardinal;
  1854. SysCall MOS_ExecBase 906;
  1855. function NewSetSystemAttrsA(Data : Pointer location 'a0';
  1856. DataSize: Cardinal location 'd0';
  1857. TType : Cardinal location 'd1';
  1858. Tags : PTagItem location 'a1'): Cardinal;
  1859. SysCall MOS_ExecBase 912;
  1860. function NewCreateTaskA(Tags: PTagItem location 'a0'): PTask;
  1861. SysCall MOS_ExecBase 918;
  1862. function AllocateAligned(memHeader : pMemHeader;
  1863. byteSize : Cardinal;
  1864. alignSize : Cardinal;
  1865. alignOffset: Cardinal): Pointer;
  1866. SysCall BaseSysV MOS_ExecBase 930;
  1867. function AllocMemAligned(byteSize : Cardinal;
  1868. attributes : Cardinal;
  1869. alignSize : Cardinal;
  1870. alignOffset: Cardinal): Pointer;
  1871. SysCall BaseSysV MOS_ExecBase 936;
  1872. function AllocVecAligned(byteSize : Cardinal;
  1873. attributes : Cardinal;
  1874. alignSize : Cardinal;
  1875. alignOffset: Cardinal): Pointer;
  1876. SysCall BaseSysV MOS_ExecBase 942;
  1877. procedure AddExecNotify(hook: PHook);
  1878. SysCall BaseSysV MOS_ExecBase 948;
  1879. procedure RemExecNotify(hook: PHook);
  1880. SysCall BaseSysV MOS_ExecBase 954;
  1881. function FindExecNode(ttype: Cardinal location 'd0';
  1882. name : PChar location 'a0'): PNode;
  1883. SysCall MOS_ExecBase 960;
  1884. function AddExecNodeA(innode : Pointer location 'a0';
  1885. TagItems: PTagItem location 'a1'): Pointer;
  1886. SysCall MOS_ExecBase 966;
  1887. function AllocVecDMA(byteSize : Cardinal location 'd0';
  1888. requirements: Cardinal location 'd1'): Pointer;
  1889. SysCall MOS_ExecBase 972;
  1890. procedure FreeVecDMA(memoryBlock: Pointer location 'a1');
  1891. SysCall MOS_ExecBase 978;
  1892. function AllocPooledAligned(poolHeader : Pointer;
  1893. byteSize : Cardinal;
  1894. alignSize : Cardinal;
  1895. alignOffset: Cardinal): Pointer;
  1896. SysCall BaseSysV MOS_ExecBase 984;
  1897. function AddResident(resident: pResident location 'd0'): LongInt;
  1898. SysCall BaseSysV MOS_ExecBase 990;
  1899. function FindTaskByPID(processID: Cardinal): PTask;
  1900. SysCall BaseSysV MOS_ExecBase 996;
  1901. procedure DumpTaskState(Task: PTask location 'a0') syscall MOS_ExecBase 1026;
  1902. procedure AddExecNotifyType(Hook: PHook; Type_: LongInt); SysCall BaseSysV MOS_ExecBase 1030;
  1903. function ShutdownA(MyTags: PTagItem): LongWord; SysCall BaseSysV MOS_ExecBase 1036;
  1904. function AvailPool(PoolHeader: APTR; Flags: LongWord): LongWord; SysCall BaseSysV MOS_ExecBase 1048;
  1905. procedure PutMsgHead(Port: PMsgPort; Message: PMessage); SysCall BaseSysV MOS_ExecBase 1060;
  1906. function NewGetTaskPIDAttrsA(PID: LongWord location 'd0'; Data: APTR location 'a0'; DataSize: LongWord location 'd1'; Type_: LongWord location 'd2'; Tags: PTagItem location 'a1'): LongWord; SysCall MOS_ExecBase 1068;
  1907. function NewSetTaskPIDAttrsA(PID: LongWord location 'd0'; Data: APTR location 'a0'; DataSize: LongWord location 'd1'; Type_: LongWord location 'd2'; Tags: PTagItem location 'a1'): LongWord; SysCall MOS_ExecBase 1074;
  1908. function NewGetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: LongWord; const Tags: array of PtrUInt): LongWord; Inline;
  1909. function NewSetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: Cardinal; const Tags: array of PtrUInt): LongWord; Inline;
  1910. function NewCreateLibraryTags(const Tags: array of PtrUInt): PLibrary; inline;
  1911. function NewGetSystemAttrs(Data: APTR; DataSize, MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1912. function NewSetSystemAttrs(Data: APTR; DataSize, MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1913. function NewCreateTask(const Tags: array of PtrUInt): PTask; inline;
  1914. function AddExecNode(InNode: APTR; const Tags: array of PtrUInt): APTR; inline;
  1915. function NewGetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize, Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1916. function NewSetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize, Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1917. function CreateExtIO(const Mp: PMsgPort; Size: Integer): PIORequest;
  1918. procedure DeleteExtIO(ioReq: PIORequest);
  1919. implementation
  1920. function NewGetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: LongWord; const Tags: array of PtrUInt): LongWord; Inline;
  1921. begin
  1922. NewGetTaskAttrs := NewGetTaskAttrsA(Task, Data, DataSize, TType, @Tags);
  1923. end;
  1924. function NewSetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: LongWord; const Tags: array of DWord): LongWord; Inline;
  1925. begin
  1926. NewSetTaskAttrs := NewSetTaskAttrsA(Task, Data, DataSize, TType, @Tags);
  1927. end;
  1928. function NewCreateLibraryTags(const Tags: array of PtrUInt): PLibrary; inline;
  1929. begin
  1930. NewCreateLibraryTags := NewCreateLibrary(@Tags);
  1931. end;
  1932. function NewGetSystemAttrs(Data: APTR; DataSize: LongWord; MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1933. begin
  1934. NewGetSystemAttrs := NewGetSystemAttrsA(Data, DataSize, MyType, @Tags);
  1935. end;
  1936. function NewSetSystemAttrs(Data: APTR; DataSize: LongWord; MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1937. begin
  1938. NewSetSystemAttrs := NewSetSystemAttrsA(Data, DataSize, MyType, @Tags);
  1939. end;
  1940. function NewCreateTask(const Tags: array of PtrUInt): PTask; inline;
  1941. begin
  1942. NewCreateTask := NewCreateTaskA(@Tags);
  1943. end;
  1944. function AddExecNode(InNode: APTR; const Tags: array of PtrUInt): APTR; inline;
  1945. begin
  1946. AddExecNode := AddExecNodeA(InNode, @Tags);
  1947. end;
  1948. function NewGetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize: LongWord; Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1949. begin
  1950. NewGetTaskPIDAttrs := NewGetTaskPIDAttrsA(PID, Data, DataSize, Type_, @Tags);
  1951. end;
  1952. function NewSetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize: LongWord; Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1953. begin
  1954. NewSetTaskPIDAttrs := NewSetTaskPIDAttrsA(PID, Data, DataSize, Type_, @Tags);
  1955. end;
  1956. function GetEmulHandle: PEmulHandle; assembler; nostackframe;
  1957. asm
  1958. mr r3,r2
  1959. end;
  1960. function REG_D0: DWord; assembler; nostackframe;
  1961. asm
  1962. lwz r3,0(r2)
  1963. end;
  1964. function REG_D1: DWord; assembler; nostackframe;
  1965. asm
  1966. lwz r3,4(r2)
  1967. end;
  1968. function REG_D2: DWord; assembler; nostackframe;
  1969. asm
  1970. lwz r3,8(r2)
  1971. end;
  1972. function REG_D3: DWord; assembler; nostackframe;
  1973. asm
  1974. lwz r3,12(r2)
  1975. end;
  1976. function REG_D4: DWord; assembler; nostackframe;
  1977. asm
  1978. lwz r3,16(r2)
  1979. end;
  1980. function REG_D5: DWord; assembler; nostackframe;
  1981. asm
  1982. lwz r3,20(r2)
  1983. end;
  1984. function REG_D6: DWord; assembler; nostackframe;
  1985. asm
  1986. lwz r3,24(r2)
  1987. end;
  1988. function REG_D7: DWord; assembler; nostackframe;
  1989. asm
  1990. lwz r3,28(r2)
  1991. end;
  1992. function REG_A0: Pointer; assembler; nostackframe;
  1993. asm
  1994. lwz r3,32(r2)
  1995. end;
  1996. function REG_A1: Pointer; assembler; nostackframe;
  1997. asm
  1998. lwz r3,36(r2)
  1999. end;
  2000. function REG_A2: Pointer; assembler; nostackframe;
  2001. asm
  2002. lwz r3,40(r2)
  2003. end;
  2004. function REG_A3: Pointer; assembler; nostackframe;
  2005. asm
  2006. lwz r3,44(r2)
  2007. end;
  2008. function REG_A4: Pointer; assembler; nostackframe;
  2009. asm
  2010. lwz r3,48(r2)
  2011. end;
  2012. function REG_A5: Pointer; assembler; nostackframe;
  2013. asm
  2014. lwz r3,52(r2)
  2015. end;
  2016. function REG_A6: Pointer; assembler; nostackframe;
  2017. asm
  2018. lwz r3,56(r2)
  2019. end;
  2020. function REG_A7: Pointer; assembler; nostackframe;
  2021. asm
  2022. lwz r3,60(r2)
  2023. end;
  2024. function REG_PC: Pointer; assembler; nostackframe;
  2025. asm
  2026. lwz r3,64(r2)
  2027. end;
  2028. function REG_SR: DWord; assembler; nostackframe;
  2029. asm
  2030. lwz r3,68(r2)
  2031. end;
  2032. function CreateExtIO(const Mp: PMsgPort; Size: Integer): PIORequest;
  2033. begin
  2034. CreateExtIO := nil;
  2035. if not Assigned(mp) then
  2036. Exit;
  2037. CreateExtIO := System.AllocMem(Size);
  2038. if Assigned(CreateExtIO) then
  2039. begin
  2040. CreateExtIO^.io_Message.mn_Node.ln_Type := NT_REPLYMSG;
  2041. CreateExtIO^.io_Message.mn_ReplyPort := Mp;
  2042. CreateExtIO^.io_Message.mn_Length := Size;
  2043. end;
  2044. end;
  2045. procedure DeleteExtIO(ioReq: PIORequest);
  2046. begin
  2047. if Assigned(ioReq) then
  2048. begin
  2049. ioReq^.io_Message.mn_Node.ln_Type := Byte(-1);
  2050. ioReq^.io_Device := Pointer(-1);
  2051. ioReq^.io_Unit := Pointer(-1);
  2052. System.FreeMem(ioReq);
  2053. end;
  2054. end;
  2055. begin
  2056. ExecBase:=MOS_ExecBase;
  2057. end.