exec.pas 77 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545
  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. // Added in exec 50.67
  578. TASKINFOTYPE_EXCEPTIONCOUNT = $2e; // Get task exception count (LongWord)
  579. TASKINFOTYPE_HITCOUNT = $2f; // Get task hit count (LongWord)
  580. // Added in exec 51.3
  581. TASKINFOTYPE_MAXHITCOUNT = $30; // Get/Set task max hit count. If more hits happen the task is put to sleep. (LongWord)
  582. // Added in exec 51.13
  583. TASKINFOTYPE_ALERTCOUNT = $31; // Get task alert count (LongWord)
  584. TASKINFOTYPE_MAXALERTCOUNT = $32; // Get/Set task max alert count. If more alerts happen the task is put to sleep. (LongWord)
  585. // Added in exec 51.14
  586. TASKINFOTYPE_PID = $33; // Get task unique ID. This ID is unique to every task. (LongWord)
  587. TASKINFOTYPE_68K_NEWFRAME = $50;
  588. TASKINFOTYPE_PPC_SRR0 = $100;
  589. TASKINFOTYPE_PPC_SRR1 = $101;
  590. TASKINFOTYPE_PPC_LR = $102;
  591. TASKINFOTYPE_PPC_CTR = $103;
  592. TASKINFOTYPE_PPC_CR = $104;
  593. TASKINFOTYPE_PPC_XER = $105;
  594. TASKINFOTYPE_PPC_GPR = $106;
  595. TASKINFOTYPE_PPC_FPR = $107;
  596. TASKINFOTYPE_PPC_FPSCR = $108;
  597. TASKINFOTYPE_PPC_VSCR = $109;
  598. TASKINFOTYPE_PPC_VMX = $10a;
  599. TASKINFOTYPE_PPC_VSAVE = $10b;
  600. TASKINFOTYPE_PPC_FRAME = $10c;
  601. TASKINFOTYPE_PPC_FRAMESIZE = $10d;
  602. TASKINFOTYPE_PPC_NEWFRAME = $10e;
  603. TASKINFOTAG_DUMMY = (TAG_USER + $110000);
  604. TASKINFOTAG_HOOK = (TASKINFOTAG_DUMMY + $0); // Used with TASKINFOTYPE_ALLTASK
  605. TASKINFOTAG_REGSTART = (TASKINFOTAG_DUMMY + $1); // Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX to define the copy area
  606. TASKINFOTAG_REGCOUNT = (TASKINFOTAG_DUMMY + $2); // Used with TASKINFOTYPE_PPC_GPR,TASKINFOTYPE_PPC_FPR,TASKINFOTYPE_PPC_VMX to define the copy area
  607. { *
  608. * NewSetTaskAttrsA(..,@TaskFrame68k, sizeof(TTaskFrame68k), TASKINFOTYPE_68K_NEWFRAME,...);
  609. * }
  610. type
  611. PTaskFrame68k = ^TTaskFrame68k;
  612. TTaskFrame68k = packed record
  613. PC: Pointer;
  614. SR: Word;
  615. Xn: Array[0..14] Of LongWord;
  616. end;
  617. { *
  618. * Don't depend on these
  619. * }
  620. const
  621. DEFAULT_PPCSTACKSIZE = 32768;
  622. DEFAULT_M68KSTACKSIZE = 2048;
  623. DEFAULT_TASKPUDDLESIZE = 4096;
  624. DEFAULT_TASKTHRESHSIZE = 4096;
  625. PID_CURRENT = 0;
  626. { * exec alert definitions (V50)
  627. *********************************************************************
  628. * }
  629. const
  630. ACPU_BusErr = $80000002;
  631. ACPU_AddressErr = $80000003;
  632. ACPU_InstErr = $80000004;
  633. ACPU_DivZero = $80000005;
  634. ACPU_CHK = $80000006;
  635. ACPU_TRAPV = $80000007;
  636. ACPU_PrivErr = $80000008;
  637. ACPU_Trace = $80000009;
  638. ACPU_LineA = $8000000A;
  639. ACPU_LineF = $8000000B;
  640. ACPU_Format = $8000000E;
  641. ACPU_Spurious = $80000018;
  642. ACPU_AutoVec1 = $80000019;
  643. ACPU_AutoVec2 = $8000001A;
  644. ACPU_AutoVec3 = $8000001B;
  645. ACPU_AutoVec4 = $8000001C;
  646. ACPU_AutoVec5 = $8000001D;
  647. ACPU_AutoVec6 = $8000001E;
  648. ACPU_AutoVec7 = $8000001F;
  649. AT_DeadEnd = $80000000;
  650. AT_Recovery = $00000000;
  651. AG_NoMemory = $00010000;
  652. AG_MakeLib = $00020000;
  653. AG_OpenLib = $00030000;
  654. AG_OpenDev = $00040000;
  655. AG_OpenRes = $00050000;
  656. AG_IOError = $00060000;
  657. AG_NoSignal = $00070000;
  658. AG_BadParm = $00080000;
  659. AG_CloseLib = $00090000;
  660. AG_CloseDev = $000A0000;
  661. AG_ProcCreate = $000B0000;
  662. AG_MsgPortNotEmpty = $000C0000 { * V50 * };
  663. AO_ExecLib = $00008001;
  664. AO_GraphicsLib = $00008002;
  665. AO_LayersLib = $00008003;
  666. AO_Intuition = $00008004;
  667. AO_MathLib = $00008005;
  668. AO_DOSLib = $00008007;
  669. AO_RAMLib = $00008008;
  670. AO_IconLib = $00008009;
  671. AO_ExpansionLib = $0000800A;
  672. AO_DiskfontLib = $0000800B;
  673. AO_UtilityLib = $0000800C;
  674. AO_KeyMapLib = $0000800D;
  675. AO_AudioDev = $00008010;
  676. AO_ConsoleDev = $00008011;
  677. AO_GamePortDev = $00008012;
  678. AO_KeyboardDev = $00008013;
  679. AO_TrackDiskDev = $00008014;
  680. AO_TimerDev = $00008015;
  681. AO_CIARsrc = $00008020;
  682. AO_DiskRsrc = $00008021;
  683. AO_MiscRsrc = $00008022;
  684. AO_BootStrap = $00008030;
  685. AO_Workbench = $00008031;
  686. AO_DiskCopy = $00008032;
  687. AO_GadTools = $00008033;
  688. AO_Unknown = $00008035;
  689. // exec.library
  690. AN_ExecLib = $01000000;
  691. AN_ExcptVect = $01000001;
  692. AN_BaseChkSum = $01000002;
  693. AN_LibChkSum = $01000003;
  694. AN_MemCorrupt = $81000005;
  695. AN_IntrMem = $81000006;
  696. AN_InitAPtr = $01000007;
  697. AN_SemCorrupt = $01000008;
  698. AN_FreeTwice = $01000009;
  699. AN_BogusExcpt = $8100000A;
  700. AN_IOUsedTwice = $0100000B;
  701. AN_MemoryInsane = $0100000C;
  702. AN_IOAfterClose = $0100000D;
  703. AN_StackProbe = $0100000E;
  704. AN_BadFreeAddr = $0100000F;
  705. AN_BadSemaphore = $01000010;
  706. // graphics.library
  707. AN_GraphicsLib = $02000000;
  708. AN_GfxNoMem = $82010000;
  709. AN_GfxNoMemMspc = $82010001;
  710. AN_LongFrame = $82010006;
  711. AN_ShortFrame = $82010007;
  712. AN_TextTmpRas = $02010009;
  713. AN_BltBitMap = $8201000A;
  714. AN_RegionMemory = $8201000B;
  715. AN_MakeVPort = $82010030;
  716. AN_GfxNewError = $0200000C;
  717. AN_GfxFreeError = $0200000D;
  718. AN_GfxNoLCM = $82011234;
  719. AN_ObsoleteFont = $02000401;
  720. // layers.library
  721. AN_LayersLib = $03000000;
  722. AN_LayersNoMem = $83010000;
  723. // intuition.library
  724. AN_Intuition = $04000000;
  725. AN_GadgetType = $84000001;
  726. AN_BadGadget = $04000001;
  727. AN_CreatePort = $84010002;
  728. AN_ItemAlloc = $04010003;
  729. AN_SubAlloc = $04010004;
  730. AN_PlaneAlloc = $84010005;
  731. AN_ItemBoxTop = $84000006;
  732. AN_OpenScreen = $84010007;
  733. AN_OpenScrnRast = $84010008;
  734. AN_SysScrnType = $84000009;
  735. AN_AddSWGadget = $8401000A;
  736. AN_OpenWindow = $8401000B;
  737. AN_BadState = $8400000C;
  738. AN_BadMessage = $8400000D;
  739. AN_WeirdEcho = $8400000E;
  740. AN_NoConsole = $8400000F;
  741. AN_NoISem = $04000010;
  742. AN_ISemOrder = $04000011;
  743. // math.library
  744. AN_MathLib = $05000000;
  745. // dos.library
  746. AN_DOSLib = $07000000;
  747. AN_StartMem = $07010001;
  748. AN_EndTask = $07000002;
  749. AN_QPktFail = $07000003;
  750. AN_AsyncPkt = $07000004;
  751. AN_FreeVec = $07000005;
  752. AN_DiskBlkSeq = $07000006;
  753. AN_BitMap = $07000007;
  754. AN_KeyFree = $07000008;
  755. AN_BadChkSum = $07000009;
  756. AN_DiskError = $0700000A;
  757. AN_KeyRange = $0700000B;
  758. AN_BadOverlay = $0700000C;
  759. AN_BadInitFunc = $0700000D;
  760. AN_FileReclosed = $0700000E;
  761. // ramlib.library
  762. AN_RAMLib = $08000000;
  763. AN_BadSegList = $08000001;
  764. // icon.library
  765. AN_IconLib = $09000000;
  766. // expansion.library
  767. AN_ExpansionLib = $0A000000;
  768. AN_BadExpansionFree = $0A000001;
  769. // diskfont.library
  770. AN_DiskfontLib = $0B000000;
  771. // audio.device
  772. AN_AudioDev = $10000000;
  773. // console.device
  774. AN_ConsoleDev = $11000000;
  775. AN_NoWindow = $11000001;
  776. // gameport.device
  777. AN_GamePortDev = $12000000;
  778. // keyboard.device
  779. AN_KeyboardDev = $13000000;
  780. // trackdisk.device
  781. AN_TrackDiskDev = $14000000;
  782. AN_TDCalibSeek = $14000001;
  783. AN_TDDelay = $14000002;
  784. // timer.device
  785. AN_TimerDev = $15000000;
  786. AN_TMBadReq = $15000001;
  787. AN_TMBadSupply = $15000002;
  788. // cia.resource
  789. AN_CIARsrc = $20000000;
  790. // disk.resource
  791. AN_DiskRsrc = $21000000;
  792. AN_DRHasDisk = $21000001;
  793. AN_DRIntNoAct = $21000002;
  794. // misc.resource
  795. AN_MiscRsrc = $22000000;
  796. // bootstrap
  797. AN_BootStrap = $30000000;
  798. AN_BootError = $30000001;
  799. // Workbench
  800. AN_Workbench = $31000000;
  801. AN_NoFonts = $B1000001;
  802. AN_WBBadStartupMsg1 = $31000001;
  803. AN_WBBadStartupMsg2 = $31000002;
  804. AN_WBBadIOMsg = $31000003;
  805. AN_WBReLayoutToolMenu = $B1010009;
  806. // DiskCopy
  807. AN_DiskCopy = $32000000;
  808. // toolkit for Intuition
  809. AN_GadTools = $33000000;
  810. // System utility library
  811. AN_UtilityLib = $34000000;
  812. // For use by any application that needs it
  813. AN_Unknown = $35000000;
  814. type
  815. TAlertMessage = packed record
  816. Message: TMessage; // Message Header
  817. Task: PTask; // connected Task
  818. Version: LongWord; // version of the structure
  819. ID: LongWord; // AlertID
  820. // some more things following, do not assume size of structure
  821. end;
  822. const
  823. VERSION_ALERTMESSAGE = 0;
  824. { * exec interrupt definitions (V50)
  825. *********************************************************************
  826. * }
  827. type
  828. PInterrupt = ^TInterrupt;
  829. TInterrupt = packed record
  830. is_Node: TNode;
  831. is_Data: APTR;
  832. is_Code: Pointer;
  833. end;
  834. PIntVector = ^TIntVector;
  835. TIntVector = packed record
  836. iv_Data: APTR;
  837. iv_Code: Pointer;
  838. iv_Node: PNode;
  839. end;
  840. PSoftIntList = ^TSoftIntList;
  841. TSoftIntList = packed record
  842. sh_List: TList;
  843. sh_Pad: Word;
  844. end;
  845. const
  846. SIH_PRIMASK = $f0;
  847. INTB_NMI = 15;
  848. INTF_NMI = 1 Shl INTB_NMI;
  849. { * exec semaphore definitions (V50)
  850. *********************************************************************
  851. * }
  852. { *
  853. * Shouldn't be available public..
  854. * }
  855. type
  856. PSemaphoreRequest = ^TSemaphoreRequest;
  857. TSemaphoreRequest = packed record
  858. sr_Link : TMinNode;
  859. sr_Waiter: PTask;
  860. end;
  861. PSignalSemaphore = ^TSignalSemaphore;
  862. TSignalSemaphore = packed record
  863. ss_Link : TNode;
  864. ss_NestCount : SmallInt;
  865. ss_WaitQueue : TMinList;
  866. ss_MultipleLink: TSemaphoreRequest;
  867. ss_Owner : PTask;
  868. ss_QueueCount : SmallInt;
  869. end;
  870. PSemaphoreMessage = ^TSemaphoreMessage;
  871. TSemaphoreMessage = packed record
  872. ssm_Message : TMessage;
  873. ssm_Semaphore: PSignalSemaphore;
  874. end;
  875. const
  876. SM_SHARED = 1;
  877. SM_EXCLUSIVE = 0;
  878. { * exec machine definitions (V50)
  879. *********************************************************************
  880. * }
  881. const
  882. MACHINE_M68k = $0;
  883. MACHINE_PPC = $1;
  884. MACHINE_NO = $ffffffff;
  885. { * exec library definitions (V50)
  886. *********************************************************************
  887. * }
  888. const
  889. LIB_VECTSIZE = 6;
  890. LIB_RESERVED = 4;
  891. LIB_BASE = -LIB_VECTSIZE;
  892. LIB_USERDEF = LIB_BASE - (LIB_RESERVED * LIB_VECTSIZE);
  893. LIB_NONSTD = LIB_USERDEF;
  894. LIB_OPEN = -6;
  895. LIB_CLOSE = -12;
  896. LIB_EXPUNGE = -18;
  897. LIB_EXTFUNC = -24;
  898. LIB_GETQUERYATTR = -24; { * LIBF_QUERY * }
  899. type
  900. PLibrary = ^TLibrary;
  901. TLibrary = packed record
  902. lib_Node : TNode;
  903. lib_Flags : Byte;
  904. lib_pad : Byte;
  905. lib_NegSize : Word;
  906. lib_PosSize : Word;
  907. lib_Version : Word;
  908. lib_Revision: Word;
  909. lib_IdString: PChar;
  910. lib_Sum : LongWord;
  911. lib_OpenCnt : Word;
  912. end;
  913. const
  914. LIBF_SUMMING = 1 Shl 0;
  915. LIBF_CHANGED = 1 Shl 1;
  916. LIBF_SUMUSED = 1 Shl 2;
  917. LIBF_DELEXP = 1 Shl 3;
  918. // private
  919. LIBF_RAMLIB = 1 Shl 4;
  920. // Needs to be set if the GetQueryAttr function is legal
  921. LIBF_QUERYINFO = 1 Shl 5;
  922. // The remaining bits are reserved and aren`t allowed to be touched
  923. const
  924. // NewSetFunction extensions
  925. SETFUNCTAG_Dummy = TAG_USER +$01000000;
  926. SETFUNCTAG_MACHINE = SETFUNCTAG_Dummy + $1; // Set the machine type of the function Default is 68k
  927. SETFUNCTAG_TYPE = SETFUNCTAG_Dummy + $2; // Function type specifier
  928. SETFUNCTAG_IDNAME = SETFUNCTAG_Dummy + $3; // ID String
  929. SETFUNCTAG_DELETE = SETFUNCTAG_Dummy + $4; // Set to TRUE if the replaced function will never be used again.
  930. SETFUNCTYPE_NORMAL = 0; // Save Emulation PPC Registers, Call Function, Restore Emulation PPC Registers, REG_D0 = Result
  931. SETFUNCTYPE_QUICK = 1; // Call Function, Must use the global register settings of the emulation, REG_D0 = Result
  932. { Save Emulation PPC Registers, Call Function, Restore Emulation PPC Registers
  933. No Result, Needed to replace functions like, forbid,obtainsemaphores which are
  934. defined as trashing no registers}
  935. SETFUNCTYPE_NORMALNR = 2;
  936. { Call Function, Must use the global register settings of the emulation
  937. No Result, Needed to replace functions like forbid,obtainsemaphores which are
  938. defined as trashing no registers }
  939. SETFUNCTYPE_QUICKNR = 3;
  940. SETFUNCTYPE_NORMALSR = 4;
  941. SETFUNCTYPE_NORMALSRNR = 5;
  942. SETFUNCTYPE_NORMALD0_D1 = 6;
  943. SETFUNCTYPE_NORMALRESTORE = 7;
  944. SETFUNCTYPE_SYSTEMV = 8;
  945. SETFUNCTYPE_NORMALD0D1SR = 9;
  946. SETFUNCTYPE_NORMALD0D1A0A1SR = 10;
  947. // CreateLibrary extensions
  948. LIBTAG_BASE = TAG_USER + $01000100;
  949. LIBTAG_FUNCTIONINIT = LIBTAG_BASE+$0; // Function/Vector Array
  950. LIBTAG_STRUCTINIT = LIBTAG_BASE+$1; // Struct Init
  951. LIBTAG_LIBRARYINIT = LIBTAG_BASE+$2; // Library Init
  952. LIBTAG_MACHINE = LIBTAG_BASE+$3; // Init Code Type
  953. LIBTAG_BASESIZE = LIBTAG_BASE+$4; // Library Base Size
  954. LIBTAG_SEGLIST = LIBTAG_BASE+$5; // SegList Ptr
  955. LIBTAG_PRI = LIBTAG_BASE+$6; // Library Priority
  956. LIBTAG_TYPE = LIBTAG_BASE+$7; // Library Type..Library,Device,Resource,whatever
  957. LIBTAG_VERSION = LIBTAG_BASE+$8; // Library Version (LongWord)
  958. LIBTAG_FLAGS = LIBTAG_BASE+$9; // Library Flags
  959. LIBTAG_NAME = LIBTAG_BASE+$a; // Library Name
  960. LIBTAG_IDSTRING = LIBTAG_BASE+$b; // Library IDString
  961. { AddDevice(),AddLibrary(),AddResource()..
  962. depends on LibNode.ln_Type field which can be set by some Init function, Struct Scripts
  963. or LIBTAG_TYPE. If you set LIBTAG_PUBLIC the library is added to the right system list.}
  964. LIBTAG_PUBLIC = LIBTAG_BASE+$c;
  965. LIBTAG_REVISION = (LIBTAG_BASE+$d); // Library Revision (LongWord)
  966. LIBTAG_QUERYINFO = (LIBTAG_BASE+$e); // Library QueryInfo Flag (Boolean)
  967. type
  968. // Private don`t touch...floating design
  969. PFuncEntry = ^TFuncEntry;
  970. TFuncEntry = packed record
  971. EmulLibEntry : TEmulLibEntry;
  972. OldFunction : Pointer; { * Needed for bookkeeping * }
  973. end;
  974. PFuncOldEntry = ^TFuncOldEntry;
  975. TFuncOldEntry = packed record
  976. Command : Word;
  977. FuncEntry: PFuncEntry;
  978. end;
  979. // EmulLibEntry.Extension
  980. const
  981. FUNCENTRYEXTF_LIBRARY = $1; // Entry created by the OS
  982. FUNCENTRYEXTF_SETFUNCTION = $2; // Entry created by SetFunction, otherwise MakeFunction
  983. { *
  984. * Functionarray first ULONG ID defines the format
  985. * of the functionarray for MakeFunctions()/MakeLibrary().
  986. *
  987. * If there`s not such id the functionarray is a
  988. * 32Bit 68k function ptr array.
  989. * (LongWord) $ffffffff stops it
  990. * }
  991. { * 68k 16bit relative functionarray ptrs
  992. * (Word) $ffff stops it
  993. * }
  994. FUNCARRAY_16BIT_OLD = $ffffffff;
  995. { * PPC 32bit functionarray ptrs
  996. * (ULONG) $ffff stops it
  997. * }
  998. FUNCARRAY_32BIT_NATIVE = $fffefffe;
  999. { * Starts a functionarray block.
  1000. * This way it`s possible to mix 68k and PPC
  1001. * function definitions.
  1002. * BASE:
  1003. * FUNCTIONARRAY_BEGIN
  1004. * FUNCARRAY_32BIT_NATIVE
  1005. * FUNC0
  1006. * FUNC1
  1007. * .
  1008. * FUNCn
  1009. * $ffffffff
  1010. * FUNCn+1 (No ID->32Bit 68k)
  1011. * FUNCn+2
  1012. * .
  1013. * FUNCm
  1014. * $ffffffff
  1015. * FUNCARRAY_16BIT_OLD
  1016. * FUNCm+1-BASE
  1017. * FUNCm+2-BASE
  1018. * .
  1019. * FUNCo-BASE
  1020. * $ffff
  1021. * FUNCTIONARRAY_END
  1022. * }
  1023. FUNCARRAY_BEGIN = $fffdfffd;
  1024. { * Ends a functionarray block.
  1025. * }
  1026. FUNCARRAY_END = $fffcfffc;
  1027. { * PPC 32bit Quick functionarray ptrs.
  1028. * These functions must comply to the emulation's
  1029. * register layout which is defined inside the
  1030. * emul/emulregs.h. That means the register layout
  1031. * MUST also be valid during interrupts/task switches.
  1032. * You can't just destroy A7(r31), SR or PC.
  1033. *
  1034. * You shouldn't use this for any normal code
  1035. * as there's no real reason to do so. If you
  1036. * really think you need to use it please ask
  1037. * us first on the dev mailinglist.
  1038. * (ULONG) $ffffffff stops it
  1039. * }
  1040. FUNCARRAY_32BIT_QUICK_NATIVE = $fffbfffb;
  1041. { * PPC 32bit QuickNR(No Result) functionarray ptrs
  1042. * (ULONG) $ffffffff stops it
  1043. * }
  1044. FUNCARRAY_32BIT_QUICKNR_NATIVE = $fffafffa;
  1045. { * PPC 32bit no result functionarray ptrs
  1046. * (ULONG) $ffffffff stops it
  1047. * }
  1048. FUNCARRAY_32BIT_NR_NATIVE = $fff9fff9;
  1049. { * PPC 32bit SR functionarray ptrs
  1050. * (ULONG) $ffffffff stops it
  1051. * }
  1052. FUNCARRAY_32BIT_SR_NATIVE = $fff8fff8;
  1053. { * PPC 32bit SR(no result) functionarray ptrs
  1054. * (ULONG) $ffffffff stops it
  1055. * }
  1056. FUNCARRAY_32BIT_SRNR_NATIVE = $fff7fff7;
  1057. { * PPC 32bit D0_D1 functionarray ptrs
  1058. * (ULONG) $ffffffff stops it
  1059. * }
  1060. FUNCARRAY_32BIT_D0D1_NATIVE = $fff6fff6;
  1061. { * PPC 32bit Restore1 functionarray ptrs
  1062. * (ULONG) $ffffffff stops it
  1063. * }
  1064. FUNCARRAY_32BIT_RESTORE_NATIVE = $fff5fff5;
  1065. { * PPC 32bit SystemV ABI entry
  1066. * these function entries DON'T comply
  1067. * to the amiga register modell REG_D0-A6
  1068. * but comply to the PPC SystemV ABI so
  1069. * you can directly use PPC C Argument
  1070. * parsing. That way you're also not limited
  1071. * with the register count.
  1072. * Such library functions can't be used
  1073. * by 68k emulation, so you can only use
  1074. * them for new code.
  1075. * As we allow these new functions to be
  1076. * used with old functions we keep the
  1077. * 6 bytes function entry steps in the library.
  1078. * Layout is
  1079. *
  1080. * CODE_JMP, &FuncEntry ; Old Entry
  1081. * CODE_ILLEGAL, Function ; SystemV ABI Entry
  1082. *
  1083. *
  1084. * (ULONG) $ffffffff stops it
  1085. * }
  1086. FUNCARRAY_32BIT_SYSTEMV = $fff4fff4;
  1087. { * PPC 32bit D0D1SR functionarray ptrs
  1088. * (ULONG) $ffffffff stops it
  1089. * }
  1090. FUNCARRAY_32BIT_D0D1SR_NATIVE = $fff3fff3;
  1091. { * PPC 32bit D0D1A0A1SR functionarray ptrs
  1092. * (ULONG) $ffffffff stops it
  1093. * }
  1094. FUNCARRAY_32BIT_D0D1A0A1SR_NATIVE = $fff2fff2;
  1095. { * exec device definitions (V50)
  1096. *********************************************************************
  1097. * }
  1098. type
  1099. PDevice = ^TDevice;
  1100. TDevice = packed record
  1101. dd_Library: TLibrary;
  1102. end;
  1103. type
  1104. PUnit = ^TUnit;
  1105. TUnit = packed record
  1106. unit_MsgPort: TMsgPort;
  1107. unit_flags : Byte;
  1108. unit_pad : Byte;
  1109. unit_OpenCnt: Word;
  1110. end;
  1111. const
  1112. UNITF_ACTIVE = 1 Shl 0;
  1113. UNITF_INTASK = 1 Shl 1;
  1114. { * exec io definitions (V50)
  1115. *********************************************************************
  1116. * }
  1117. type
  1118. PIORequest = ^TIORequest;
  1119. TIORequest = packed record
  1120. io_Message: TMessage;
  1121. io_Device : PDevice;
  1122. io_Unit : PUnit;
  1123. io_Command: Word;
  1124. io_Flags : Byte;
  1125. io_Error : ShortInt;
  1126. end;
  1127. type
  1128. PIOStdReq = ^TIOStdReq;
  1129. TIOStdReq = packed record
  1130. io_Message: TMessage;
  1131. io_Device : PDevice;
  1132. io_Unit : PUnit;
  1133. io_Command: Word;
  1134. io_Flags : Byte;
  1135. io_Error : ShortInt;
  1136. io_Actual : DWord;
  1137. io_Length : DWord;
  1138. io_Data : Pointer;
  1139. io_Offset : DWord;
  1140. end;
  1141. const
  1142. DEV_BEGINIO = -30;
  1143. DEV_ABORTIO = -36;
  1144. IOB_QUICK = 0;
  1145. IOF_QUICK = 1 Shl IOB_QUICK;
  1146. CMD_INVALID = 0;
  1147. CMD_RESET = 1;
  1148. CMD_READ = 2;
  1149. CMD_WRITE = 3;
  1150. CMD_UPDATE = 4;
  1151. CMD_CLEAR = 5;
  1152. CMD_STOP = 6;
  1153. CMD_START = 7;
  1154. CMD_FLUSH = 8;
  1155. CMD_NONSTD = 9;
  1156. { * exec include (V50)
  1157. *********************************************************************
  1158. * }
  1159. const
  1160. CPUTBSTACKTRACECOUNT = 16;
  1161. type
  1162. PExecBase = ^TExecBase;
  1163. TExecBase = packed record
  1164. LIbNode : TLibrary;
  1165. SoftVer : Word;
  1166. LowMemChkSum: SmallInt;
  1167. ChkBase : LongWord;
  1168. ColdCapture : APTR;
  1169. CoolCapture : APTR;
  1170. WarmCapture : APTR;
  1171. SysStkUpper : APTR;
  1172. SysStkLower : APTR;
  1173. MaxLocMem : LongWord;
  1174. DebugEntry : APTR;
  1175. DebugData : APTR;
  1176. AlertData : APTR;
  1177. MaxExtMem : APTR;
  1178. ChkSum : Word;
  1179. IntVects : Array[0..15] Of TIntVector;
  1180. ThisTask : PTask;
  1181. IdleCount : LongWord;
  1182. DispCount : LongWord;
  1183. Quantum : Word;
  1184. Elapsed : Word;
  1185. SysFlags : Word;
  1186. IDNestCnt : ShortInt;
  1187. TDNestCnt : ShortInt;
  1188. AttnFlags : Word;
  1189. AttnResched : Word;
  1190. ResModules : APTR;
  1191. TaskTrapCode : APTR;
  1192. TaskExceptCode: APTR;
  1193. TaskExitCode : APTR;
  1194. TaskSigAlloc : LongWord;
  1195. TaskTrapAlloc : Word;
  1196. MemList : TList;
  1197. ResourceList: TList;
  1198. DeviceList : TList;
  1199. IntrList : TList;
  1200. LibList : TList;
  1201. PortList : TList;
  1202. TaskReady : TList;
  1203. TaskWait : TList;
  1204. SoftInts : Array[0..4] Of TSoftIntList;
  1205. LastAlert : Array[0..3] Of LongInt;
  1206. VBlankFrequency : Byte;
  1207. PowerSupplyFrequency: Byte;
  1208. SemaphoreList : TList;
  1209. KickMemPtr : APTR;
  1210. KickTagPtr : APTR;
  1211. KickCheckSum : APTR;
  1212. ex_Pad0 : Word;
  1213. ex_LaunchPoint : LongWord;
  1214. ex_RamLibPrivate : APTR;
  1215. ex_EClockFrequency : LongWord;
  1216. ex_CacheControl : LongWord;
  1217. ex_TaskID : LongWord;
  1218. { * New ABox Emulation Entries
  1219. * }
  1220. ex_EmulHandleSize : LongWord; { * PPC EmulHandleSize..*private* * }
  1221. ex_PPCTrapMsgPort : PMsgPort; { * PPC ABox Exception MsgPort..*private* * }
  1222. ex_Reserved1 : Array[0..2] Of LongWord;
  1223. ex_MMULock : APTR;
  1224. ex_PatchPool : APTR; { * PatchPool Ptr needed by SetFunction..*private* * }
  1225. ex_PPCTaskExitCode : APTR; { * PPC Task exit function * }
  1226. ex_DebugFlags : LongWord; { * Exec Debug Flags..*private* * }
  1227. ex_MemHandlers : TMinList;
  1228. ex_MemHandler : APTR;
  1229. end;
  1230. { *
  1231. * Outdated 68k cpu informations
  1232. *
  1233. * }
  1234. const
  1235. AFB_68010 = 0;
  1236. AFB_68020 = 1;
  1237. AFB_68030 = 2;
  1238. AFB_68040 = 3;
  1239. AFB_68881 = 4;
  1240. AFB_68882 = 5;
  1241. AFB_FPU40 = 6;
  1242. AFB_68060 = 7;
  1243. AFB_PRIVATE = 15;
  1244. AFF_68010 = 1 Shl AFB_68010;
  1245. AFF_68020 = 1 Shl AFB_68020;
  1246. AFF_68030 = 1 Shl AFB_68030;
  1247. AFF_68040 = 1 Shl AFB_68040;
  1248. AFF_68881 = 1 Shl AFB_68881;
  1249. AFF_68882 = 1 Shl AFB_68882;
  1250. AFF_FPU40 = 1 Shl AFB_FPU40;
  1251. AFF_68060 = 1 Shl AFB_68060;
  1252. AFF_PRIVATE = 1 Shl AFB_PRIVATE;
  1253. { *
  1254. * Outdated 68k cache functionality
  1255. * Mostly without function.
  1256. * }
  1257. const
  1258. CACRF_EnableI = 1 Shl 0;
  1259. CACRF_FreezeI = 1 Shl 1;
  1260. CACRF_ClearI = 1 Shl 3;
  1261. CACRF_IBE = 1 Shl 4;
  1262. CACRF_EnableD = 1 Shl 8;
  1263. CACRF_FreezeD = 1 Shl 9;
  1264. CACRF_ClearD = 1 Shl 11;
  1265. CACRF_DBE = 1 Shl 12;
  1266. CACRF_WriteAllocate = 1 Shl 13;
  1267. CACRF_EnableE = 1 Shl 30;
  1268. CACRF_CopyBack = 1 Shl 31;
  1269. DMA_Continue = 1 Shl 1;
  1270. DMA_NoModify = 1 Shl 2;
  1271. DMA_ReadFromRAM = 1 Shl 3;
  1272. SB_SAR = 15;
  1273. SB_TQE = 14;
  1274. SB_SINT = 13;
  1275. SF_SAR = 1 Shl SB_SAR;
  1276. SF_TQE = 1 Shl SB_TQE;
  1277. SF_SINT = 1 Shl SB_SINT;
  1278. { ****** Debug Flags...(don`t depend on them) ********** }
  1279. const
  1280. EXECDEBUGF_INITRESIDENT = $1;
  1281. EXECDEBUGF_INITCODE = $2;
  1282. EXECDEBUGF_FINDRESIDENT = $4;
  1283. EXECDEBUGF_CREATELIBRARY = $10;
  1284. EXECDEBUGF_SETFUNCTION = $20;
  1285. EXECDEBUGF_NEWSETFUNCTION = $40;
  1286. EXECDEBUGF_CHIPRAM = $80;
  1287. EXECDEBUGF_ADDTASK = $100;
  1288. EXECDEBUGF_REMTASK = $200;
  1289. EXECDEBUGF_GETTASKATTR = $400;
  1290. EXECDEBUGF_SETTASKATTR = $800;
  1291. EXECDEBUGF_EXCEPTHANDLER = $1000;
  1292. EXECDEBUGF_ADDDOSNODE = $2000;
  1293. EXECDEBUGF_PCI = $4000;
  1294. EXECDEBUGF_RAMLIB = $8000;
  1295. EXECDEBUGF_NOLOGSERVER = $10000;
  1296. EXECDEBUGF_NOLOGWINDOW = $20000;
  1297. { *
  1298. * "env:MorphOS/LogPath" contains the logfile path,
  1299. * If not specified it`s using "ram:.morphoslog"
  1300. * }
  1301. EXECDEBUGF_LOGFILE = $40000;
  1302. EXECDEBUGF_LOGKPRINTF = $80000;
  1303. { * Memory Tracking Flags
  1304. * }
  1305. EXECDEBUGF_PERMMEMTRACK = $100000;
  1306. EXECDEBUGF_MEMTRACK = $200000;
  1307. { * CyberGuardPPC Flags
  1308. * }
  1309. EXECDEBUGF_CYBERGUARDDEADLY = $400000;
  1310. { * PPCLib Flags
  1311. * }
  1312. EXECDEBUGF_LOADSEG = $01000000;
  1313. EXECDEBUGF_UNLOADSEG = $02000000;
  1314. EXECDEBUGF_PPCSTART = $04000000;
  1315. { * UserFlags
  1316. * }
  1317. { *
  1318. * Enables debug output for cybergraphx
  1319. * }
  1320. const
  1321. EXECDEBUGF_CGXDEBUG = $08000000;
  1322. { *
  1323. * Should be used to control user LibInit/DevInit Debug output
  1324. * }
  1325. EXECDEBUGF_INIT = $40000000;
  1326. { *
  1327. * Should be used to control logging
  1328. * }
  1329. EXECDEBUGF_LOG = $80000000;
  1330. { *
  1331. * Execbase list IDs
  1332. * }
  1333. EXECLIST_DEVICE = 0;
  1334. EXECLIST_INTERRUPT = 1;
  1335. EXECLIST_LIBRARY = 2;
  1336. EXECLIST_MEMHANDLER = 3;
  1337. EXECLIST_MEMHEADER = 4;
  1338. EXECLIST_PORT = 5;
  1339. EXECLIST_RESOURCE = 6;
  1340. EXECLIST_SEMAPHORE = 7;
  1341. EXECLIST_TASK = 8;
  1342. { *
  1343. * Execnotify hook message
  1344. * }
  1345. type
  1346. PExecNotifyMessage = ^TExecNotifyMessage;
  1347. TExecNotifyMessage = packed record
  1348. MType : LongWord;
  1349. Flags : LongWord;
  1350. Extra : LongWord;
  1351. Extension: PTagItem;
  1352. end;
  1353. const
  1354. EXECNOTIFYF_REMOVE = 1 Shl 0; { * if clear, is ADD * }
  1355. EXECNOTIFYF_POST = 1 Shl 1; { * if clear, is PRE * }
  1356. { *
  1357. * AddExecNodeTagList tags
  1358. * }
  1359. const
  1360. SAL_Dummy = TAG_USER + 1000;
  1361. SAL_Type = SAL_Dummy + 1;
  1362. SAL_Priority = SAL_Dummy + 2;
  1363. SAL_Name = SAL_Dummy + 3;
  1364. // exec rawfmt (V50)
  1365. RAWFMTFUNC_STRING = 0; // Used to act like sprintf
  1366. RAWFMTFUNC_SERIAL = 1; // Used to act like kprintf
  1367. RAWFMTFUNC_COUNT = 2; // Used to count the chars needed. PutChData = PLongWord to the counter
  1368. // exec system definitions (V50)
  1369. SYSTEMINFOTYPE_SYSTEM = $0;
  1370. SYSTEMINFOTYPE_MACHINE = $1;
  1371. SYSTEMINFOTYPE_PPC_CPUVERSION = $2;
  1372. SYSTEMINFOTYPE_PPC_CPUREVISION = $3;
  1373. SYSTEMINFOTYPE_PPC_CPUCLOCK = $4;
  1374. SYSTEMINFOTYPE_PPC_BUSCLOCK = $5;
  1375. SYSTEMINFOTYPE_PPC_ICACHEL1SIZE = $10;
  1376. SYSTEMINFOTYPE_PPC_ICACHEL1LINES = $11;
  1377. SYSTEMINFOTYPE_PPC_ICACHEL1LINESIZE = $12;
  1378. SYSTEMINFOTYPE_PPC_DCACHEL1SIZE = $13;
  1379. SYSTEMINFOTYPE_PPC_DCACHEL1LINES = $14;
  1380. SYSTEMINFOTYPE_PPC_DCACHEL1LINESIZE = $15;
  1381. SYSTEMINFOTYPE_PPC_CACHEL1TYPE = $16;
  1382. SYSTEMINFOTYPE_PPC_CACHEL1FLAGS = $17;
  1383. SYSTEMINFOTYPE_PPC_ICACHEL2SIZE = $20;
  1384. SYSTEMINFOTYPE_PPC_ICACHEL2LINES = $21;
  1385. SYSTEMINFOTYPE_PPC_ICACHEL2LINESIZE = $22;
  1386. SYSTEMINFOTYPE_PPC_DCACHEL2SIZE = $23;
  1387. SYSTEMINFOTYPE_PPC_DCACHEL2LINES = $24;
  1388. SYSTEMINFOTYPE_PPC_DCACHEL2LINESIZE = $25;
  1389. SYSTEMINFOTYPE_PPC_CACHEL2TYPE = $26;
  1390. SYSTEMINFOTYPE_PPC_CACHEL2FLAGS = $27;
  1391. SYSTEMINFOTYPE_PPC_ICACHEL3SIZE = $30;
  1392. SYSTEMINFOTYPE_PPC_ICACHEL3LINES = $31;
  1393. SYSTEMINFOTYPE_PPC_ICACHEL3LINESIZE = $32;
  1394. SYSTEMINFOTYPE_PPC_DCACHEL3SIZE = $33;
  1395. SYSTEMINFOTYPE_PPC_DCACHEL3LINES = $34;
  1396. SYSTEMINFOTYPE_PPC_DCACHEL3LINESIZE = $35;
  1397. SYSTEMINFOTYPE_PPC_CACHEL3TYPE = $36;
  1398. SYSTEMINFOTYPE_PPC_CACHEL3FLAGS = $37;
  1399. SYSTEMINFOTYPE_PPC_TLBENTRIES = $40;
  1400. SYSTEMINFOTYPE_PPC_TLBSETS = $41;
  1401. SYSTEMINFOTYPE_PPC_FPU = $50; // PowerPC has a FPU
  1402. SYSTEMINFOTYPE_PPC_ALTIVEC = $51; // PowerPC has an Altivec unit
  1403. SYSTEMINFOTYPE_PPC_PERFMONITOR = $52; // PowerPC has performance measurement cpu extension
  1404. SYSTEMINFOTYPE_PPC_DATASTREAM = $53; // PowerPC has datastream cpu extension.
  1405. SYSTEMINFOTYPE_PPC_RESERVATIONSIZE = $60; // Reservation Size
  1406. SYSTEMINFOTYPE_PPC_BUSTICKS = $61; // Bus Timer Ticks
  1407. SYSTEMINFOTYPE_PPC_CPUTEMP = $62; // CPU Temperature in 8.24 fixedpoint, degrees celcius
  1408. SYSTEMINFOTYPE_PPC_DABR = $63; // PowerPC has Data Address Breakpoint Register (DABR)
  1409. SYSTEMINFOTYPE_PAGESIZE = $100; // MMU Page Size
  1410. SYSTEMINFOTYPE_CPUCOUNT = $101; // Number of CPUs, doesn't mean they are all supported by exec
  1411. // Global Scheduler statistics = exec 50.42;
  1412. SYSTEMINFOTYPE_TBCLOCKFREQUENCY = $200;
  1413. SYSTEMINFOTYPE_UPTIMETICKS = $201;
  1414. SYSTEMINFOTYPE_LASTSECTICKS = $202;
  1415. SYSTEMINFOTYPE_RECENTTICKS = $203;
  1416. SYSTEMINFOTYPE_CPUTIME = $204;
  1417. SYSTEMINFOTYPE_LASTSECCPUTIME = $205;
  1418. SYSTEMINFOTYPE_RECENTCPUTIME = $206;
  1419. SYSTEMINFOTYPE_VOLUNTARYCSW = $207;
  1420. SYSTEMINFOTYPE_INVOLUNTARYCSW = $208;
  1421. SYSTEMINFOTYPE_LASTSECVOLUNTARYCSW = $209;
  1422. SYSTEMINFOTYPE_LASTSECINVOLUNTARYCSW = $20a;
  1423. SYSTEMINFOTYPE_LOADAVG1 = $20b;
  1424. SYSTEMINFOTYPE_LOADAVG2 = $20c;
  1425. SYSTEMINFOTYPE_LOADAVG3 = $20d;
  1426. // Added in exec 50.45
  1427. SYSTEMINFOTYPE_TASKSCREATED = $20e;
  1428. SYSTEMINFOTYPE_TASKSFINISHED = $20f;
  1429. SYSTEMINFOTYPE_LAUNCHTIMETICKS = $210;
  1430. SYSTEMINFOTYPE_LAUNCHTIMETICKS1978 = $211;
  1431. SYSTEMINFOTYPE_TASKSRUNNING = $212;
  1432. SYSTEMINFOTYPE_TASKSSLEEPING = $213;
  1433. // Added in exec 50.54
  1434. SYSTEMINFOTYPE_EMULHANDLESIZE = $217; // read only
  1435. SYSTEMINFOTYPE_EXCEPTIONMSGPORT = $218; // The system's global native exception handler's msgport. Is overruled by task's native exception handler msgports.
  1436. SYSTEMINFOTYPE_TASKEXITCODE = $219; // The system's global task exit code. Is overruled by a custom exitcode in task generation.
  1437. SYSTEMINFOTYPE_TASKEXITCODE_M68K = $21a; // The system's global 68k task exit code. Is overruled by a custom exitcode in task generation.
  1438. // Added in exec 50.58
  1439. SYSTEMINFOTYPE_EMULATION_START = $230; // emulation area start read only
  1440. SYSTEMINFOTYPE_EMULATION_SIZE = $231; // emulation area size read only
  1441. SYSTEMINFOTYPE_MODULE_START = $232; // module area address read only
  1442. SYSTEMINFOTYPE_MODULE_SIZE = $233; // module area size read only
  1443. // Added in exec 50.67
  1444. SYSTEMINFOTYPE_EXCEPTIONMSGPORT_68K = $234; // The system's global 68k exception handler's msgport.
  1445. // Is overruled by task's native exception 68k handler msgports
  1446. // and that's overruled by the task's 68k traphandler
  1447. SYSTEMINFOTYPE_ALERTMSGPORT = $235; // The system's global alert handler's msgport.
  1448. // Added in exec 50.68
  1449. SYSTEMINFOTYPE_VENDOR = $236; // The system vendor string
  1450. SYSTEMINFOTYPE_REVISION = $237; // The system revision string
  1451. // Added in exec 50.73
  1452. SYSTEMINFOTYPE_MAGIC1 = $238; // Magic fields in execbase
  1453. SYSTEMINFOTYPE_MAGIC2 = $239;
  1454. // Added in exec 51.3
  1455. SYSTEMINFOTYPE_MAXHITCOUNT = $23a;
  1456. // Added in exec 51.13
  1457. SYSTEMINFOTYPE_MAXALERTCOUNT = $23b;
  1458. // Added in exec 51.25
  1459. SYSTEMINFOTYPE_REGUSER = $23c;
  1460. {
  1461. Fills 'struct FreeBlocksData' structure, with each struct MemEntry
  1462. representing single free block. Normally all free blocks in all memory
  1463. headers are scanned, but SYSTEMINFOTAG_MEMHEADER can be used to limit
  1464. the scanning to a single memory header. If successfull,
  1465. NewGetSystemAttrs return TRUE, and then fbd_NumBlocks contains the
  1466. number of struct MemEntry entries filled.
  1467. You can also use SYSTEMINFOTAG_HOOK to have your custom hook called
  1468. rather than having array being filled. The hook is called within
  1469. Forbid() and the forbid must NOT be broken. The hook is called with:
  1470. A0 - PHook
  1471. A1 - PMemEntry
  1472. A2 - PMemHeader
  1473. The hook must return success/failure indicator, returning FALSE causes
  1474. the NewGetSystemAttrs call to abort instantly and return FALSE.
  1475. }
  1476. // Added in exec 51.32
  1477. SYSTEMINFOTYPE_FREEBLOCKS = $23d;
  1478. // Added in exec 51.38
  1479. SYSTEMINFOTYPE_CPUNAME = $23e; // CPU name as a string e.g. "603E", "7448", "970FX", "Unknown" read only
  1480. SYSTEMINFOTYPE_CPUFAMILYNAME = $23f; // CPU family name as a string e.g. "G1", "G2", "G4", "G5", "Unknown" read only
  1481. SYSTEMINFOTAG_DUMMY = TAG_USER + $112000;
  1482. SYSTEMINFOTAG_CPUINDEX = SYSTEMINFOTAG_DUMMY + $0;
  1483. SYSTEMINFOTAG_MEMHEADER = SYSTEMINFOTAG_DUMMY + $1;
  1484. SYSTEMINFOTAG_HOOK = SYSTEMINFOTAG_DUMMY + $2;
  1485. // TLSAlloc (V51.46)
  1486. const
  1487. TLS_INVALID_INDEX = $ffffffff;
  1488. // tags for TLSAlloc
  1489. TLSTAG_DUMMY = TAG_USER + $120000;
  1490. TLSTAG_DESTRUCTOR = TLSTAG_DUMMY + $0; // Destructor function to call on task termination if the TLS value is non-nil. The function is called with as: procedure(value: APTR; userdata: APTR);
  1491. TLSTAG_USERDATA = TLSTAG_DUMMY + $1; // Userdata for the destructor function. Defaults to nil.
  1492. function Supervisor(userFunction: Pointer location 'a5'): Cardinal;
  1493. SysCall MOS_ExecBase 030;
  1494. procedure InitCode(startClass: Cardinal location 'd0';
  1495. version : Cardinal location 'd1');
  1496. SysCall MOS_ExecBase 072;
  1497. procedure InitStruct(initTable: Pointer location 'a1';
  1498. memory : Pointer location 'a2';
  1499. size : Cardinal location 'd0');
  1500. SysCall MOS_ExecBase 078;
  1501. function MakeLibrary(funcInit : Pointer location 'a0';
  1502. structInit: Pointer location 'a1';
  1503. libInit : Pointer location 'a2';
  1504. dataSize : Cardinal location 'd0';
  1505. segList : Cardinal location 'd1'): PLibrary;
  1506. SysCall MOS_ExecBase 084;
  1507. procedure MakeFunctions(target : Pointer location 'a0';
  1508. functionArray: Pointer location 'a1';
  1509. funcDispBase : Pointer location 'a2');
  1510. SysCall MOS_ExecBase 090;
  1511. function FindResident(name: PChar location 'a1'): PResident;
  1512. SysCall MOS_ExecBase 096;
  1513. function InitResident(resident: PResident location 'a1';
  1514. segList : Cardinal location 'd1'): Pointer;
  1515. SysCall MOS_ExecBase 102;
  1516. procedure Alert(alertNum: Cardinal location 'd7');
  1517. SysCall MOS_ExecBase 108;
  1518. procedure Debug(flags: Cardinal location 'd0');
  1519. SysCall MOS_ExecBase 114;
  1520. procedure Disable;
  1521. SysCall MOS_ExecBase 120;
  1522. procedure Enable;
  1523. SysCall MOS_ExecBase 126;
  1524. procedure Forbid;
  1525. SysCall MOS_ExecBase 132;
  1526. procedure Permit;
  1527. SysCall MOS_ExecBase 138;
  1528. function SetSR(newSR: Cardinal location 'd0';
  1529. mask : Cardinal location 'd1'): Cardinal;
  1530. SysCall MOS_ExecBase 144;
  1531. function SuperState : Pointer;
  1532. SysCall MOS_ExecBase 150;
  1533. procedure UserState(sysStack: Pointer location 'd0');
  1534. SysCall MOS_ExecBase 156;
  1535. function SetIntVector(intNumber: LongInt location 'd0';
  1536. interrupt: PInterrupt location 'a1'): PInterrupt;
  1537. SysCall MOS_ExecBase 162;
  1538. procedure AddIntServer(intNumber: LongInt location 'd0';
  1539. interrupt: PInterrupt location 'a1');
  1540. SysCall MOS_ExecBase 168;
  1541. procedure RemIntServer(intNumber: LongInt location 'd0';
  1542. interrupt: PInterrupt location 'a1');
  1543. SysCall MOS_ExecBase 174;
  1544. procedure Cause(interrupt: PInterrupt location 'a1');
  1545. SysCall MOS_ExecBase 180;
  1546. function Allocate(freeList: PMemHeader location 'a0';
  1547. byteSize: Cardinal location 'd0'): Pointer;
  1548. SysCall MOS_ExecBase 186;
  1549. procedure Deallocate(freeList : PMemHeader location 'a0';
  1550. memoryBlock: Pointer location 'a1';
  1551. byteSize : Cardinal location 'd0');
  1552. SysCall MOS_ExecBase 192;
  1553. { * Name changed to avoid conflict with heap manager... * }
  1554. function execAllocMem(byteSize : Cardinal location 'd0';
  1555. requirements: Cardinal location 'd1'): Pointer;
  1556. SysCall MOS_ExecBase 198;
  1557. function AllocAbs(byteSize: Cardinal location 'd0';
  1558. location: Pointer location 'a1'): Pointer;
  1559. SysCall MOS_ExecBase 204;
  1560. { * Name changed to avoid conflict with heap manager... * }
  1561. procedure execFreeMem(memoryBlock: Pointer location 'a1';
  1562. byteSize : Cardinal location 'd0');
  1563. SysCall MOS_ExecBase 210;
  1564. function AvailMem(requirements: Cardinal location 'd1'): Cardinal;
  1565. SysCall MOS_ExecBase 216;
  1566. function AllocEntry(entry: PMemList location 'a0'): PMemList;
  1567. SysCall MOS_ExecBase 222;
  1568. procedure FreeEntry(entry: PMemList location 'a0');
  1569. SysCall MOS_ExecBase 228;
  1570. { * Name changed to avoid conflict with other System unit call... * }
  1571. procedure execInsert(list: PList location 'a0';
  1572. node: PNode location 'a1';
  1573. pred: PNode location 'a2');
  1574. SysCall MOS_ExecBase 234;
  1575. procedure AddHead(list: PList location 'a0';
  1576. node: PNode location 'a1');
  1577. SysCall MOS_ExecBase 240;
  1578. procedure AddTail(list: PList location 'a0';
  1579. node: PNode location 'a1');
  1580. SysCall MOS_ExecBase 246;
  1581. procedure Remove(node: PNode location 'a1');
  1582. SysCall MOS_ExecBase 252;
  1583. function RemHead(list: PList location 'a0'): PNode;
  1584. SysCall MOS_ExecBase 258;
  1585. function RemTail(list: PList location 'a0'): PNode;
  1586. SysCall MOS_ExecBase 264;
  1587. procedure Enqueue(list: PList location 'a0';
  1588. node: PNode location 'a1');
  1589. SysCall MOS_ExecBase 270;
  1590. function FindName(list: PList location 'a0';
  1591. name: PChar location 'a1'): PNode;
  1592. SysCall MOS_ExecBase 276;
  1593. function AddTask(task : PTask location 'a1';
  1594. initPC : Pointer location 'a2';
  1595. finalPC: Pointer location 'a3'): Pointer;
  1596. SysCall MOS_ExecBase 282;
  1597. procedure RemTask(task: PTask location 'a1');
  1598. SysCall MOS_ExecBase 288;
  1599. function FindTask(name: PChar location 'a1'): PTask;
  1600. SysCall MOS_ExecBase 294;
  1601. function SetTaskPri(task : PTask location 'a1';
  1602. priority: LongInt location 'd0'): ShortInt;
  1603. SysCall MOS_ExecBase 300;
  1604. function SetSignal(newSignals: Cardinal location 'd0';
  1605. signalSet : Cardinal location 'd1'): Cardinal;
  1606. SysCall MOS_ExecBase 306;
  1607. function SetExcept(newSignals: Cardinal location 'd0';
  1608. signalSet : Cardinal location 'd1'): Cardinal;
  1609. SysCall MOS_ExecBase 312;
  1610. function Wait(signalSet: Cardinal location 'd0'): Cardinal;
  1611. SysCall MOS_ExecBase 318;
  1612. procedure Signal(task : PTask location 'a1';
  1613. signalSet: Cardinal location 'd0');
  1614. SysCall MOS_ExecBase 324;
  1615. function AllocSignal(signalNum: LongInt location 'd0'): ShortInt;
  1616. SysCall MOS_ExecBase 330;
  1617. procedure FreeSignal(signalNum: LongInt location 'd0');
  1618. SysCall MOS_ExecBase 336;
  1619. function AllocTrap(trapNum: LongInt location 'd0'): LongInt;
  1620. SysCall MOS_ExecBase 342;
  1621. procedure FreeTrap(trapNum: LongInt location 'd0');
  1622. SysCall MOS_ExecBase 348;
  1623. procedure AddPort(port: PMsgPort location 'a1');
  1624. SysCall MOS_ExecBase 354;
  1625. procedure RemPort(port: PMsgPort location 'a1');
  1626. SysCall MOS_ExecBase 360;
  1627. procedure PutMsg(port : PMsgPort location 'a0';
  1628. message: PMessage location 'a1');
  1629. SysCall MOS_ExecBase 366;
  1630. function GetMsg(port: PMsgPort location 'a0'): PMessage;
  1631. SysCall MOS_ExecBase 372;
  1632. procedure ReplyMsg(message : PMessage location 'a1');
  1633. SysCall MOS_ExecBase 378;
  1634. function WaitPort(port: PMsgPort location 'a0'): PMessage;
  1635. SysCall MOS_ExecBase 384;
  1636. function FindPort(name: PChar location 'a1'): PMsgPort;
  1637. SysCall MOS_ExecBase 390;
  1638. procedure AddLibrary(libHandle: PLibrary location 'a1');
  1639. SysCall MOS_ExecBase 396;
  1640. procedure RemLibrary(libHandle: PLibrary location 'a1');
  1641. SysCall MOS_ExecBase 402;
  1642. function OldOpenLibrary(libName: PChar location 'a1'): PLibrary;
  1643. SysCall MOS_ExecBase 408;
  1644. procedure CloseLibrary(libHandle: PLibrary location 'a1');
  1645. SysCall MOS_ExecBase 414;
  1646. function SetFunction(libHandle : PLibrary location 'a1';
  1647. funcOffset : LongInt location 'a0';
  1648. newFunction: Pointer location 'd0'): Pointer;
  1649. SysCall MOS_ExecBase 420;
  1650. procedure SumLibrary(libHandle: PLibrary location 'a1');
  1651. SysCall MOS_ExecBase 426;
  1652. procedure AddDevice(device: PDevice location 'a1');
  1653. SysCall MOS_ExecBase 432;
  1654. procedure RemDevice(device: PDevice location 'a1');
  1655. SysCall MOS_ExecBase 438;
  1656. function OpenDevice(devName : PChar location 'a0';
  1657. numunit : Cardinal location 'd0';
  1658. ioRequest: pIORequest location 'a1';
  1659. flags : Cardinal location 'd1'): ShortInt;
  1660. SysCall MOS_ExecBase 444;
  1661. procedure CloseDevice(ioRequest: PIORequest location 'a1');
  1662. SysCall MOS_ExecBase 450;
  1663. function DoIO(ioRequest: PIORequest location 'a1'): ShortInt;
  1664. SysCall MOS_ExecBase 456;
  1665. procedure SendIO(ioRequest: PIORequest location 'a1');
  1666. SysCall MOS_ExecBase 462;
  1667. function CheckIO(ioRequest: PIORequest location 'a1'): PIORequest;
  1668. SysCall MOS_ExecBase 468;
  1669. function WaitIO(ioRequest: PIORequest location 'a1'): ShortInt;
  1670. SysCall MOS_ExecBase 474;
  1671. procedure AbortIO(ioRequest: PIORequest location 'a1');
  1672. SysCall MOS_ExecBase 480;
  1673. procedure AddResource(resource: Pointer location 'a1');
  1674. SysCall MOS_ExecBase 486;
  1675. procedure RemResource(resource: Pointer location 'a1');
  1676. SysCall MOS_ExecBase 492;
  1677. function OpenResource(resName: PChar location 'a1'): Pointer;
  1678. SysCall MOS_ExecBase 498;
  1679. procedure RawIOInit;
  1680. SysCall MOS_ExecBase 504;
  1681. function RawMayGetChar: Char;
  1682. SysCall MOS_ExecBase 510;
  1683. procedure RawPutChar(d0arg: Char location 'd0');
  1684. SysCall MOS_ExecBase 516;
  1685. function RawDoFmt(formatString: PChar location 'a0';
  1686. dataStream : Pointer location 'a1';
  1687. putChProc : Pointer location 'a2';
  1688. putChData : Pointer location 'a3'): Pointer;
  1689. SysCall MOS_ExecBase 522;
  1690. function GetCC: Cardinal;
  1691. SysCall MOS_ExecBase 528;
  1692. function TypeOfMem(address: Pointer location 'a1'): Cardinal;
  1693. SysCall MOS_ExecBase 534;
  1694. function Procure(sigSem: PSignalSemaphore location 'a0';
  1695. bidMsg: PSemaphoreMessage location 'a1'): Cardinal;
  1696. SysCall MOS_ExecBase 540;
  1697. procedure Vacate(sigSem: PSignalSemaphore location 'a0';
  1698. bidMsg: PSemaphoreMessage location 'a1');
  1699. SysCall MOS_ExecBase 546;
  1700. function OpenLibrary(libname: PChar location 'a1';
  1701. libver : Cardinal location 'd0'): Pointer;
  1702. SysCall MOS_ExecBase 552;
  1703. procedure InitSemaphore(sigSem: PSignalSemaphore location 'a0');
  1704. SysCall MOS_ExecBase 558;
  1705. procedure ObtainSemaphore(sigSem: PSignalSemaphore location 'a0');
  1706. SysCall MOS_ExecBase 564;
  1707. procedure ReleaseSemaphore(sigSem: PSignalSemaphore location 'a0');
  1708. SysCall MOS_ExecBase 570;
  1709. function AttemptSemaphore(sigSem: PSignalSemaphore location 'a0'): Cardinal;
  1710. SysCall MOS_ExecBase 576;
  1711. procedure ObtainSemaphoreList(sigSem: PList location 'a0');
  1712. SysCall MOS_ExecBase 582;
  1713. procedure ReleaseSemaphoreList(sigSem: PList location 'a0');
  1714. SysCall MOS_ExecBase 588;
  1715. function FindSemaphore(sigSem: PChar location 'a1'): PSignalSemaphore;
  1716. SysCall MOS_ExecBase 594;
  1717. procedure AddSemaphore(sigSem: PSignalSemaphore location 'a1');
  1718. SysCall MOS_ExecBase 600;
  1719. procedure RemSemaphore(sigSem: PSignalSemaphore location 'a1');
  1720. SysCall MOS_ExecBase 606;
  1721. function SumKickData: Cardinal;
  1722. SysCall MOS_ExecBase 612;
  1723. procedure AddMemList(size : Cardinal location 'd0';
  1724. attributes: Cardinal location 'd1';
  1725. pri : LongInt location 'd2';
  1726. base : Pointer location 'a0';
  1727. name : PChar location 'a1');
  1728. SysCall MOS_ExecBase 618;
  1729. procedure CopyMem(source: Pointer location 'a0';
  1730. dest : Pointer location 'a1';
  1731. size : Cardinal location 'd0');
  1732. SysCall MOS_ExecBase 624;
  1733. procedure CopyMemQuick(source: Pointer location 'a0';
  1734. dest : Pointer location 'a1';
  1735. size : Cardinal location 'd0');
  1736. SysCall MOS_ExecBase 630;
  1737. procedure CacheClearU;
  1738. SysCall MOS_ExecBase 636;
  1739. procedure CacheClearE(address: Pointer location 'a0';
  1740. length : Cardinal location 'd0';
  1741. caches : Cardinal location 'd1');
  1742. SysCall MOS_ExecBase 642;
  1743. function CacheControl(cacheBits: Cardinal location 'd0';
  1744. cacheMask: Cardinal location 'd1'): Cardinal;
  1745. SysCall MOS_ExecBase 648;
  1746. function CreateIORequest(port: PMsgPort location 'a0';
  1747. size: Cardinal location 'd0'): Pointer;
  1748. SysCall MOS_ExecBase 654;
  1749. procedure DeleteIORequest(iorequest: Pointer location 'a0');
  1750. SysCall MOS_ExecBase 660;
  1751. function CreateMsgPort: PMsgPort;
  1752. SysCall MOS_ExecBase 666;
  1753. procedure DeleteMsgPort(port: PMsgPort location 'a0');
  1754. SysCall MOS_ExecBase 672;
  1755. procedure ObtainSemaphoreShared(sigSem: PSignalSemaphore location 'a0');
  1756. SysCall MOS_ExecBase 678;
  1757. function AllocVec(byteSize : Cardinal location 'd0';
  1758. requirements: Cardinal location 'd1'): Pointer;
  1759. SysCall MOS_ExecBase 684;
  1760. procedure FreeVec(memoryBlock: Pointer location 'a1');
  1761. SysCall MOS_ExecBase 690;
  1762. function CreatePool(requirements: Cardinal location 'd0';
  1763. puddleSize : Cardinal location 'd1';
  1764. threshSize : Cardinal location 'd2'): Pointer;
  1765. SysCall MOS_ExecBase 696;
  1766. procedure DeletePool(poolHeader: Pointer location 'a0');
  1767. SysCall MOS_ExecBase 702;
  1768. function AllocPooled(poolHeader: Pointer location 'a0';
  1769. memSize : Cardinal location 'd0'): Pointer;
  1770. SysCall MOS_ExecBase 708;
  1771. procedure FreePooled(poolHeader: Pointer location 'a0';
  1772. memory : Pointer location 'a1';
  1773. memSize : Cardinal location 'd0');
  1774. SysCall MOS_ExecBase 714;
  1775. function AttemptSemaphoreShared(sigSem: pSignalSemaphore location 'a0'): Cardinal;
  1776. SysCall MOS_ExecBase 720;
  1777. procedure ColdReboot;
  1778. SysCall MOS_ExecBase 726;
  1779. procedure StackSwap(newStack: PStackSwapStruct location 'a0');
  1780. SysCall MOS_ExecBase 732;
  1781. function NewGetTaskAttrsA(Task : PTask location 'a0';
  1782. Data : APTR location 'a1';
  1783. DataSize: LongWord location 'd0';
  1784. TType : LongWord location 'd1';
  1785. Tags : PTagItem location 'a2'): LongWord;
  1786. SysCall MOS_ExecBase 738;
  1787. function NewSetTaskAttrsA(Task : PTask location 'a0';
  1788. Data : APTR location 'a1';
  1789. DataSize: LongWord location 'd0';
  1790. TType : LongWord location 'd1';
  1791. Tags : PTagItem location 'a2'): LongWord;
  1792. SysCall MOS_ExecBase 744;
  1793. function CachePreDMA(address : Pointer location 'a0';
  1794. var length: Cardinal location 'a1';
  1795. flags : Cardinal location 'd0'): Pointer;
  1796. SysCall MOS_ExecBase 762;
  1797. procedure CachePostDMA(address : Pointer location 'a0';
  1798. var length: Cardinal location 'a1';
  1799. flags : Cardinal location 'd0');
  1800. SysCall MOS_ExecBase 768;
  1801. procedure AddMemHandler(memhand: PInterrupt location 'a1');
  1802. SysCall MOS_ExecBase 774;
  1803. procedure RemMemHandler(memhand: PInterrupt location 'a1');
  1804. SysCall MOS_ExecBase 780;
  1805. function ObtainQuickVector(interruptCode: Pointer location 'a0'): Cardinal;
  1806. SysCall MOS_ExecBase 786;
  1807. function NewSetFunction(libHandle : PLibrary location 'a0';
  1808. newfunction: Pointer location 'a1';
  1809. offset : LongInt location 'd0';
  1810. tags : PTagItem location 'a2'): Pointer;
  1811. SysCall MOS_ExecBase 792;
  1812. function NewCreateLibrary(Tags: PTagItem location 'a0'): PLibrary;
  1813. SysCall MOS_ExecBase 798;
  1814. function NewPPCStackSwap(newStack : PStackSwapStruct location 'a0';
  1815. sfunction: Pointer location 'a1';
  1816. args : PPPCStackSwapArgs location 'a2'): Cardinal;
  1817. SysCall MOS_ExecBase 804;
  1818. function TaggedOpenLibrary(d0arg: LongInt location 'd0'): Pointer;
  1819. SysCall MOS_ExecBase 810;
  1820. function ReadGayle: Cardinal;
  1821. SysCall MOS_ExecBase 816;
  1822. function VNewRawDoFmt(FmtString: PChar;
  1823. PutChProc: Pointer;
  1824. PutChData: PChar;
  1825. args : PChar): PChar;
  1826. SysCall BaseSysV MOS_ExecBase 822;
  1827. procedure CacheFlushDataArea(Address: Pointer location 'a0';
  1828. Size : Cardinal location 'd0');
  1829. SysCall MOS_ExecBase 828;
  1830. procedure CacheInvalidInstArea(Address: Pointer location 'a0';
  1831. Size : Cardinal location 'd0');
  1832. SysCall MOS_ExecBase 834;
  1833. procedure CacheInvalidDataArea(Address: Pointer location 'a0';
  1834. Size : Cardinal location 'd0');
  1835. SysCall MOS_ExecBase 840;
  1836. procedure CacheFlushDataInstArea(Address: Pointer location 'a0';
  1837. Size : Cardinal location 'd0');
  1838. SysCall MOS_ExecBase 846;
  1839. procedure CacheTrashCacheArea(Address: Pointer location 'a0';
  1840. Size : Cardinal location 'd0');
  1841. SysCall MOS_ExecBase 852;
  1842. function AllocTaskPooled(Size: Cardinal location 'd0'): Pointer;
  1843. SysCall MOS_ExecBase 858;
  1844. procedure FreeTaskPooled(Address: Pointer location 'a1';
  1845. Size : Cardinal location 'd0');
  1846. SysCall MOS_ExecBase 864;
  1847. function AllocVecTaskPooled(Size: Cardinal location 'd0'): Pointer;
  1848. SysCall MOS_ExecBase 870;
  1849. procedure FreeVecTaskPooled(Address: Pointer location 'a1');
  1850. SysCall MOS_ExecBase 876;
  1851. procedure FlushPool(poolHeader: Pointer location 'a0');
  1852. SysCall MOS_ExecBase 882;
  1853. procedure FlushTaskPool;
  1854. SysCall MOS_ExecBase 888;
  1855. function AllocVecPooled(poolHeader: APTR location 'a0';
  1856. memSize : LongWord location 'd0'): Pointer;
  1857. SysCall MOS_ExecBase 894;
  1858. function FreeVecPooled(poolHeader: APTR location 'a0';
  1859. memory : APTR location 'd0'): Pointer;
  1860. SysCall MOS_ExecBase 900;
  1861. function NewGetSystemAttrsA(Data : Pointer location 'a0';
  1862. DataSize: Cardinal location 'd0';
  1863. TType : Cardinal location 'd1';
  1864. Tags : PTagItem location 'a1'): Cardinal;
  1865. SysCall MOS_ExecBase 906;
  1866. function NewSetSystemAttrsA(Data : Pointer location 'a0';
  1867. DataSize: Cardinal location 'd0';
  1868. TType : Cardinal location 'd1';
  1869. Tags : PTagItem location 'a1'): Cardinal;
  1870. SysCall MOS_ExecBase 912;
  1871. function NewCreateTaskA(Tags: PTagItem location 'a0'): PTask;
  1872. SysCall MOS_ExecBase 918;
  1873. function AllocateAligned(memHeader : pMemHeader;
  1874. byteSize : Cardinal;
  1875. alignSize : Cardinal;
  1876. alignOffset: Cardinal): Pointer;
  1877. SysCall BaseSysV MOS_ExecBase 930;
  1878. function AllocMemAligned(byteSize : Cardinal;
  1879. attributes : Cardinal;
  1880. alignSize : Cardinal;
  1881. alignOffset: Cardinal): Pointer;
  1882. SysCall BaseSysV MOS_ExecBase 936;
  1883. function AllocVecAligned(byteSize : Cardinal;
  1884. attributes : Cardinal;
  1885. alignSize : Cardinal;
  1886. alignOffset: Cardinal): Pointer;
  1887. SysCall BaseSysV MOS_ExecBase 942;
  1888. procedure AddExecNotify(hook: PHook);
  1889. SysCall BaseSysV MOS_ExecBase 948;
  1890. procedure RemExecNotify(hook: PHook);
  1891. SysCall BaseSysV MOS_ExecBase 954;
  1892. function FindExecNode(ttype: Cardinal location 'd0';
  1893. name : PChar location 'a0'): PNode;
  1894. SysCall MOS_ExecBase 960;
  1895. function AddExecNodeA(innode : Pointer location 'a0';
  1896. TagItems: PTagItem location 'a1'): Pointer;
  1897. SysCall MOS_ExecBase 966;
  1898. function AllocVecDMA(byteSize : Cardinal location 'd0';
  1899. requirements: Cardinal location 'd1'): Pointer;
  1900. SysCall MOS_ExecBase 972;
  1901. procedure FreeVecDMA(memoryBlock: Pointer location 'a1');
  1902. SysCall MOS_ExecBase 978;
  1903. function AllocPooledAligned(poolHeader : Pointer;
  1904. byteSize : Cardinal;
  1905. alignSize : Cardinal;
  1906. alignOffset: Cardinal): Pointer;
  1907. SysCall BaseSysV MOS_ExecBase 984;
  1908. function AddResident(resident: pResident location 'd0'): LongInt;
  1909. SysCall BaseSysV MOS_ExecBase 990;
  1910. function FindTaskByPID(processID: Cardinal): PTask;
  1911. SysCall BaseSysV MOS_ExecBase 996;
  1912. procedure DumpTaskState(Task: PTask location 'a0') syscall MOS_ExecBase 1026;
  1913. procedure AddExecNotifyType(Hook: PHook; Type_: LongInt); SysCall BaseSysV MOS_ExecBase 1030;
  1914. function ShutdownA(MyTags: PTagItem): LongWord; SysCall BaseSysV MOS_ExecBase 1036;
  1915. function AvailPool(PoolHeader: APTR; Flags: LongWord): LongWord; SysCall BaseSysV MOS_ExecBase 1048;
  1916. procedure PutMsgHead(Port: PMsgPort; Message: PMessage); SysCall BaseSysV MOS_ExecBase 1060;
  1917. 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;
  1918. 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;
  1919. // added in V51.46
  1920. function TLSAllocA(Tags: PTagItem): LongWord; SysCall BaseSysV MOS_ExecBase 1084;
  1921. function TLSFree(Idx: LongWord): LongInt; SysCall BaseSysV MOS_ExecBase 1090;
  1922. function TLSGetValue(Idx: LongWord): APTR; SysCall BaseSysV MOS_ExecBase 1096;
  1923. function TLSSetValue(Idx: LongWord; Value: APTR): LongInt; SysCall BaseSysV MOS_ExecBase 1102;
  1924. procedure TLSCallDestructors(Task: PTask); SysCall BaseSysV MOS_ExecBase 1108;
  1925. function NewGetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: LongWord; const Tags: array of PtrUInt): LongWord; Inline;
  1926. function NewSetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: Cardinal; const Tags: array of PtrUInt): LongWord; Inline;
  1927. function NewCreateLibraryTags(const Tags: array of PtrUInt): PLibrary; inline;
  1928. function NewGetSystemAttrs(Data: APTR; DataSize, MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1929. function NewSetSystemAttrs(Data: APTR; DataSize, MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1930. function NewCreateTask(const Tags: array of PtrUInt): PTask; inline;
  1931. function AddExecNode(InNode: APTR; const Tags: array of PtrUInt): APTR; inline;
  1932. function NewGetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize, Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1933. function NewSetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize, Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1934. function TLSAlloc(const Tags: array of PtrUInt): LongWord; inline;
  1935. function CreateExtIO(const Mp: PMsgPort; Size: Integer): PIORequest;
  1936. procedure DeleteExtIO(ioReq: PIORequest);
  1937. implementation
  1938. function NewGetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: LongWord; const Tags: array of PtrUInt): LongWord; Inline;
  1939. begin
  1940. NewGetTaskAttrs := NewGetTaskAttrsA(Task, Data, DataSize, TType, @Tags);
  1941. end;
  1942. function NewSetTaskAttrs(Task: PTask; Data: APTR; DataSize, TType: LongWord; const Tags: array of DWord): LongWord; Inline;
  1943. begin
  1944. NewSetTaskAttrs := NewSetTaskAttrsA(Task, Data, DataSize, TType, @Tags);
  1945. end;
  1946. function NewCreateLibraryTags(const Tags: array of PtrUInt): PLibrary; inline;
  1947. begin
  1948. NewCreateLibraryTags := NewCreateLibrary(@Tags);
  1949. end;
  1950. function NewGetSystemAttrs(Data: APTR; DataSize: LongWord; MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1951. begin
  1952. NewGetSystemAttrs := NewGetSystemAttrsA(Data, DataSize, MyType, @Tags);
  1953. end;
  1954. function NewSetSystemAttrs(Data: APTR; DataSize: LongWord; MyType: LongWord; const Tags: array of PtrUInt): LongWord;
  1955. begin
  1956. NewSetSystemAttrs := NewSetSystemAttrsA(Data, DataSize, MyType, @Tags);
  1957. end;
  1958. function NewCreateTask(const Tags: array of PtrUInt): PTask; inline;
  1959. begin
  1960. NewCreateTask := NewCreateTaskA(@Tags);
  1961. end;
  1962. function AddExecNode(InNode: APTR; const Tags: array of PtrUInt): APTR; inline;
  1963. begin
  1964. AddExecNode := AddExecNodeA(InNode, @Tags);
  1965. end;
  1966. function NewGetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize: LongWord; Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1967. begin
  1968. NewGetTaskPIDAttrs := NewGetTaskPIDAttrsA(PID, Data, DataSize, Type_, @Tags);
  1969. end;
  1970. function NewSetTaskPIDAttrs(PID: LongWord; Data: APTR; DataSize: LongWord; Type_: LongWord; const Tags: array of PtrUInt): LongWord; inline;
  1971. begin
  1972. NewSetTaskPIDAttrs := NewSetTaskPIDAttrsA(PID, Data, DataSize, Type_, @Tags);
  1973. end;
  1974. function TLSAlloc(const Tags: array of PtrUInt): LongWord; inline;
  1975. begin
  1976. TLSAlloc := TLSAllocA(@Tags);
  1977. end;
  1978. function GetEmulHandle: PEmulHandle; assembler; nostackframe;
  1979. asm
  1980. mr r3,r2
  1981. end;
  1982. function REG_D0: DWord; assembler; nostackframe;
  1983. asm
  1984. lwz r3,0(r2)
  1985. end;
  1986. function REG_D1: DWord; assembler; nostackframe;
  1987. asm
  1988. lwz r3,4(r2)
  1989. end;
  1990. function REG_D2: DWord; assembler; nostackframe;
  1991. asm
  1992. lwz r3,8(r2)
  1993. end;
  1994. function REG_D3: DWord; assembler; nostackframe;
  1995. asm
  1996. lwz r3,12(r2)
  1997. end;
  1998. function REG_D4: DWord; assembler; nostackframe;
  1999. asm
  2000. lwz r3,16(r2)
  2001. end;
  2002. function REG_D5: DWord; assembler; nostackframe;
  2003. asm
  2004. lwz r3,20(r2)
  2005. end;
  2006. function REG_D6: DWord; assembler; nostackframe;
  2007. asm
  2008. lwz r3,24(r2)
  2009. end;
  2010. function REG_D7: DWord; assembler; nostackframe;
  2011. asm
  2012. lwz r3,28(r2)
  2013. end;
  2014. function REG_A0: Pointer; assembler; nostackframe;
  2015. asm
  2016. lwz r3,32(r2)
  2017. end;
  2018. function REG_A1: Pointer; assembler; nostackframe;
  2019. asm
  2020. lwz r3,36(r2)
  2021. end;
  2022. function REG_A2: Pointer; assembler; nostackframe;
  2023. asm
  2024. lwz r3,40(r2)
  2025. end;
  2026. function REG_A3: Pointer; assembler; nostackframe;
  2027. asm
  2028. lwz r3,44(r2)
  2029. end;
  2030. function REG_A4: Pointer; assembler; nostackframe;
  2031. asm
  2032. lwz r3,48(r2)
  2033. end;
  2034. function REG_A5: Pointer; assembler; nostackframe;
  2035. asm
  2036. lwz r3,52(r2)
  2037. end;
  2038. function REG_A6: Pointer; assembler; nostackframe;
  2039. asm
  2040. lwz r3,56(r2)
  2041. end;
  2042. function REG_A7: Pointer; assembler; nostackframe;
  2043. asm
  2044. lwz r3,60(r2)
  2045. end;
  2046. function REG_PC: Pointer; assembler; nostackframe;
  2047. asm
  2048. lwz r3,64(r2)
  2049. end;
  2050. function REG_SR: DWord; assembler; nostackframe;
  2051. asm
  2052. lwz r3,68(r2)
  2053. end;
  2054. function CreateExtIO(const Mp: PMsgPort; Size: Integer): PIORequest;
  2055. begin
  2056. CreateExtIO := nil;
  2057. if not Assigned(mp) then
  2058. Exit;
  2059. CreateExtIO := System.AllocMem(Size);
  2060. if Assigned(CreateExtIO) then
  2061. begin
  2062. CreateExtIO^.io_Message.mn_Node.ln_Type := NT_REPLYMSG;
  2063. CreateExtIO^.io_Message.mn_ReplyPort := Mp;
  2064. CreateExtIO^.io_Message.mn_Length := Size;
  2065. end;
  2066. end;
  2067. procedure DeleteExtIO(ioReq: PIORequest);
  2068. begin
  2069. if Assigned(ioReq) then
  2070. begin
  2071. ioReq^.io_Message.mn_Node.ln_Type := Byte(-1);
  2072. ioReq^.io_Device := Pointer(-1);
  2073. ioReq^.io_Unit := Pointer(-1);
  2074. System.FreeMem(ioReq);
  2075. end;
  2076. end;
  2077. begin
  2078. ExecBase:=MOS_ExecBase;
  2079. end.