exec.pas 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052
  1. {
  2. This file is part of the Free Pascal run time library.
  3. Copyright (c) 2016 by Free Pascal development team
  4. exec.library functions for Amiga OS 4.x
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. {$IFNDEF FPC_DOTTEDUNITS}
  12. unit exec;
  13. {$ENDIF FPC_DOTTEDUNITS}
  14. {$PACKRECORDS 2}
  15. // TODO: ExtMem.h - still missing ExtMemIFace discuss how to (open all possible interfaces)
  16. // or make an other unit?
  17. // Initializers.h - Macros needed?
  18. interface
  19. type
  20. STRPTR = PAnsiChar;
  21. PSTRPTR = PPAnsiChar;
  22. ULONG = Longword;
  23. LONG = LongInt;
  24. APTR = Pointer;
  25. BPTR = LongInt; // Long word (BCPL) pointer
  26. BSTR = LongInt; // Long word pointer to BCPL string
  27. BOOL = SmallInt;
  28. UWORD = Word;
  29. WORDBITS = Word;
  30. LONGBITS = LongWord;
  31. PLONGBITS = ^LONGBITS;
  32. UBYTE = Byte;
  33. PULONG = ^LongWord;
  34. PAPTR = ^APTR;
  35. PLONG = ^LONG;
  36. type
  37. // List Node Structure. Each member in a list starts with a Node
  38. PNode = ^TNode;
  39. TNode = record
  40. ln_Succ, // Pointer to next (successor)
  41. ln_Pred: PNode; // Pointer to previous (predecessor)
  42. ln_Type: Byte;
  43. ln_Pri: Shortint; // Priority, for sorting
  44. ln_Name: STRPTR; // ID string, null terminated
  45. end; // Note: smallint aligned
  46. // minimal node -- no type checking possible
  47. PMinNode = ^TMinNode;
  48. TMinNode = record
  49. mln_Succ,
  50. mln_Pred: PMinNode;
  51. end;
  52. // Note: Newly initialized IORequests, and software interrupt structures
  53. // used with Cause(), should have type NT_UNKNOWN. The OS will assign a type
  54. // when they are first used.
  55. // ----- Node Types for LN_TYPE -----
  56. const
  57. NT_UNKNOWN = 0;
  58. NT_TASK = 1; // Exec task
  59. NT_INTERRUPT = 2;
  60. NT_DEVICE = 3;
  61. NT_MSGPORT = 4;
  62. NT_MESSAGE = 5; // Indicates message currently pending
  63. NT_FREEMSG = 6;
  64. NT_REPLYMSG = 7; // Message has been replied
  65. NT_RESOURCE = 8;
  66. NT_LIBRARY = 9;
  67. NT_MEMORY = 10;
  68. NT_SOFTINT = 11; // Internal flag used by SoftInits
  69. NT_FONT = 12;
  70. NT_PROCESS = 13; // AmigaDOS Process
  71. NT_SEMAPHORE = 14;
  72. NT_SIGNALSEM = 15; // signal semaphores
  73. NT_BOOTNODE = 16;
  74. NT_KICKMEM = 17;
  75. NT_GRAPHICS = 18;
  76. NT_DEATHMESSAGE = 19;
  77. // New additions in V50
  78. NT_EXTINTERRUPT = 20; // Native interrupt
  79. NT_EXTSOFTINT = 21; // Native soft interrupt
  80. NT_VMAREA = 22; // Internal use only
  81. NT_VMAREA_PROXY = 23; // Internal use only
  82. NT_CLASS = 24; // Class
  83. NT_INTERFACE = 25; // Interface
  84. // New additions in V51
  85. NT_KMEMCACHE = 26; // Internal use only
  86. NT_RESERVED1 = 27;
  87. // New additions in V53
  88. NT_FILESYSTEM = 28; // For new style Vector-Port based Filesystems
  89. // New additions in V54
  90. NT_PAGE = 40;
  91. NT_ELFHANDLE = 41;
  92. NT_SOLIBHANDLE = 42;
  93. NT_USER = 254; // User node types work down from here
  94. NT_EXTENDED = 255;
  95. // START consts and types from utility needed here
  96. const
  97. // differentiates user tags from control tags
  98. TAG_USER = $80000000; // differentiates user tags from system tags
  99. type
  100. Tag = LongWord;
  101. PTag = ^Tag;
  102. PTagItem = ^TTagItem;
  103. TTagItem = record
  104. ti_Tag: Tag; // identifies the type of data
  105. ti_Data: LongWord; // type-specific data
  106. end;
  107. PPTagItem = ^PTagItem;
  108. PHook = ^THook;
  109. THook = record
  110. h_MinNode: TMinNode;
  111. h_Entry: Pointer; // assembler entry point
  112. h_SubEntry: Pointer; // often HLL entry point
  113. h_Data: Pointer; // owner specific
  114. end;
  115. // END consts and types from utility needed here
  116. const
  117. {There is a problem with boolean
  118. vaules in taglists, just use this
  119. for now instead}
  120. LTrue : LongInt = 1;
  121. LFalse: LongInt = 0;
  122. {
  123. This file defines Exec system lists, which are used to link
  124. various things. Exec provides several routines to handle list
  125. processing (defined at the bottom of this file), so you can
  126. use these routines to save yourself the trouble of writing a list
  127. package.
  128. }
  129. type
  130. // Full featured list header.
  131. PList = ^TList;
  132. TList = record
  133. lh_Head: PNode;
  134. lh_Tail: PNode;
  135. lh_TailPred: PNode;
  136. lh_Type: Byte;
  137. l_pad: Byte;
  138. end; // word aligned
  139. // Minimal List Header - no type checking
  140. PMinList = ^TMinList;
  141. TMinList = record
  142. mlh_Head: PMinNode;
  143. mlh_Tail: PMinNode;
  144. mlh_TailPred: PMinNode;
  145. end; // LongWord aligned
  146. { ********************************************************************
  147. *
  148. * Format of the alert error number:
  149. *
  150. * +-+-------------+----------------+--------------------------------+
  151. * |D| SubSysId | General Error | SubSystem Specific Error |
  152. * +-+-------------+----------------+--------------------------------+
  153. * 1 7 bits 8 bits 16 bits
  154. *
  155. * D: Deadend alert
  156. * SubSysId: indicates ROM subsystem number.
  157. * General Error: roughly indicates what the error was
  158. * Specific Error: indicates more detail
  159. *********************************************************************}
  160. const
  161. {*********************************************************************
  162. *
  163. * Hardware/CPU specific alerts: They may show without the 8 at the
  164. * front of the number. These are CPU/68000 specific. See 68$0
  165. * programmer's manuals for more details.
  166. *
  167. *********************************************************************}
  168. ACPU_BusErr = $80000002; { Hardware bus fault/access error }
  169. ACPU_AddressErr = $80000003; { Illegal address access (ie: odd) }
  170. ACPU_InstErr = $80000004; { Illegal instruction }
  171. ACPU_DivZero = $80000005; { Divide by zero }
  172. ACPU_CHK = $80000006; { Check instruction error }
  173. ACPU_TRAPV = $80000007; { TrapV instruction error }
  174. ACPU_PrivErr = $80000008; { Privilege violation error }
  175. ACPU_Trace = $80000009; { Trace error }
  176. ACPU_LineA = $8000000A; { Line 1010 Emulator error }
  177. ACPU_LineF = $8000000B; { Line 1111 Emulator error }
  178. ACPU_Format = $8000000E; { Stack frame format error }
  179. ACPU_Spurious = $80000018; { Spurious interrupt error }
  180. ACPU_AutoVec1 = $80000019; { AutoVector Level 1 interrupt error }
  181. ACPU_AutoVec2 = $8000001A; { AutoVector Level 2 interrupt error }
  182. ACPU_AutoVec3 = $8000001B; { AutoVector Level 3 interrupt error }
  183. ACPU_AutoVec4 = $8000001C; { AutoVector Level 4 interrupt error }
  184. ACPU_AutoVec5 = $8000001D; { AutoVector Level 5 interrupt error }
  185. ACPU_AutoVec6 = $8000001E; { AutoVector Level 6 interrupt error }
  186. ACPU_AutoVec7 = $8000001F; { AutoVector Level 7 interrupt error }
  187. { ********************************************************************
  188. *
  189. * General Alerts
  190. *
  191. * For example: timer.device cannot open math.library would be $05038015
  192. *
  193. * Alert(AN_TimerDev|AG_OpenLib|AO_MathLib);
  194. *
  195. ********************************************************************}
  196. const
  197. // ------ alert types
  198. AT_Deadend = $80000000;
  199. AT_Recovery = $00000000;
  200. // ------ general purpose alert codes
  201. AG_NoMemory = $00010000;
  202. AG_MakeLib = $00020000;
  203. AG_OpenLib = $00030000;
  204. AG_Opendev = $00040000;
  205. AG_OpenRes = $00050000;
  206. AG_IOError = $00060000;
  207. AG_NoSignal = $00070000;
  208. AG_BadParm = $00080000;
  209. AG_CloseLib = $00090000; // usually too many closes
  210. AG_CloseDev = $000A0000; // or a mismatched close
  211. AG_ProcCreate = $000B0000; // Process creation failed
  212. AG_Obsolete = $000C0000; // Obsolete feature used */
  213. // ------ alert objects:
  214. AO_ExecLib = $00008001;
  215. AO_GraphicsLib = $00008002;
  216. AO_LayersLib = $00008003;
  217. AO_Intuition = $00008004;
  218. AO_MathLib = $00008005;
  219. AO_DOSLib = $00008007;
  220. AO_RAMLib = $00008008;
  221. AO_IconLib = $00008009;
  222. AO_ExpansionLib = $0000800A;
  223. AO_DiskfontLib = $0000800B;
  224. AO_UtilityLib = $0000800C;
  225. AO_KeyMapLib = $0000800D;
  226. AO_NewlibLib = $0000800E;
  227. AO_AudioDev = $00008010;
  228. AO_ConsoleDev = $00008011;
  229. AO_GamePortDev = $00008012;
  230. AO_KeyboardDev = $00008013;
  231. AO_TrackDiskDev = $00008014;
  232. AO_TimerDev = $00008015;
  233. AO_CIARsrc = $00008020;
  234. AO_DiskRsrc = $00008021;
  235. AO_MiscRsrc = $00008022;
  236. AO_BootStrap = $00008030;
  237. AO_Workbench = $00008031;
  238. AO_DiskCopy = $00008032;
  239. AO_GadTools = $00008033;
  240. AO_Unknown = $00008035;
  241. { ********************************************************************
  242. *
  243. * Specific Alerts:
  244. *
  245. ********************************************************************}
  246. // ------ exec.library
  247. AN_ExecLib = $01000000;
  248. AN_ExcptVect = $01000001; // 68000 exception vector checksum (obs.)
  249. AN_BaseChkSum = $01000002; // Execbase checksum (obs.)
  250. AN_LibChkSum = $01000003; // Library checksum failure
  251. AN_IFaceChkSum = $01000004; // Interface checksum failure
  252. AN_MemCorrupt = $81000005; // Corrupt memory list detected in FreeMem
  253. AN_IntrMem = $81000006; // No memory for interrupt servers
  254. AN_InitAPtr = $01000007; // InitStruct() of an APTR source (obs.)
  255. AN_SemCorrupt = $01000008; // A semaphore is in an illegal state at ReleaseSempahore()
  256. AN_FreeTwice = $01000009; // Freeing memory already freed
  257. AN_BogusExcpt = $8100000A; // illegal 68k exception taken (obs.)
  258. AN_IOUsedTwice = $0100000B; // Attempt to reuse active IORequest
  259. AN_MemoryInsane = $0100000C; // Sanity check on memory list failed during AvailMem(MEMF_LARGEST)
  260. AN_IOAfterClose = $0100000D; // IO attempted on closed IORequest
  261. AN_StackProbe = $0100000E; // Stack appears to extend out of range
  262. AN_BadFreeAddr = $0100000F; // Memory header not located. [ Usually an invalid address passed to FreeMem() ]
  263. AN_BadSemaphore = $01000010; // An attempt was made to use the old message semaphores.
  264. AN_BadMemory = $01000011; // A bad memory request was made (Realloc on non-allocated memory)
  265. AN_BadHook = $01000012; // An uninitialized hook was called
  266. // ------ graphics.library
  267. AN_GraphicsLib = $02000000;
  268. AN_GfxNoMem = $82010000; // graphics out of memory
  269. AN_GfxNoMemMspc = $82010001; // MonitorSpec alloc, no memory
  270. AN_LongFrame = $82010006; // long frame, no memory
  271. AN_ShortFrame = $82010007; // short frame, no memory
  272. AN_TextTmpRas = $02010009; // text, no memory for TmpRas
  273. AN_BltBitMap = $8201000A; // BltBitMap, no memory
  274. AN_RegionMemory = $8201000B; // regions, memory not available
  275. AN_MakeVPort = $82010030; // MakeVPort, no memory
  276. AN_GfxNewError = $0200000C;
  277. AN_GfxFreeError = $0200000D;
  278. AN_GfxNoLCM = $82011234; // emergency memory not available
  279. AN_ObsoleteFont = $02000401; // unsupported font description used
  280. // ------ layers.library
  281. AN_LayersLib = $03000000;
  282. AN_LayersNoMem = $83010000; // layers out of memory
  283. // ------ intuition.library
  284. AN_Intuition = $04000000;
  285. AN_GadgetType = $84000001; // unknown gadget type
  286. AN_BadGadget = $04000001; // Recovery form of AN_GadgetType
  287. AN_CreatePort = $84010002; // create port, no memory
  288. AN_ItemAlloc = $04010003; // item plane alloc, no memory
  289. AN_SubAlloc = $04010004; // sub alloc, no memory
  290. AN_PlaneAlloc = $84010005; // plane alloc, no memory
  291. AN_ItemBoxTop = $84000006; // item box top < RelZero
  292. AN_OpenScreen = $84010007; // open screen, no memory
  293. AN_OpenScrnRast = $84010008; // open screen, raster alloc, no memory
  294. AN_SysScrnType = $84000009; // open sys screen, unknown type
  295. AN_AddSWGadget = $8401000A; // add SW gadgets, no memory
  296. AN_OpenWindow = $8401000B; // open window, no memory
  297. AN_BadState = $8400000C; // Bad State Return entering Intuition
  298. AN_BadMessage = $8400000D; // Bad Message received by IDCMP
  299. AN_WeirdEcho = $8400000E; // Weird echo causing incomprehension
  300. AN_NoConsole = $8400000F; // couldn't open the Console Device
  301. AN_NoISem = $04000010; // Intuition skipped obtaining a sem
  302. AN_ISemOrder = $04000011; // Intuition obtained a sem in bad order
  303. // ------ math.library
  304. AN_MathLib = $05000000;
  305. // ------ dos.library
  306. AN_DOSLib = $07000000;
  307. AN_StartMem = $07010001; // no memory at startup
  308. AN_endTask = $07000002; // endTask didn't
  309. AN_QPktFail = $07000003; // Qpkt failure
  310. AN_AsyncPkt = $07000004; // Unexpected packet received
  311. AN_FreeVec = $07000005; // Freevec failed
  312. AN_DiskBlkSeq = $07000006; // Disk block sequence error
  313. AN_BitMap = $07000007; // Bitmap corrupt
  314. AN_KeyFree = $07000008; // Key already free
  315. AN_BadChkSum = $07000009; // Invalid checksum
  316. AN_DiskError = $0700000A; // Disk Error
  317. AN_KeyRange = $0700000B; // Key out of range
  318. AN_BadOverlay = $0700000C; // Bad overlay
  319. AN_BadInitFunc = $0700000D; // Invalid init packet for cli/shell
  320. AN_FileReclosed = $0700000E; // A filehandle was closed more than once
  321. AN_NoBootNode = $0700000F; // No bootnode found in eb_MountList
  322. // ------ ramlib.library
  323. AN_RAMLib = $08000000;
  324. AN_BadSegList = $08000001; // no overlays in library seglists
  325. // ------ icon.library
  326. AN_IconLib = $09000000;
  327. // ------ expansion.library
  328. AN_ExpansionLib = $0A000000;
  329. AN_BadExpansionFree = $0A000001; // freeed free region
  330. // ------ diskfont.library
  331. AN_DiskfontLib = $0B000000;
  332. //------ newlib.library
  333. AN_NewlibLib = $0E000000;
  334. // ------ audio.device
  335. AN_AudioDev = $10000000;
  336. // ------ console.device
  337. AN_ConsoleDev = $11000000;
  338. AN_NoWindow = $11000001; // Console can't open initial window
  339. // ------ gameport.device
  340. AN_GamePortDev = $12000000;
  341. // ------ keyboard.device
  342. AN_KeyboardDev = $13000000;
  343. // ------ trackdisk.device
  344. AN_TrackDiskDev = $14000000;
  345. AN_TDCalibSeek = $14000001; // calibrate: seek error
  346. AN_TDDelay = $14000002; // delay: error on timer wait
  347. // ------ timer.device
  348. AN_TimerDev = $15000000;
  349. AN_TMBadReq = $15000001; // bad request
  350. AN_TMBadSupply = $15000002; // power supply -- no 50/60Hz ticks
  351. //------ cybppc.device
  352. AN_CybppcDev = $16000000;
  353. AN_CybppcNoTerm = $16000001; // no termination
  354. AN_CybppcNoWide = $16000002; // no wide termination
  355. // ------ cia.resource
  356. AN_CIARsrc = $20000000;
  357. // ------ disk.resource
  358. AN_DiskRsrc = $21000000;
  359. AN_DRHasDisk = $21000001; // get unit: already has disk
  360. AN_DRIntNoAct = $21000002; // interrupt: no active unit
  361. // ------ misc.resource
  362. AN_MiscRsrc = $22000000;
  363. // ------ bootstrap
  364. AN_BootStrap = $30000000;
  365. AN_BootError = $30000001; // boot code returned an error
  366. // ------ Workbench
  367. AN_Workbench = $31000000;
  368. AN_NoFonts = $B1000001;
  369. AN_WBBadStartupMsg1 = $31000001;
  370. AN_WBBadStartupMsg2 = $31000002;
  371. AN_WBBadIOMsg = $31000003; // Hacker code?
  372. AN_WBReLayoutToolMenu = $B1010009; // GadTools broke?
  373. // ------ DiskCopy
  374. AN_DiskCopy = $32000000;
  375. // ------ toolkit for Intuition
  376. AN_GadTools = $33000000;
  377. // ------ System utility library
  378. AN_UtilityLib = $34000000;
  379. // ------ For use by any application that needs it
  380. AN_Unknown = $35000000;
  381. type
  382. PResident = ^TResident;
  383. TResident = record
  384. rt_MatchWord: Word; // smallint to match on (ILLEGAL)
  385. rt_MatchTag: PResident; // pointer to the above
  386. rt_EndSkip: APTR; // address to continue scan
  387. rt_Flags: Byte; // various tag flags
  388. rt_Version: Byte; // release version number
  389. rt_Type: Byte; // type of module (NT_mumble)
  390. rt_Pri: Shortint; // initialization priority
  391. rt_Name: STRPTR; // pointer to node name
  392. rt_IdString: STRPTR; // pointer to ident string
  393. rt_Init: APTR; // pointer to init code
  394. end;
  395. const
  396. RTC_MATCHWORD = $4AFC; // The 68000 "ILLEGAL" instruction
  397. // enResidentFlags
  398. RTF_AUTOINIT = 1 shl 7; // rt_Init points to data structure
  399. RTF_NATIVE = 1 shl 5; // rt_Init points to a native function (otherwise, 68k is assumed)
  400. RTF_AFTERDOS = 1 shl 2;
  401. RTF_SINGLETASK = 1 shl 1;
  402. RTF_COLDSTART = 1 shl 0;
  403. type
  404. // ****** MemChunk *****************************************************
  405. PMemChunk = ^TMemChunk;
  406. TMemChunk = record
  407. mc_Next: PMemChunk; // pointer to next chunk
  408. mc_Bytes: LongWord; // chunk byte size
  409. end;
  410. // ****** MemHeader ****************************************************
  411. PMemHeader = ^TMemHeader;
  412. TMemHeader = record
  413. mh_Node: TNode;
  414. mh_Attributes: Word; // characteristics of this region
  415. mh_First: PMemChunk; // first free region
  416. mh_Lower: APTR; // lower memory bound
  417. mh_Upper: APTR; // upper memory bound + 1
  418. mh_Free: LongWord; // total number of free bytes
  419. end;
  420. // ****** MemEntry *****************************************************
  421. PMemEntry = ^TMemEntry;
  422. TMemEntry = record
  423. me_Un: record
  424. case LongInt of
  425. 0: (meu_Reqs: LongWord);
  426. 1: (meu_Addr: APTR);
  427. end;
  428. me_Length: LongWord;
  429. end;
  430. // ****** MemList ******************************************************
  431. // Note: sizeof(struct MemList) includes the size of the first MemEntry!
  432. PMemList = ^TMemList;
  433. TMemList = record
  434. ml_Node: TNode;
  435. ml_NumEntries: Word; // number of entries in this struct
  436. ml_ME: array[0..0] of TMemEntry; // the first entry
  437. end;
  438. // ----- Memory Requirement Types ---------------------------
  439. // ----- See the AllocMem() documentation for details--------
  440. const
  441. MEMF_ANY = 0; // Any type of memory will do
  442. MEMF_PUBLIC = 1 shl 0;
  443. MEMF_CHIP = 1 shl 1;
  444. MEMF_FAST = 1 shl 2;
  445. MEMF_VIRTUAL = 1 shl 3; // Memory that is mapped/paged
  446. MEMF_EXECUTABLE = 1 shl 4; // Memory that contains executable code
  447. MEMF_LOCAL = 1 shl 8; // Memory that does not go away at RESET
  448. MEMF_24BITDMA = 1 shl 9; // DMAable memory within 24 bits of address
  449. MEMF_KICK = 1 shl 10; // Memory that can be used for KickTags
  450. MEMF_PRIVATE = 1 shl 11; // Memory that is only _visible_ to the allocator task
  451. MEMF_SHARED = 1 shl 12; // Memory that is visible and accessible to all tasks
  452. MEMF_CLEAR = 1 shl 16; // AllocMem: NL out area before return
  453. MEMF_LARGEST = 1 shl 17; // AvailMem: return the largest chunk size
  454. MEMF_REVERSE = 1 shl 18; // AllocMem: allocate from the top down
  455. MEMF_TOTAL = 1 shl 19; // AvailMem: return total size of memory
  456. MEMF_HWALIGNED = 1 shl 20; // AllocMem: Allocate aligned to hardware page size
  457. MEMF_DELAYED = 1 shl 21; // AllocMem: Delay physical memory mapping
  458. MEMF_CORE_RESIDENT = 1 shl 22; // Availmem: return only memory that is not paged out
  459. MEMF_NO_EXPUNGE = 1 shl 31; // AllocMem: Do not cause expunge on failure
  460. MEM_BLOCKSIZE = 16;
  461. MEM_BLOCKMASK = MEM_BLOCKSIZE - 1;
  462. type
  463. // ***** MemHandlerData ************************************************
  464. // Note: This structure is *READ ONLY* and only EXEC can create it!
  465. PMemHandlerData = ^TMemHandlerData;
  466. TMemHandlerData = record
  467. memh_RequestSize: LongWord; // Requested allocation size
  468. memh_RequestFlags: LongWord; // Requested allocation flags
  469. memh_Flags: LongWord; // Flags (see below)
  470. end;
  471. const
  472. MEMHF_RECYCLE = 1 shl 0; // 0 = First time, 1 = recycle
  473. // ***** Low Memory handler return values ******************************
  474. MEM_DID_NOTHING = 0; // Nothing we could do...
  475. MEM_ALL_DONE = -1; // We did all we could do
  476. MEM_TRY_AGAIN = 1; // We did some, try the allocation again
  477. // ****** Memory attributes ********************************************
  478. //enMemAttrs
  479. MEMATTRF_WRITETHROUGH = 1 shl 0; // Stores in this area update cache and memory
  480. MEMATTRF_CACHEINHIBIT = 1 shl 1; // Caches are inhibited in this area
  481. MEMATTRF_COHERENT = 1 shl 2; // Coherency required, stores to same region will be serialized
  482. MEMATTRF_GUARDED = 1 shl 3; // Ensure in-order execute of memory accesses
  483. MEMATTRF_REFERENCED = 1 shl 4; // Page containing memory location has been referenced (used)
  484. MEMATTRF_CHANGED = 1 shl 5; // Page containing memory location has been changed
  485. // The following are mutually exclusive
  486. MEMATTRF_SUPER_RW = 0 shl 6;
  487. MEMATTRF_SUPER_RW_USER_RO = 1 shl 6;
  488. MEMATTRF_SUPER_RW_USER_RW = 2 shl 6;
  489. MEMATTRF_SUPER_RO_USER_RO = 3 shl 6;
  490. MEMATTRF_RW_MASK = 3 shl 6;
  491. MEMATTRF_EXECUTE = 1 shl 9; // CPU can execute instructions from this memory
  492. MEMATTRF_NOT_MAPPED = 1 shl 10; // Special flag: The memory is not mapped at all. This flag is only used as return value of GetMemoryAttr
  493. MEMATTRF_RESERVED1 = 1 shl 11; // Used by the system
  494. MEMATTRF_RESERVED2 = 1 shl 12; // _NEVER_ use these
  495. MEMATTRF_RESERVER3 = 1 shl 13;
  496. // Short forms for common cases
  497. MEMATTRF_READ_WRITE = MEMATTRF_SUPER_RW_USER_RW;
  498. MEMATTRF_READ_ONLY = MEMATTRF_SUPER_RO_USER_RO;
  499. // ****** GetMemoryAttrs flags *****************************************
  500. // enGetMemoryAttrsFlags
  501. GMAF_REPORT_CR = 1 shl 0;
  502. // ****** AllocSysObject flags *****************************************
  503. // enAllocSysObjectFlags
  504. ASOF_NOTRACK = 1 shl 1; // Used internally to indicate no tracking of object
  505. // ****** Trackable ****************************************************
  506. // Warning: Do NOT allocate one of those yourself!
  507. type
  508. PTrackable = ^TTrackable;
  509. TTrackable = record
  510. Destructor_: THook;
  511. Object_: APTR;
  512. Flags: LongWord;
  513. HashChain: PTrackable;
  514. end; // Long word aligned
  515. const
  516. // enTrackableFlags
  517. TRACKF_COMPACT = 1 shl 0; // Trackable was allocated by "constructor"
  518. // ****** DMA Scatter list *********************************************
  519. type
  520. PDMAEntry = ^TDMAEntry;
  521. TDMAEntry = record
  522. PhysicalAddress: APTR; // Physically mapped address
  523. BlockLength: LongWord; // Length of the block in physical memory
  524. end;
  525. // ****** Named memory scan message ************************************
  526. PSNMMessage = ^TSNMMessage;
  527. TSNMMessage = record
  528. Namespace: STRPTR;
  529. Name: STRPTR;
  530. Memory: APTR;
  531. Size: LongWord;
  532. Flags: LongWord;
  533. end;
  534. const
  535. SNMF_NAMESPACES_ONLY = 1 shl 0;
  536. type
  537. PInterrupt = ^TInterrupt;
  538. TInterrupt = record
  539. is_Node: TNode;
  540. is_Data: APTR; // Server data segment
  541. is_Code: TProcedure; // Server code entry
  542. end;
  543. PIntVector = ^TIntVector;
  544. TIntVector = record // For EXEC use ONLY!
  545. iv_Data: APTR;
  546. iv_Code: TProcedure;
  547. iv_Node: PNode;
  548. end;
  549. PSoftIntList = ^TSoftIntList;
  550. TSoftIntList = record // For EXEC use ONLY!
  551. sh_List: TList;
  552. sh_Pad: Word;
  553. end;
  554. PExceptionContext = ^TExceptionContext;
  555. TExceptionContext = record
  556. Flags: LongWord; // Flags, describing the context (READ-ONLY)
  557. Traptype: LongWord; // Type of trap (READ-ONLY)
  558. msr: LongWord; // Machine state
  559. ip: LongWord; // Return instruction pointer
  560. gpr: array[0..31] of LongWord; // r0 - r31
  561. cr: LongWord; // Condition code register
  562. xer: LongWord; // Extended exception register
  563. ctr: LongWord; // Count register
  564. lr: LongWord; // Link register
  565. dsisr: LongWord; // DSI status register. Only set when valid
  566. dar: LongWord; // Data address register. Only set when valid
  567. fpr: array[0..31] of double; // Floating point registers
  568. fpscr: QWord; // Floating point control and status register
  569. // The following are only used on AltiVec
  570. vscr: array[0..15] of Byte; // AltiVec vector status and control register
  571. vr: array[0..511] of Byte; // AltiVec vector register storage
  572. vrsave: LongWord; // AltiVec VRSAVE register
  573. end;
  574. const
  575. // Flags for ExceptionContext
  576. // enECFlags
  577. ECF_FULL_GPRS = 1 shl 0; // Set if all register have been saved
  578. // If this flag is not set; gpr[14] through
  579. // gpr[31] are invalid
  580. ECF_FPU = 1 shl 1; // Set if the FPU registers have been saved
  581. ECF_FULL_FPU = 1 shl 2; // Set if all FPU registers have been saved
  582. ECF_VECTOR = 1 shl 3; // Set if vector registers have been saved
  583. ECF_VRSAVE = 1 shl 4; // Set if VRSAVE reflects state of vector registers saved
  584. // Flags for ReadTaskContext/WriteTaskContext
  585. // enRTCFlags
  586. RTCF_SPECIAL = 1 shl 0;
  587. RTCF_STATE = 1 shl 1;
  588. RTCF_GENERAL = 1 shl 2;
  589. RTCF_FPU = 1 shl 3;
  590. RTCF_VECTOR = 1 shl 4;
  591. RTCF_INFO = 1 shl 5;
  592. SIH_PRIMASK = $F0;
  593. //**********************************************************************
  594. // this is a fake INT definition, used only for AddIntServer and the like
  595. INTB_NMI = 15;
  596. INTF_NMI = 1 shl INTB_NMI;
  597. // These are used with AddIntServer/SetIntVector to install global
  598. // trap handlers and with SetTaskTrap to install local task traps
  599. // Note: Use of these global trap handlers should be
  600. // restricted to system and debugger use. You should normally
  601. // use the task's local trap handler.
  602. // enTrapNumbers
  603. TRAPNUM_BUS_ERROR = $01000000; // Bus error exception/machine check
  604. TRAPNUM_DATA_SEGMENT_VIOLATION = $02000000; // Data segment violation
  605. TRAPNUM_INST_SEGMENT_VIOLATION = $03000000; // Instruction segment violation
  606. TRAPNUM_ALIGNMENT = $04000000; // Alignment violation
  607. TRAPNUM_ILLEGAL_INSTRUCTION = $05000000; // Illegal instruction
  608. TRAPNUM_PRIVILEGE_VIOLATION = $06000000; // Privilege violation
  609. TRAPNUM_TRAP = $07000000; // Trap instruction
  610. TRAPNUM_FPU = $08000000; // Floating point related (FPU disabled; imprecise)
  611. TRAPNUM_TRACE = $09000000; // Single step trace exception
  612. TRAPNUM_DATA_BREAKPOINT = $0a000000; // Data breakpoint
  613. TRAPNUM_INST_BREAKPOINT = $0b000000; // Instruction breakpoint
  614. TRAPNUM_PERFORMANCE = $0c000000; // Performance monitor (System use only)
  615. TRAPNUM_THERMAL = $0d000000; // Thermal management (System use only)
  616. TRAPNUM_RESERVED1 = $0e000000; // reserved
  617. TRAPNUM_ALTIVEC_ASSIST = $0f000000; // AltiVec Assist
  618. TRAPNUM_SMI = $10000000; // System Management interrupt
  619. TRAPNUM_NUMTRAPS = 16; // Number of hardware traps
  620. // Every Amiga Task has one of these Task structures associated with it.
  621. // To find yours, use FindTask(Nil). AmigaDOS processes tack a few more
  622. // values on to the end of this structure, which is the difference between
  623. // Tasks and Processes.
  624. type
  625. PTask = ^TTask;
  626. TTask = record
  627. tc_Node: TNode;
  628. tc_Flags: Byte;
  629. tc_State: Byte;
  630. tc_IDNestCnt: ShortInt; // intr disabled nesting
  631. tc_TDNestCnt: ShortInt; // task disabled nesting
  632. tc_SigAlloc: LongWord; // sigs allocated
  633. tc_SigWait: LongWord; // sigs we are waiting for
  634. tc_SigRecvd: LongWord; // sigs we have received
  635. tc_SigExcept: LongWord; // sigs we will take excepts for
  636. //The following field used to be this tc_TrapAlloc, tc_TrapAble, It was replaced by a pointer to an private extended task structure.
  637. tc_ETask: APTR;
  638. tc_ExceptData: APTR; // points to except data
  639. tc_ExceptCode: APTR; // points to except code
  640. tc_TrapData: APTR; // points to trap data
  641. tc_TrapCode: APTR; // points to trap code
  642. tc_SPReg: APTR; // stack APTR
  643. tc_SPLower: APTR; // stack lower bound
  644. tc_SPUpper: APTR; // stack upper bound + 2
  645. tc_Switch: TProcedure; // task losing CPU
  646. tc_Launch: TProcedure; // task getting CPU
  647. tc_MemEntry: TList; // allocated memory
  648. tc_UserData: APTR; // per task data
  649. end;
  650. // Stack swap structure as passed to StackSwap()
  651. PStackSwapStruct = ^TStackSwapStruct;
  652. TStackSwapStruct = record
  653. stk_Lower: APTR; // Lowest byte of stack
  654. stk_Upper: LongWord; // Upper end of stack (size + Lowest)
  655. stk_Pointer: APTR; // Stack pointer at switch point
  656. end;
  657. // ----- Flag Bits ------------------------------------------
  658. const
  659. // enTaskFlagsBits
  660. TB_PROCTIME = 0;
  661. TB_ETASK = 3;
  662. TB_STACKCHK = 4;
  663. TB_EXCEPT = 5;
  664. TB_SWITCH = 6;
  665. TB_LAUNCH = 7;
  666. // enTaskFlags
  667. TF_PROCTIME = 1;
  668. TF_ETASK = 8;
  669. TF_STACKCHK = 16;
  670. TF_EXCEPT = 32;
  671. TF_SWITCH = 64;
  672. TF_LAUNCH = 128;
  673. // ----- Task States ----------------------------------------
  674. // enTaskState
  675. TS_INVALID = 0;
  676. TS_ADDED = 1;
  677. TS_RUN = 2;
  678. TS_READY = 3;
  679. TS_WAIT = 4;
  680. TS_EXCEPT = 5;
  681. TS_REMOVED = 6;
  682. TS_CRASHED = 7;
  683. TS_SUSPENDED = 8;
  684. // ----- Predefined Signals -------------------------------------
  685. // enTaskSignalBits
  686. SIGB_ABORT = 0;
  687. SIGB_CHILD = 1;
  688. SIGB_BLIT = 4;
  689. SIGB_SINGLE = 4;
  690. SIGB_INTUITION = 5;
  691. SIGB_NET = 7;
  692. SIGB_DOS = 8;
  693. // enTaskSignal
  694. SIGF_ABORT = 1 shl SIGB_ABORT;
  695. SIGF_CHILD = 1 shl SIGB_CHILD;
  696. SIGF_BLIT = 1 shl SIGB_BLIT;
  697. SIGF_SINGLE = 1 shl SIGB_SINGLE;
  698. SIGF_INTUITION = 1 shl SIGB_INTUITION;
  699. SIGF_NET = 1 shl SIGB_NET;
  700. SIGF_DOS = 1 shl SIGB_DOS;
  701. // enSuspendBits
  702. STB_CRASHED = 0;
  703. STB_REMOVED = 1;
  704. // enSuspendFlags
  705. STF_CRASHED = 1 shl STB_CRASHED;
  706. STF_REMOVED = 1 shl STB_REMOVED;
  707. // This file defines ports and messages, which are used for inter-
  708. // task communications using the routines defined toward the
  709. // bottom of this file.
  710. type
  711. // ****** MsgPort ******************************************************
  712. PMsgPort = ^TMsgPort;
  713. TMsgPort = record
  714. mp_Node: TNode;
  715. mp_Flags: Byte;
  716. mp_SigBit: Byte; // signal bit number
  717. mp_SigTask: APTR; // task to be signalled (TaskPtr)
  718. mp_MsgList: TList; // message linked list
  719. end;
  720. // ****** Message ******************************************************
  721. PMessage = ^TMessage;
  722. TMessage = record
  723. mn_Node: TNode;
  724. mn_ReplyPort: PMsgPort; // message reply port
  725. mn_Length: Word; // total message length, in bytes, (include the size of the Message structure in the length)
  726. end;
  727. // mp_Flags: Port arrival actions (PutMsg)
  728. const
  729. // enMsgPortFlags
  730. PF_ACTION = 3; // Mask
  731. PF_SIGALLOC = 1 shl 7; // Internal use
  732. // enMsgPortActions
  733. PA_SIGNAL = 0; // Signal task in mp_SigTask
  734. PA_SOFTINT = 1; // Signal SoftInt in mp_SoftInt/mp_SigTask
  735. PA_IGNORE = 2; // Ignore arrival
  736. // ****** SignalSemaphore **********************************************
  737. type
  738. // Private structure used by ObtainSemaphore()
  739. PSemaphoreRequest = ^TSemaphoreRequest;
  740. TSemaphoreRequest = record
  741. sr_Link: TMinNode;
  742. sr_Waiter: PTask;
  743. end;
  744. // Signal Semaphore data structure
  745. PSignalSemaphore = ^TSignalSemaphore;
  746. TSignalSemaphore = record
  747. ss_Link: TNode;
  748. ss_NestCount: SmallInt;
  749. ss_WaitQueue: TMinList;
  750. ss_MultipleLink: TSemaphoreRequest;
  751. ss_Owner: PTask;
  752. ss_QueueCount: SmallInt;
  753. end;
  754. // ***** Semaphore procure message (for use in V39 Procure/Vacate ***
  755. PSemaphoreMessage = ^TSemaphoreMessage;
  756. TSemaphoreMessage = record
  757. ssm_Message: TMessage;
  758. ssm_Semaphore: PSignalSemaphore;
  759. end;
  760. const
  761. // enSemaphoreRequestType
  762. SM_SHARED = 1;
  763. SM_EXCLUSIVE = 0;
  764. const
  765. // ------ Special constants ---------------------------------------
  766. // Note: This only applies to "legacy" 68k-based functions
  767. LIB_VECTSIZE = 6; // Each library entry takes 6 bytes
  768. LIB_RESERVED = 4; // Exec reserves the first 4 vectors
  769. LIB_BASE = -LIB_VECTSIZE;
  770. LIB_USERDEF = LIB_BASE - (LIB_RESERVED * LIB_VECTSIZE);
  771. LIB_NONSTD = LIB_USERDEF;
  772. // ------ Standard functions --------------------------------------
  773. // Note: This only applies to "legacy" 68k-based functions
  774. LIB_OPEN = -6;
  775. LIB_CLOSE = -12;
  776. LIB_EXPUNGE = -18;
  777. LIB_EXTFUNC = -24; // for future expansion
  778. type
  779. // ------ Library Base Structure ----------------------------------
  780. // Also used for Devices and some Resources
  781. PLibrary = ^TLibrary;
  782. TLibrary = record
  783. lib_Node: TNode;
  784. lib_Flags: Byte;
  785. lib_ABIVersion: Byte; // ABI exported by library
  786. lib_NegSize: Word; // number of bytes before library
  787. lib_PosSize: Word; // number of bytes after library
  788. lib_Version: Word; // major
  789. lib_Revision: Word; // minor
  790. lib_IdString: STRPTR; // ASCII identification
  791. lib_Sum: LongWord; // the checksum itself }
  792. lib_OpenCnt: Word; // number of current opens }
  793. end; // Warning: size is not a longword multiple!
  794. const
  795. // lib_ABIVersion definitions
  796. // enABIVersion
  797. LIBABI_68K = 0; // A 68k library (pre OS4)
  798. LIBABI_MIFACE = 1; // V50 multi interface library
  799. // lib_Flags bit definitions (all others are system reserved)
  800. LIBF_SUMMING = 1 shl 0; // we are currently checksumming
  801. LIBF_CHANGED = 1 shl 1; // we have just changed the lib
  802. LIBF_SUMUSED = 1 shl 2; // set if we should bother to sum
  803. LIBF_DELEXP = 1 shl 3; // delayed expunge
  804. LIBF_EXP0CNT = 1 shl 4;
  805. // This file defines the constants and types required to use
  806. // Amiga device IO routines, which are also defined here.
  807. type
  808. //***** Device *********************************************************
  809. PDevice = ^TDevice;
  810. TDevice = record
  811. dd_Library: TLibrary;
  812. end;
  813. //***** Unit ***********************************************************
  814. PUnit = ^TUnit;
  815. TUnit = record
  816. unit_MsgPort: TMsgPort; // queue for unprocessed messages instance of msgport is recommended
  817. unit_flags: Byte;
  818. unit_pad: Byte;
  819. unit_OpenCnt: Word; // number of active opens
  820. end;
  821. const
  822. UNITF_ACTIVE = 1 shl 0;
  823. UNITF_INTASK = 1 shl 1;
  824. type
  825. PIORequest = ^TIORequest;
  826. TIORequest = record
  827. io_Message: TMessage;
  828. io_Device: PDevice; // device node pointer
  829. io_Unit: PUnit; // unit (driver private)
  830. io_Command: Word; // device command
  831. io_Flags: Byte;
  832. io_Error: ShortInt; // error or warning num
  833. end;
  834. PIOStdReq = ^TIOStdReq;
  835. TIOStdReq = record
  836. io_Message: TMessage;
  837. io_Device: PDevice; // device node pointer
  838. io_Unit: PUnit; // unit (driver private)
  839. io_Command: Word; // device command
  840. io_Flags: Byte;
  841. io_Error: ShortInt; // error or warning num
  842. io_Actual: LongWord; // actual number of bytes transferred
  843. io_Length: LongWord; // requested number bytes transferred
  844. io_Data: APTR; // points to data area
  845. io_Offset: LongWord; // offset for block structured devices
  846. end;
  847. // library vector offsets for device reserved vectors }
  848. const
  849. // enum enDeviceLibraryReserved
  850. DEV_beginIO = -30;
  851. DEV_ABORTIO = -36;
  852. // io_Flags defined bits
  853. IOB_QUICK = 0;
  854. IOF_QUICK = 1 shl IOB_QUICK;
  855. // enDefaultDeviceCommands
  856. CMD_INVALID = 0;
  857. CMD_RESET = 1;
  858. CMD_READ = 2;
  859. CMD_WRITE = 3;
  860. CMD_UPDATE = 4;
  861. CMD_CLEAR = 5;
  862. CMD_STOP = 6;
  863. CMD_START = 7;
  864. CMD_FLUSH = 8;
  865. CMD_NONSTD = 9;
  866. {$PACKRECORDS C}
  867. //**********************************************************************
  868. // The interface is the new way for exec libraries.
  869. // Basically, the interface is embedded in a table of
  870. // function pointers similar to the old library jump table.
  871. //
  872. // FIXME: Add some more documentation
  873. type
  874. TInterfaceData = record
  875. Link: TNode; // Node for linking several interfaces
  876. LibBase: PLibrary; // Library this interface belongs to
  877. RefCount: LongWord; // Reference count
  878. Version: LongWord; // Version number of the interface
  879. Flags: LongWord; // Various flags (see below)
  880. CheckSum: LongWord; // Checksum of the interface
  881. PositiveSize: LongWord; // Size of the function pointer part, (with this struct)
  882. NegativeSize: LongWord; // Size of the data area
  883. IExecPrivate: APTR; // Private copy of IExec
  884. EnvironmentVector: APTR; // Base address for base relative code
  885. Reserved3: LongWord;
  886. Reserved4: LongWord;
  887. end;
  888. TInterface = record
  889. Data: TInterfaceData;
  890. // some functions, calling convention?
  891. end;
  892. PInterface = ^TInterface;
  893. {$PACKRECORDS 2}
  894. const
  895. // Flags for the Flags field in interfaces and as flags parameter for GetInterface
  896. // enInterfaceFlags
  897. IFLF_NONE = $0000; // No flags
  898. IFLF_PROTECTED = $0001; // This interface can't be SetMethod'd
  899. IFLF_NOT_NATIVE = $0002; // Interface is 68k
  900. IFLF_PRIVATE = $0004; // Interface is a private, non-shareable instance
  901. IFLF_CHANGED = $0008; // Interface has been changed, ready for re-summing
  902. IFLF_UNMODIFIED = $0010; // Interface is unmodified. This flag will be set
  903. // if the interface is created, and reset as soon
  904. // as someone uses SetMethod on it.
  905. IFLF_CLONED = $0020; // Interface was created by Clone method and will
  906. // have to be freed via Expunge(). Interface
  907. // implementors must set this bit in Clone().
  908. IFLF_CLONE_EXPUNGE = $0040; // Call Expunge() on cloned interface when the
  909. // reference count reaches zero. (V53.31)
  910. // Definition of the Exec library base structure (pointed to by location 4).
  911. // Most fields are not to be viewed or modified by user programs. Use
  912. // extreme caution.
  913. type
  914. PExecBase = ^TExecBase;
  915. TExecBase = Record
  916. LibNode: TLibrary; // Standard library node
  917. // ******* Static System Variables *************************************
  918. SoftVer: Word; // kickstart release number (obs.)
  919. LowMemChkSum: SmallInt; // checksum of 68000 trap vectors
  920. ChkBase: LongWord; // system base pointer complement
  921. ColdCapture: APTR; // coldstart soft capture vector
  922. CoolCapture: APTR; // coolstart soft capture vector
  923. WarmCapture: APTR; // warmstart soft capture vector
  924. SysStkUpper: APTR; // system stack base (upper bound)
  925. SysStkLower: APTR; // top of system stack (lower bound)
  926. MaxLocMem: LongWord; // top of chip memory
  927. DebugEntry: APTR; // global debugger entry point
  928. DebugData: APTR; // global debugger data segment
  929. AlertData: APTR; // alert data segment
  930. MaxExtMem: APTR; // top of extended mem, or nil if none
  931. ChkSum: Word; // for all of the above (minus 2)
  932. // ****** Interrupt Related ********************************************
  933. IntVects: array[0..15] of TIntVector;
  934. // ****** Dynamic System Variables *************************************
  935. ThisTask: PTask; // pointer to current task (readable)
  936. IdleCount: LongWord; // idle counter
  937. DispCount: LongWord; // dispatch counter
  938. Quantum: Word; // time slice quantum
  939. Elapsed: Word; // current quantum ticks
  940. SysFlags: Word; // misc internal system flags
  941. IDNestCnt: ShortInt; // interrupt disable nesting count
  942. TDNestCnt: ShortInt; // task disable nesting count
  943. AttnFlags: Word; // special attention flags (readable)
  944. AttnResched: Word; // rescheduling attention
  945. ResModules: APTR; // resident module array pointer
  946. TaskTrapCode: APTR;
  947. TaskExceptCode: APTR;
  948. TaskExitCode: APTR;
  949. TaskSigAlloc: LongWord;
  950. TaskTrapAlloc: Word;
  951. // ****** System Lists (private!) **************************************
  952. MemList: TList;
  953. ResourceList: TList;
  954. DeviceList: TList;
  955. IntrList: TList;
  956. LibList: TList;
  957. PortList: TList;
  958. TaskReady: TList;
  959. TaskWait: TList;
  960. SoftInts: array[0..4] of TSoftIntList;
  961. // ****** Other Globals ************************************************
  962. LastAlert: array[0..3] of LongInt;
  963. // these next two variables are provided to allow
  964. // system developers to have a rough idea of the
  965. // period of two externally controlled signals --
  966. // the time between vertical blank interrupts and the
  967. // external line rate (which is counted by CIA A's
  968. // "time of day" clock). In general these values
  969. // will be 50 or 60, and may or may not track each
  970. // other. These values replace the obsolete AFB_PAL
  971. // and AFB_50HZ flags.
  972. VBlankFrequency: Byte; // (readable)
  973. PowerSupplyFrequency: Byte; // (readable)
  974. SemaphoreList: TList;
  975. // these next two are to be able to kickstart into user ram.
  976. // KickMemPtr holds a singly linked list of MemLists which
  977. // will be removed from the memory list via AllocAbs. If
  978. // all the AllocAbs's succeeded, then the KickTagPtr will
  979. // be added to the rom tag list.
  980. KickMemPtr: APTR; // ptr to queue of mem lists
  981. KickTagPtr: APTR; // ptr to rom tag queue
  982. KickCheckSum: APTR; // checksum for mem and tags
  983. // ****** V36 Exec additions start here ********************************
  984. ex_Pad0: Word; // Private internal use
  985. ex_LaunchPoint: LongWord; // Private to Launch/Switch
  986. ex_RamLibPrivate: APTR;
  987. // The next LongWord contains the system "E" clock frequency,
  988. // expressed in Hertz. The E clock is used as a timebase for
  989. // the Amiga's 8520 I/O chips. (E is connected to "02").
  990. // Typical values are 715909 for NTSC, or 709379 for PAL.
  991. ex_EClockFrequency: LongWord; // (readable)
  992. ex_CacheControl: LongWord; // Private to CacheControl calls
  993. ex_TaskID: LongWord; // Next available task ID
  994. ex_Reserved1: array[0..4] of LongWord;
  995. ex_MMULock: APTR; // private
  996. ex_Reserved2: array[0..2] of LongWord;
  997. // ****** V39 Exec additions start here ********************************
  998. // The following list and data element are used
  999. //for V39 exec's low memory handler...
  1000. ex_MemHandlers: TMinList; // The handler list
  1001. ex_MemHandler: APTR; // Private! handler pointer
  1002. // ****** V50 Exec additions start here ********************************
  1003. MainInterface: PInterface; // ExecLibrary's primary interface
  1004. Private01: APTR;
  1005. Private02: LongWord;
  1006. Private03: APTR;
  1007. Private04: APTR;
  1008. Private05: APTR;
  1009. Private06: TList;
  1010. Private07: APTR;
  1011. EmuWS: APTR; // Emulator Workspace. Legacy libraries might access this field
  1012. // Yes, there are more additions, but you don't need to know what it is
  1013. end;
  1014. // ***** Bit defines for AttnFlags (see above) *************************
  1015. // Processors and Co-processors:
  1016. // enAttnFlagBits
  1017. const
  1018. AFB_68010 = 0; // also set for 68020
  1019. AFB_68020 = 1; // also set for 68030
  1020. AFB_68030 = 2; // also set for 68040
  1021. AFB_68040 = 3; // also set for 68060
  1022. AFB_68881 = 4; // also set for 68882
  1023. AFB_68882 = 5;
  1024. AFB_FPU40 = 6; // Set if 68040 FPU
  1025. AFB_68060 = 7;
  1026. // The following flags are new to V50
  1027. AFB_603 = 8;
  1028. AFB_604 = 9;
  1029. AFB_750 = 10;
  1030. AFB_7400 = 11;
  1031. AFB_ALTIVEC = 12;
  1032. AFB_4XX = 13;
  1033. AFB_OTHER = 14;
  1034. // The AFB_FPU40 bit is set when a working 68040 FPU
  1035. // is in the system. If this bit is set and both the
  1036. // AFB_68881 and AFB_68882 bits are not set, then the 68040
  1037. // math emulation code has not been loaded and only 68040
  1038. // FPU instructions are available. This bit is valid *ONLY*
  1039. // if the AFB_68040 bit is set.
  1040. // Likewise, AFB_ALTIVEC identifies an existing AltiVec unit.
  1041. AFB_PRIVATE = 15; // Just what it says
  1042. // enAttnFlags
  1043. AFF_68010 = 1 shl 0;
  1044. AFF_68020 = 1 shl 1;
  1045. AFF_68030 = 1 shl 2;
  1046. AFF_68040 = 1 shl 3;
  1047. AFF_68881 = 1 shl 4;
  1048. AFF_68882 = 1 shl 5;
  1049. AFF_FPU40 = 1 shl 6;
  1050. AFF_68060 = 1 shl 7;
  1051. AFF_603 = 1 shl 8;
  1052. AFF_604 = 1 shl 9;
  1053. AFF_750 = 1 shl 10;
  1054. AFF_7400 = 1 shl 11;
  1055. AFF_ALTIVEC = 1 shl 12;
  1056. AFF_4XX = 1 shl 13;
  1057. AFF_OTHER = 1 shl 14;
  1058. AFF_PRIVATE = 1 shl 15;
  1059. //***** Selected flag definitions for Cache manipulation calls *********
  1060. CACRF_EnableI = 1 shl 0; // Enable instruction cache
  1061. CACRF_FreezeI = 1 shl 1; // Freeze instruction cache
  1062. CACRF_ClearI = 1 shl 3; // Clear instruction cache
  1063. CACRF_IBE = 1 shl 4; // Instruction burst enable
  1064. CACRF_EnableD = 1 shl 8; // Enable data cache
  1065. CACRF_FreezeD = 1 shl 9; // Freeze data cache
  1066. CACRF_ClearD = 1 shl 11; // Clear data cache (flush to memory first)
  1067. CACRF_DBE = 1 shl 12; // 68030 Data burst enable
  1068. CACRF_WriteAllocate = 1 shl 13; // 68030 Write-Allocate mode (must always be set!)
  1069. CACRF_InvalidateD = 1 shl 15; // Invalidate data cache (no writeback)
  1070. CACRF_EnableE = 1 shl 30; // Master enable for external caches.
  1071. // External caches should track the
  1072. // state of the internal caches
  1073. // such that they do not cache anything
  1074. // that the internal cache turned off
  1075. // for.
  1076. CACRF_CopyBack = 1 shl 31; // Master enable for copyback caches
  1077. // enDMAFlags
  1078. DMA_Continue = 1 shl 1; // Continuation flag for CachePreDMA
  1079. DMAF_Continue = DMA_Continue;
  1080. DMA_NoModify = 1 shl 2; // Set if DMA does not update memory
  1081. DMAF_NoModify = DMA_NoModify;
  1082. DMA_ReadFromRAM = 1 shl 3; // Set if DMA goes *FROM* RAM to device
  1083. DMAF_ReadFromRAM = DMA_ReadFromRAM;
  1084. // The only fixed address in the Amiga memory space.
  1085. AbsExecBase: PExecBase = Pointer(4);
  1086. // Don't even think about the contents of this structure. Just embed it and reference it
  1087. type
  1088. PAVLNode = ^TAVLNode;
  1089. TAVLNode = record
  1090. Reserved: array[0..3] of LongWord;
  1091. end;
  1092. PPAVLNode = ^PAVLNode;
  1093. TAVLKey = Pointer;
  1094. PAVLNODECOMP = ^AVLNODECOMP;
  1095. AVLNODECOMP = APTR;
  1096. PAVLKEYCOMP = ^AVLKEYCOMP;
  1097. AVLKEYCOMP = APTR;
  1098. const
  1099. // Minimum size of the buffers to receive disassembled opcodes
  1100. // and operands including the NIL string terminator.
  1101. LEN_DISASSEMBLE_OPCODE_STRING = 15;
  1102. LEN_DISASSEMBLE_OPERANDS_STRING = 40;
  1103. type
  1104. // The StackFrameMsg is used when traversing a Task's stack.
  1105. TStackFrameMsg = record
  1106. StructSize: LongWord; // Size of the data structure
  1107. State: LongWord; // State of the stack frame
  1108. MemoryAddress: APTR; // Memory address being pointed to
  1109. StackPointer: PLongWord; // The stack pointer itself
  1110. end;
  1111. const
  1112. //enStackFrameMsgState
  1113. STACK_FRAME_DECODED = 1; // Decoded stack frame
  1114. STACK_FRAME_INVALID_BACKCHAIN_PTR = 2; // Invalid backchain pointer
  1115. STACK_FRAME_TRASHED_MEMORY_LOOP = 3; // Memory loop caused by trashed memory
  1116. STACK_FRAME_BACKCHAIN_PTR_LOOP = 4; // Backchain pointer loops
  1117. // Each DebugSymbol corresponds to some memory address.
  1118. type
  1119. TDebugSymbol = record
  1120. StructSize: LongWord; // Size of the data structure
  1121. Type_: LongWord; // Type of debug symbol
  1122. Name: STRPTR; // Module name (may be NULL)
  1123. Offset: LongWord; // Offset into the module
  1124. SegmentNumber: LongWord; // DOS segment number
  1125. SegmentOffset: LongWord; // DOS segment offset
  1126. SourceFileName: STRPTR; // Source code file name (may be NULL)
  1127. SourceLineNumber: LongWord; // Source code line number (may be zero)
  1128. SourceFunctionName: STRPTR; // Source code function name (may be NULL)
  1129. SourceBaseName: STRPTR; // Source code base name (may be NULL)
  1130. end;
  1131. const
  1132. // enDebugSymbolType
  1133. DEBUG_SYMBOL_68K_MODULE = 1; // 68K kernel module
  1134. DEBUG_SYMBOL_NATIVE_MODULE = 2; // Kernel data module
  1135. DEBUG_SYMBOL_KERNEL_MODULE = 3; // Kernel module
  1136. DEBUG_SYMBOL_MODULE = 4; // Module
  1137. DEBUG_SYMBOL_MODULE_STABS = 5; // Module with stabs debug
  1138. type
  1139. // Opaque datatype for the result of StartDebugOutputNotify.
  1140. TDebugOutputNotify = record
  1141. end;
  1142. // he task that should be signaled with the given
  1143. // signal mask when the debug output buffer was updated.
  1144. const
  1145. SDONA_Task = TAG_USER + $1021000; // PTask
  1146. // The signal mask that shall be used
  1147. SDONA_SignalMask = TAG_USER + $1021001; // LongWord
  1148. type
  1149. //**********************************************************************
  1150. // The following structure can be used to switch from 68k into PPC code,
  1151. // in general its use is discouraging but necessary in a few places.
  1152. TEmuTrapfunction = procedure(Reg68K: PLongWord);
  1153. TEmuTrap = record
  1154. Instruction: LongWord; // TRAPINST, see below
  1155. Type_: Byte; // TRAPTYPE or TRAPTYPENR
  1156. Function_: TEmutrapFunction; // PPC function address also see "enRegConst" below but watch out byteoffsets!
  1157. end;
  1158. const
  1159. TRAPINST = $4ef80000; // jmp.w 0, indicate switch
  1160. TRAPTYPE = $0004; // type of this trap (result in r3/d0)
  1161. TRAPTYPENR = $0005; // same as above but no return value
  1162. //**********************************************************************
  1163. // enRegConst
  1164. REG68K_D0 = 0;
  1165. REG68K_D1 = 4;
  1166. REG68K_D2 = 8;
  1167. REG68K_D3 = 12;
  1168. REG68K_D4 = 16;
  1169. REG68K_D5 = 20;
  1170. REG68K_D6 = 24;
  1171. REG68K_D7 = 28;
  1172. REG68K_A0 = 32;
  1173. REG68K_A1 = 36;
  1174. REG68K_A2 = 40;
  1175. REG68K_A3 = 44;
  1176. REG68K_A4 = 48;
  1177. REG68K_A5 = 52;
  1178. REG68K_A6 = 56;
  1179. REG68K_A7 = 60;
  1180. REG68K_FP0 = 64;
  1181. REG68K_FP1 = 72;
  1182. REG68K_FP2 = 80;
  1183. REG68K_FP3 = 88;
  1184. REG68K_FP4 = 96;
  1185. REG68K_FP5 = 104;
  1186. REG68K_FP6 = 112;
  1187. REG68K_FP7 = 120;
  1188. //**********************************************************************
  1189. // Tag Items for Emulate() system call
  1190. ET_RegisterD0 = TAG_USER + 1;
  1191. ET_RegisterD1 = TAG_USER + 2;
  1192. ET_RegisterD2 = TAG_USER + 3;
  1193. ET_RegisterD3 = TAG_USER + 4;
  1194. ET_RegisterD4 = TAG_USER + 5;
  1195. ET_RegisterD5 = TAG_USER + 6;
  1196. ET_RegisterD6 = TAG_USER + 7;
  1197. ET_RegisterD7 = TAG_USER + 8;
  1198. ET_RegisterA0 = TAG_USER + 9;
  1199. ET_RegisterA1 = TAG_USER + 10;
  1200. ET_RegisterA2 = TAG_USER + 11;
  1201. ET_RegisterA3 = TAG_USER + 12;
  1202. ET_RegisterA4 = TAG_USER + 13;
  1203. ET_RegisterA5 = TAG_USER + 14;
  1204. ET_RegisterA6 = TAG_USER + 15;
  1205. ET_RegisterA7 = TAG_USER + 16;
  1206. ET_NoJIT = TAG_USER + 17;
  1207. ET_FPRegisters = TAG_USER + 18;
  1208. ET_FPRegisterMask = TAG_USER + 19;
  1209. ET_SuperState = TAG_USER + 20;
  1210. ET_Offset = TAG_USER + 21;
  1211. ET_StackPtr = TAG_USER + 22;
  1212. ET_SaveRegs = TAG_USER + 23;
  1213. ET_SaveParamRegs = TAG_USER + 24;
  1214. //**********************************************************************
  1215. // enEmulateFPFlags
  1216. EFPF_FP0 = 1;
  1217. EFPF_FP1 = 1 shl 1;
  1218. EFPF_FP2 = 1 shl 2;
  1219. EFPF_FP3 = 1 shl 3;
  1220. EFPF_FP4 = 1 shl 4;
  1221. EFPF_FP5 = 1 shl 5;
  1222. EFPF_FP6 = 1 shl 6;
  1223. EFPF_FP7 = 1 shl 7;
  1224. //**********************************************************************
  1225. // enDeviceIOErrors
  1226. IOERR_SUCCESS = 0; // no error
  1227. IOERR_OPENFAIL = -1; // device/unit failed to open
  1228. IOERR_ABORTED = -2; // request terminated early [after AbortIO()]
  1229. IOERR_NOCMD = -3; // command not supported by device
  1230. IOERR_BADLENGTH = -4; // not a valid length (usually IO_LENGTH)
  1231. IOERR_BADADDRESS = -5; // invalid address (misaligned or bad range)
  1232. IOERR_UNITBUSY = -6; // device opens ok, but requested unit is busy
  1233. IOERR_SELFTEST = -7; // hardware failed self-test
  1234. //**********************************************************************
  1235. //Tag items used by AllocSysObject
  1236. ASO_NoTrack = TAG_USER + 1; // Don't track this object (i.e. do not free automatically;
  1237. ASO_MemoryOvr = TAG_USER + 2; // Memory type override
  1238. // IORequest
  1239. ASOIOR_Size = TAG_USER + 10; // Size of the object
  1240. ASOIOR_ReplyPort = TAG_USER + 11; // ReplyPort to use
  1241. ASOIOR_Duplicate = TAG_USER + 12; // Source IO request to duplicate
  1242. // Hook
  1243. ASOHOOK_Size = TAG_USER + 10; // Size of the object
  1244. ASOHOOK_Entry = TAG_USER + 11; // The hook's entry
  1245. ASOHOOK_Subentry = TAG_USER + 12; // The hook's subentry field
  1246. ASOHOOK_Data = TAG_USER + 13; // The hook's user data
  1247. // Interrupt
  1248. ASOINTR_Size = TAG_USER + 10; // Size of the object
  1249. ASOINTR_Code = TAG_USER + 11; // Code pointer
  1250. ASOINTR_Data = TAG_USER + 12; // Data pointer
  1251. ASOINTR_SoftInt = TAG_USER + 13; // Interrupt is used by Cause(;
  1252. // List
  1253. ASOLIST_Size = TAG_USER + 10; // Size of the object
  1254. ASOLIST_Type = TAG_USER + 11; // Type to set for the list
  1255. ASOLIST_Min = TAG_USER + 12; // Create a minlist
  1256. // DMAEntry array
  1257. ASODMAE_Size = TAG_USER + 10; // Raw size of the object
  1258. ASODMAE_NumEntries = TAG_USER + 11; // Number of entries
  1259. // List node
  1260. ASONODE_Size = TAG_USER + 10; // Size of the node
  1261. ASONODE_Min = TAG_USER + 11; // Make it a MinNode
  1262. ASONODE_Type = TAG_USER + 12; // Node's type
  1263. ASONODE_Pri = TAG_USER + 13; // Node's priority
  1264. ASONODE_Name = TAG_USER + 14; // Pointer to a node string
  1265. // Message port
  1266. ASOPORT_Size = TAG_USER + 10; // Size of the object
  1267. ASOPORT_AllocSig = TAG_USER + 11; // Allocate a signal
  1268. ASOPORT_Action = TAG_USER + 12; // Action at message arrival (see ports.h, enMsgPortActions;
  1269. ASOPORT_Pri = TAG_USER + 13; // Priority used when the port is added to a list
  1270. ASOPORT_Name = TAG_USER + 14; // Name for the port
  1271. ASOPORT_Signal = TAG_USER + 15; // Preallocted signal number
  1272. ASOPORT_Target = TAG_USER + 16; // MsgPort's target, either a task, or a softint
  1273. ASOPORT_Public = TAG_USER + 17; // Make the port public
  1274. ASOPORT_CopyName = TAG_USER + 18; // Copy the name string
  1275. // Message
  1276. ASOMSG_Size = TAG_USER + 10; // Size of the object
  1277. ASOMSG_ReplyPort = TAG_USER + 11; // Reply port
  1278. ASOMSG_Length = TAG_USER + 12; // Message length
  1279. ASOMSG_Name = TAG_USER + 13; // Name to put into the node
  1280. // Signal semaphore
  1281. ASOSEM_Size = TAG_USER + 10; // Size of the object
  1282. ASOSEM_Name = TAG_USER + 11; // Name
  1283. ASOSEM_Pri = TAG_USER + 12; // Node's priority (only used on public semaphores;
  1284. ASOSEM_Public = TAG_USER + 13; // Semaphore is public and will be added to the system
  1285. ASOSEM_CopyName = TAG_USER + 14; // Copy the name string
  1286. // TagItem array
  1287. ASOTAGS_Size = TAG_USER + 10; // Raw size of the object, i.e. in bytes
  1288. ASOTAGS_NumEntries = TAG_USER + 11; // Number of tagitems
  1289. // Memory Pool
  1290. ASOPOOL_MFlags = TAG_USER + 10; // Memory flags/requirements for this pool
  1291. ASOPOOL_Puddle = TAG_USER + 11; // Size of each puddle
  1292. ASOPOOL_Threshold = TAG_USER + 12; // Largest alloction size that goes into the puddle
  1293. ASOPOOL_Protected = TAG_USER + 13; // Protect pool with a semaphore
  1294. ASOPOOL_Name = TAG_USER + 14; // Name for the pool (for informational purpose only;
  1295. ASOPOOL_CopyName = TAG_USER + 15; // Copy the name string
  1296. ASOPOOL_LockMem = TAG_USER + 16; // Lock memory allocated
  1297. // Item Pool
  1298. ASOITEM_MFlags = TAG_USER + 10; // Memory flags for the pool
  1299. ASOITEM_ItemSize = TAG_USER + 11; // Size of individual items
  1300. ASOITEM_BatchSize = TAG_USER + 12; // Amount of items to be allocated in one batch
  1301. ASOITEM_MaxSize = TAG_USER + 13; // Maximum amount of items allowed in pool
  1302. ASOITEM_GCPolicy = TAG_USER + 14; // Garbage collection policy
  1303. ASOITEM_GCParameter = TAG_USER + 15; // Garbage collection parameter
  1304. ASOITEM_Constructor = TAG_USER + 16; // Constructor hook
  1305. ASOITEM_Destructor = TAG_USER + 17; // Destructor hook
  1306. ASOITEM_Protected = TAG_USER + 18; // Protect pool with a semaphore
  1307. // Mutex
  1308. ASOMUTEX_Recursive = TAG_USER + 10; // Make mutex recursive
  1309. // ExtMem
  1310. ASOEXTMEM_Size = TAG_USER + 10; // Size of extended memory area
  1311. ASOEXTMEM_AllocationPolicy = TAG_USER + 11; // Allocation policy
  1312. // Item pool GCPolicy types
  1313. // enItemPoolGCPolicy
  1314. ITEMGC_NONE = 0;
  1315. ITEMGC_AFTERCOUNT = 1;
  1316. // Ext Memory allocation policies
  1317. // enExtMemAllocationPolicy
  1318. EXTMEMPOLICY_IMMEDIATE = 0;
  1319. EXTMEMPOLICY_DELAYED = 1;
  1320. EXTMEMPOLICY_ACCESS = 2;
  1321. // Kernel memory cache
  1322. ASOKMEM_Name = TAG_USER + 10; // Name of the cache
  1323. ASOKMEM_Type = TAG_USER + 11; // Type, private or shared
  1324. ASOKMEM_Size = TAG_USER + 12; // Object size
  1325. ASOKMEM_Alignment = TAG_USER + 13; // Object Alignment
  1326. ASOKMEM_Constructor = TAG_USER + 14; // Constructor
  1327. ASOKMEM_Destructor = TAG_USER + 15; // Destructor
  1328. ASOKMEM_Colored = TAG_USER + 16; // Use cache slab coloring
  1329. ASOKMEM_Compact = TAG_USER + 17; // Force cache to be compact, even if this means the slab internal
  1330. // fragmentation will be above the threshold
  1331. // Kernel memory cache type
  1332. // enKMemCacheType
  1333. KMEMT_PRIVATE = 0;
  1334. KMEMT_SHARED = 1;
  1335. // Resource map
  1336. ASORMAP_Base = TAG_USER + 10; // Resource range base
  1337. ASORMAP_Size = TAG_USER + 11; // Resource range size
  1338. ASORMAP_Quantum = TAG_USER + 12; // Minimal quantum for one single allocation
  1339. ASORMAP_CacheMax = TAG_USER + 13; // Maximum size for quantum caches. All allocations smaller or equal
  1340. // to this size will come from quantum caches
  1341. // Tags for AllocVecTagList (V51)
  1342. AVT_Type = TAG_USER + 1;
  1343. AVT_Contiguous = TAG_USER + 2;
  1344. AVT_Lock = TAG_USER + 3;
  1345. AVT_Alignment = TAG_USER + 4;
  1346. AVT_PhysicalAlignment = TAG_USER + 5;
  1347. AVT_Clear = TAG_USER + 6;
  1348. AVT_ClearWithValue = TAG_USER + 6;
  1349. AVT_ClearValue = TAG_USER + 6;
  1350. AVT_Wait = TAG_USER + 7;
  1351. AVT_NoExpunge = TAG_USER + 8;
  1352. // Tags for AllocNamedMemory (V51)
  1353. ANMT_CheckSum = TAG_USER + 1;
  1354. ANMT_Error = TAG_USER + 2;
  1355. // Possible values for ANMT_Error
  1356. // enAllocNamedMemoryErrors
  1357. ANMERROR_NOERROR = 0;
  1358. ANMERROR_NOMEMORY = 1;
  1359. ANMERROR_DUPLICATENAME = 2;
  1360. ANMERROR_PARAMETER = 3;
  1361. // Tags for GetCPUInfo
  1362. GCIT_NumberOfCPUs = TAG_USER + 1;
  1363. GCIT_Family = TAG_USER + 2;
  1364. GCIT_Model = TAG_USER + 3;
  1365. GCIT_ModelString = TAG_USER + 4;
  1366. GCIT_Version = TAG_USER + 5;
  1367. GCIT_VersionString = TAG_USER + 6;
  1368. GCIT_FrontsideSpeed = TAG_USER + 7;
  1369. GCIT_ProcessorSpeed = TAG_USER + 8;
  1370. GCIT_L1CacheSize = TAG_USER + 9;
  1371. GCIT_L2CacheSize = TAG_USER + 10;
  1372. GCIT_L3CacheSize = TAG_USER + 11;
  1373. GCIT_VectorUnit = TAG_USER + 12;
  1374. GCIT_Extensions = TAG_USER + 13;
  1375. GCIT_CacheLineSize = TAG_USER + 14;
  1376. GCIT_CPUPageSize = TAG_USER + 15;
  1377. GCIT_ExecPageSize = TAG_USER + 16;
  1378. GCIT_TimeBaseSpeed = TAG_USER + 17;
  1379. // Family codes
  1380. //enCPUFamiliy
  1381. CPUFAMILY_UNKNOWN = 0;
  1382. CPUFAMILY_60X = 1;
  1383. CPUFAMILY_7X0 = 2;
  1384. CPUFAMILY_74XX = 3;
  1385. CPUFAMILY_4XX = 4;
  1386. CPUFAMILY_PA6T = 5;
  1387. CPUFAMILY_E300 = 6;
  1388. CPUFAMILY_E5500 = 7;
  1389. // Model codes
  1390. // enCPUModel
  1391. CPUTYPE_UNKNOWN = 0;
  1392. CPUTYPE_PPC603E = 1;
  1393. CPUTYPE_PPC604E = 2;
  1394. CPUTYPE_PPC750CXE = 3;
  1395. CPUTYPE_PPC750FX = 4;
  1396. CPUTYPE_PPC750GX = 5;
  1397. CPUTYPE_PPC7410 = 6;
  1398. CPUTYPE_PPC74XX_VGER = 7;
  1399. CPUTYPE_PPC74XX_APOLLO = 8;
  1400. CPUTYPE_PPC405LP = 9;
  1401. CPUTYPE_PPC405EP = 10;
  1402. CPUTYPE_PPC405GP = 11;
  1403. CPUTYPE_PPC405GPR = 12;
  1404. CPUTYPE_PPC440EP = 13;
  1405. CPUTYPE_PPC440GP = 14;
  1406. CPUTYPE_PPC440GX = 15;
  1407. CPUTYPE_PPC440SX = 16;
  1408. CPUTYPE_PPC440SP = 17;
  1409. CPUTYPE_PA6T_1682M = 18;
  1410. CPUTYPE_PPC460EX = 19;
  1411. CPUTYPE_PPC5121E = 20;
  1412. CPUTYPE_P50XX = 21;
  1413. // Vector unit types
  1414. // enVectorUnitType
  1415. VECTORTYPE_NONE = 0;
  1416. VECTORTYPE_ALTIVEC = 1;
  1417. // Same as AltiVec VECTORTYPE_VMX = 2
  1418. //**********************************************************************
  1419. // Object types for AllocSysObject
  1420. // enAllocSysObjectTypes
  1421. ASOT_IOREQUEST = 0; // IORequest
  1422. ASOT_HOOK = 1; // Hook
  1423. ASOT_INTERRUPT = 2; // Interrupt structure
  1424. ASOT_LIST = 3; // List and MinList
  1425. ASOT_DMAENTRY = 4; // DMAEntry array
  1426. ASOT_NODE = 5; // List node and MinNode
  1427. ASOT_PORT = 6; // Message port
  1428. ASOT_MESSAGE = 7; // Exec Message
  1429. ASOT_SEMAPHORE = 8; // Signal Semaphore
  1430. ASOT_TAGLIST = 9; // TagItem list
  1431. ASOT_MEMPOOL = 10; // Memory pool
  1432. ASOT_ITEMPOOL = 11; // Item pool
  1433. ASOT_RMAP = 12; // Resource map
  1434. ASOT_MUTEX = 13; // Mutex
  1435. ASOT_EXTMEM = 14; // Extended memory
  1436. //**********************************************************************
  1437. // Tag items for CreateLibrary
  1438. CLT_Vector68K = TAG_USER + 1;
  1439. CLT_InitData = TAG_USER + 2;
  1440. CLT_InitFunc = TAG_USER + 3;
  1441. CLT_Seglist = TAG_USER + 8;
  1442. CLT_Interfaces = TAG_USER + 9;
  1443. CLT_DataSize = TAG_USER + 10;
  1444. CLT_Legacy = TAG_USER + 11;
  1445. CLT_NoLegacyIFace = TAG_USER + 12;
  1446. //**********************************************************************
  1447. // Message types for debugger hook
  1448. // enDebugMessage
  1449. DBHMT_EXCEPTION = 1;
  1450. DBHMT_REMTASK = 2;
  1451. DBHMT_OPENLIB = 3;
  1452. DBHMT_CLOSELIB = 4;
  1453. DBHMT_ADDTASK = 5;
  1454. DBHMT_SHAREDOBJECTOPEN = 6;
  1455. DBHMT_SHAREDOBJECTCLOSE = 7;
  1456. //**********************************************************************
  1457. // Tags for AddTask/CreateTask
  1458. AT_Param1 = TAG_USER + 1;
  1459. AT_Param2 = TAG_USER + 2;
  1460. AT_Param3 = TAG_USER + 3;
  1461. AT_Param4 = TAG_USER + 4;
  1462. AT_Param5 = TAG_USER + 5;
  1463. AT_Param6 = TAG_USER + 6;
  1464. AT_Param7 = TAG_USER + 7;
  1465. AT_Param8 = TAG_USER + 8;
  1466. AT_Child = TAG_USER + 9;
  1467. CT_LockStack = TAG_USER + 20;
  1468. //**********************************************************************
  1469. // Tags for NewStackRun
  1470. NSR_Dummy = TAG_USER + 500; // Offset to avoid Emulate(; tag collision.
  1471. NSR_StackSize = NSR_Dummy + 1; // Initial stack size
  1472. NSR_MinStackSize = NSR_Dummy + 2; // Absolute minimal stack size
  1473. NSR_LockStack = NSR_Dummy + 3; // Lock the stack in memory to prevent paging
  1474. NSR_Arg1 = NSR_Dummy + 10; // Parameters passed to the function
  1475. NSR_Arg2 = NSR_Dummy + 11;
  1476. NSR_Arg3 = NSR_Dummy + 12;
  1477. NSR_Arg4 = NSR_Dummy + 13;
  1478. NSR_Arg5 = NSR_Dummy + 14;
  1479. NSR_Arg6 = NSR_Dummy + 15;
  1480. //**********************************************************************
  1481. var
  1482. ExecBase: PExecBase absolute AOS_ExecBase;
  1483. function ExecObtain(): LongWord; syscall IExec 60;
  1484. function ExecRelease(): LongWord; syscall IExec 64;
  1485. procedure ExecExpunge(); syscall IExec 68;
  1486. function ExecClone(): PInterface; syscall IExec 72;
  1487. procedure AddHead(List: PList; Node: PNode); syscall IExec 76;
  1488. procedure AddMemHandler(MemHand: PInterrupt); syscall IExec 80;
  1489. procedure AddMemList(Size: LongWord; Attributes: LongWord; Pri: LongInt; Base: APTR; const Name: PAnsiChar); syscall IExec 84;
  1490. procedure AddTail(List: PList; Node: PNode); syscall IExec 88;
  1491. function AllocAbs(ByteSize: LongWord; Location: APTR): APTR; syscall IExec 92;
  1492. function Allocate(FreeList: PMemHeader; ByteSize: LongWord): APTR; syscall IExec 96;
  1493. function AllocEntry(Entry: PMemList): PMemList; syscall IExec 100;
  1494. function ExecAllocMem(ByteSize: LongWord; Requirements: LongWord): APTR; syscall IExec 104;
  1495. function AllocPooled(PoolHeader: APTR; MemSize: LongWord): APTR; syscall IExec 108;
  1496. function AllocVec(ByteSize: LongWord; Requirements: LongWord): APTR; syscall IExec 112;
  1497. function AllocVecPooled(PoolHeader: APTR; Size: LongWord): APTR; syscall IExec 116;
  1498. function AvailMem(Requirements: LongWord): LongWord; syscall IExec 120;
  1499. procedure CopyMem(const Source: APTR; Dest: APTR; Size: LongWord); syscall IExec 124;
  1500. procedure CopyMemQuick(const Source: APTR; Dest: APTR; Size: LongWord); syscall IExec 128;
  1501. function CreatePool(MemFlags: LongWord; PuddleSize: LongWord; ThreshSize: LongWord): APTR; syscall IExec 132;
  1502. procedure Deallocate(MemHeader: PMemHeader; MemoryBlock: APTR; ByteSize: LongWord); syscall IExec 136;
  1503. procedure DeletePool(PoolHeader: APTR); syscall IExec 140;
  1504. procedure Enqueue(List: PList; Node: PNode); syscall IExec 144;
  1505. function FindName(Start: PList; const Name: PAnsiChar): PNode; syscall IExec 148;
  1506. function FindIName(Start: PList; const Name: PAnsiChar): PNode; syscall IExec 152;
  1507. procedure Forbid(); syscall IExec 156;
  1508. procedure FreeEntry(MemList: PMemList); syscall IExec 160;
  1509. procedure ExecFreeMem(MemoryBlock: APTR; ByteSize: LongWord); syscall IExec 164;
  1510. procedure FreePooled(PoolHeader: APTR; Memory: APTR; MemSize: LongWord); syscall IExec 168;
  1511. procedure FreeVec(MemoryBlock: APTR); syscall IExec 172;
  1512. procedure FreeVecPooled(PoolHeader: APTR; MemoryBlock: APTR); syscall IExec 176;
  1513. procedure InitData(const InitTab: APTR; Memory: APTR; Size: LongWord); syscall IExec 180;
  1514. procedure InitStruct(const InitTab: APTR; Memory: APTR; Size: LongWord); syscall IExec 184;
  1515. procedure ExecInsert(List: PList; Node: PNode; ListNode: PNode); syscall IExec 188;
  1516. function MakeInterface(Lib: PLibrary; const TagList: PTagItem): PInterface; syscall IExec 192;
  1517. // 196 MakeInterfaceTags varargs version of MakeInterface
  1518. procedure Permit(); syscall IExec 200;
  1519. function RawDoFmt(const FormatString: STRPTR; const DataStream: APTR; putChProc: TProcedure; PutChData: APTR): APTR; syscall IExec 204;
  1520. function RemHead(List: PList): PNode; syscall IExec 208;
  1521. procedure RemMemHandler(MemHandler: PInterrupt); syscall IExec 212;
  1522. procedure Remove(Node: PNode); syscall IExec 216;
  1523. function RemTail(List: PList): PNode; syscall IExec 220;
  1524. function TypeOfMem(const address: APTR): LongWord; syscall IExec 224;
  1525. function InitResident(const Resident_: PResident; SegList: LongWord): APTR; syscall IExec 228;
  1526. procedure InitCode(StartClass: LongWord; Version: LongWord); syscall IExec 232;
  1527. function SumKickData(): LongWord; syscall IExec 236;
  1528. function AddTask(Task: PTask; const InitPC: APTR; const FinalPC: APTR): APTR; syscall IExec 240;
  1529. // 244 AddTaskTags varargs version of AddTask
  1530. procedure Disable(); syscall IExec 248;
  1531. procedure Enable(); syscall IExec 252;
  1532. procedure Reschedule(); syscall IExec 256;
  1533. function FindTask(const Name: STRPTR): PTask; syscall IExec 260;
  1534. procedure RemTask(Task: PTask); syscall IExec 264;
  1535. function SetTaskPri(Task: PTask; Priority: LongInt): LongInt; syscall IExec 268;
  1536. procedure StackSwap(NewStack: PStackSwapStruct); syscall IExec 272;
  1537. function AllocSignal(SignalNum: LongInt): ShortInt; syscall IExec 276;
  1538. procedure FreeSignal(SignalNum: LongInt); syscall IExec 280;
  1539. function SetExcept(NewSignals: LongWord; SignalMask: LongWord): LongWord; syscall IExec 284;
  1540. function SetSignal(NewSignals: LongWord; SignalMask: LongWord): LongWord; syscall IExec 288;
  1541. procedure Signal(Task: PTask; Signals: LongWord); syscall IExec 292;
  1542. function Wait(SignalSet: LongWord): LongWord; syscall IExec 296;
  1543. procedure AddPort(Port: PMsgPort); syscall IExec 300;
  1544. function CreatePort(const Name: STRPTR; Pri: LongInt): PMsgPort; syscall IExec 304;
  1545. function CreateMsgPort(): PMsgPort; syscall IExec 308;
  1546. procedure DeletePort(Port: PMsgPort); syscall IExec 312;
  1547. procedure DeleteMsgPort(Port: PMsgPort); syscall IExec 316;
  1548. function FindPort(const Name: STRPTR): PMsgPort; syscall IExec 320;
  1549. function GetMsg(Port: PMsgPort): PMessage; syscall IExec 324;
  1550. procedure PutMsg(Port: PMsgPort; Message: PMessage); syscall IExec 328;
  1551. procedure RemPort(Port: PMsgPort); syscall IExec 332;
  1552. procedure ReplyMsg(Message: PMessage); syscall IExec 336;
  1553. function WaitPort(Port: PMsgPort): PMessage; syscall IExec 340;
  1554. procedure Cause(Interrupt_: PInterrupt); syscall IExec 344;
  1555. procedure AddSemaphore(SigSem: PSignalSemaphore); syscall IExec 348;
  1556. function AttemptSemaphore(SigSem: PSignalSemaphore): LongBool; syscall IExec 352;
  1557. function AttemptSemaphoreShared(SigSem: PSignalSemaphore): LongBool; syscall IExec 356;
  1558. function FindSemaphore(const Name: STRPTR): PSignalSemaphore; syscall IExec 360;
  1559. procedure InitSemaphore(SigSem: PSignalSemaphore); syscall IExec 364;
  1560. procedure ObtainSemaphore(SigSem: PSignalSemaphore); syscall IExec 368;
  1561. procedure ObtainSemaphoreList(SigSem: PList); syscall IExec 372;
  1562. procedure ObtainSemaphoreShared(SigSem: PSignalSemaphore); syscall IExec 376;
  1563. function Procure(SigSem: PSignalSemaphore; BidMessage: PSemaphoreMessage): LongBool; syscall IExec 380;
  1564. procedure ReleaseSemaphore(SigSem: PSignalSemaphore); syscall IExec 384;
  1565. procedure ReleaseSemaphoreList(SigSem: PList); syscall IExec 388;
  1566. procedure RemSemaphore(SigSem: PSignalSemaphore); syscall IExec 392;
  1567. procedure Vacate(SigSem: PSignalSemaphore; BidMessage: PSemaphoreMessage); syscall IExec 396;
  1568. function CreateTask(const Name: STRPTR; Pri: LongInt; const InitPC: APTR; StackSize: LongWord; const TagList: PTagItem): PTask; syscall IExec 400;
  1569. // 404 CreateTaskTags varargs version of CreateTask
  1570. procedure DeleteTask(Task: PTask); syscall IExec 408;
  1571. procedure SumLibrary(Lib: PLibrary); syscall IExec 412;
  1572. function CreateLibrary(const TagList: PTagItem): PLibrary; syscall IExec 416;
  1573. // 420 CreateLibraryTags varargs version of CreateLibrary
  1574. function OpenLibrary(const Name: STRPTR; Version: LongWord): PLibrary; syscall IExec 424;
  1575. function CloseLibrary(Lib: PLibrary): APTR; syscall IExec 428;
  1576. procedure AddLibrary(Lib: PLibrary); syscall IExec 432;
  1577. function RemLibrary(Lib: PLibrary): LongWord; syscall IExec 436;
  1578. procedure AddDevice(Device: PDevice); syscall IExec 440;
  1579. function RemDevice(Device: PDevice): LongWord; syscall IExec 444;
  1580. function GetInterface(Lib: PLibrary; const Name: STRPTR; Version: LongWord; const TagList: PTagItem): PInterface; syscall IExec 448;
  1581. // 452 GetInterfaceTags varargs version of GetInterface
  1582. procedure DropInterface(Interface_: PInterface); syscall IExec 456;
  1583. procedure AddInterface(Lib: PLibrary; Interface_: PInterface); syscall IExec 460;
  1584. procedure RemInterface(Interface_: PInterface); syscall IExec 464;
  1585. procedure SumInterface(Interface_: PInterface); syscall IExec 468;
  1586. function FindResident(const Name: STRPTR): PResident; syscall IExec 472;
  1587. function SetMethod(Interface_: PInterface; FuncOffset: LongInt; const NewFunc: APTR): APTR; syscall IExec 476;
  1588. procedure DeleteInterface(Interface_: PInterface); syscall IExec 480;
  1589. procedure DeleteLibrary(Lib: PLibrary); syscall IExec 484;
  1590. function Setfunction(Lib: PLibrary; FuncOffset: LongInt; const Newfunction: APTR): APTR; syscall IExec 488;
  1591. procedure CacheClearE(Address: APTR; Length: LongWord; Caches: LongWord); syscall IExec 492;
  1592. procedure CacheClearU(); syscall IExec 496;
  1593. function Makefunctions(Target: APTR; const FunctionArray: APTR; const FuncDispBase: APTR): LongWord; syscall IExec 500;
  1594. function OpenDevice(const DevName: STRPTR; UnitNumber: LongWord; IORequest: PIORequest; Flags: LongWord): LongInt; syscall IExec 504;
  1595. procedure CloseDevice(IORequest: PIORequest); syscall IExec 508;
  1596. function CreateIORequest(const IOReplyPort: PMsgPort; Size: LongWord): PIORequest; syscall IExec 512;
  1597. procedure DeleteIORequest(IORequest: PIORequest); syscall IExec 516;
  1598. procedure AbortIO(IORequest: PIORequest); syscall IExec 520;
  1599. function CheckIO(IORequest: PIORequest): PIORequest; syscall IExec 524;
  1600. function DoIO(IORequest: PIORequest): LongInt; syscall IExec 528;
  1601. procedure SendIO(IORequest: PIORequest); syscall IExec 532;
  1602. procedure BeginIO(IORequest: PIORequest); syscall IExec 536;
  1603. procedure WaitIO(IORequest: PIORequest); syscall IExec 540;
  1604. procedure AddResource(Resource: APTR); syscall IExec 544;
  1605. procedure RemResource(Resource: APTR); syscall IExec 548;
  1606. function OpenResource(const ResName: STRPTR): APTR; syscall IExec 552;
  1607. procedure AddIntServer(IntNumber: LongWord; Interrupt_: PInterrupt); syscall IExec 556;
  1608. procedure RemIntServer(IntNumber: LongWord; Interrupt_: PInterrupt); syscall IExec 560;
  1609. function SetIntVector(IntNumber: LongWord;const Interrupt_: PInterrupt): PInterrupt; syscall IExec 564;
  1610. function ObtainQuickVector(InterruptCode: APTR): LongWord; syscall IExec 568;
  1611. procedure Alert(AlertNum: LongWord); syscall IExec 572;
  1612. function SuperState(): APTR; syscall IExec 576;
  1613. procedure UserState(SysStack: APTR); syscall IExec 580;
  1614. function Supervisor(UserFunc: APTR): LongWord; syscall IExec 584;
  1615. function SetTaskTrap(TrapNum: LongWord; const TrapCode: APTR; const TrapData: APTR): LongBool; syscall IExec 588;
  1616. function AllocTrap(TrapNum: LongWord): LongInt; syscall IExec 592;
  1617. procedure FreeTrap(TrapNum: LongWord); syscall IExec 596;
  1618. function GetCC: LongWord; syscall IExec 600;
  1619. function SetSR(NewSR: LongWord; Mask: LongWord): LongWord; syscall IExec 604;
  1620. function AVL_AddNode(Root: PPAVLNode; Node: PAVLNode; Func: Pointer): PAVLNode; syscall IExec 608;
  1621. function AVL_FindFirstNode(const Root: PAVLNode): PAVLNode; syscall IExec 612;
  1622. function AVL_FindLastNode(const Root: PAVLNode): PAVLNode; syscall IExec 616;
  1623. function AVL_FindNextNodeByAddress(const Node: PAVLNode): PAVLNode; syscall IExec 620;
  1624. function AVL_FindNextNodeByKey(const Root: PAVLNode; Key: APTR; Func: APTR): PAVLNode; syscall IExec 624;
  1625. function AVL_FindNode(const Root: PAVLNode; Key: APTR; Func: APTR): PAVLNode; syscall IExec 628;
  1626. function AVL_FindPrevNodeByAddress(const Root: PAVLNode): PAVLNode; syscall IExec 632;
  1627. function AVL_FindPrevNodeByKey(const Root: PAVLNode; Key: APTR; Func: APTR): PAVLNode; syscall IExec 636;
  1628. function AVL_RemNodeByAddress(Root: PPAVLNode; Node: PAVLNode): PAVLNode; syscall IExec 640;
  1629. function AVL_RemNodeByKey(Root: PPAVLNode; Key: APTR; Func: APTR): PAVLNode; syscall IExec 644;
  1630. function CacheControl(CacheBits: LongWord; CacheMask: LongWord): LongWord; syscall IExec 648;
  1631. function LockMem(BaseAddress: APTR; Size: LongWord): LongBool; syscall IExec 652;
  1632. procedure UnLockMem(BaseAddress: APTR; Size: LongWord); syscall IExec 656;
  1633. function ReallocVec(MemBlock: APTR; NewSize: LongWord; Flags: LongWord): LongWord; syscall IExec 660;
  1634. function CachePreDMA(const VAddr: APTR; var Length: LongWord; Flags: LongWord): APTR; syscall IExec 664;
  1635. procedure CachePostDMA(const VAddr: APTR; var Length: LongWord; Flags: LongWord); syscall IExec 668;
  1636. function StartDMA(const StartAddr: APTR; BlockSize: LongWord; Flags: LongWord): LongWord; syscall IExec 672;
  1637. function EndDMA(const StartAddr: APTR; BlockSize: LongWord; Flags: LongWord): LongWord; syscall IExec 676;
  1638. procedure GetDMAList(const StartAddr: APTR; BlockSize: LongWord; Flags: LongWord; DMAList: Pointer); syscall IExec 680;
  1639. function AddTrackable(UsingTask: PTask; Obj: APTR; DestFunc: PHook): PTrackable; syscall IExec 684;
  1640. function FindTrackable(UsingTask: PTask; Obj: APTR): PTrackable; syscall IExec 688;
  1641. function RemTrackable(UsingTask: PTask; Obj: APTR; Trackable: PTrackable): PTrackable; syscall IExec 692;
  1642. procedure DeleteTrackable(Trackable: PTrackable); syscall IExec 696;
  1643. function AllocSysObject(Type_: LongWord; const Tags: PTagItem): APTR; syscall IExec 700;
  1644. // 704 AllocSysObjectTags
  1645. procedure FreeSysObject(Type_: LongWord; Obj: APTR); syscall IExec 708;
  1646. procedure SuspendTask(WhichTask: PTask; Flags: LongWord); syscall IExec 712;
  1647. procedure RestartTask(WhichTask: PTask; Flags: LongWord); syscall IExec 716;
  1648. procedure MoveList(DestinationList: PList; SourceList: PList); syscall IExec 720;
  1649. procedure NewList(List: PList); syscall IExec 724;
  1650. procedure NewMinList(List: PMinList); syscall IExec 728;
  1651. procedure ColdReboot(); syscall IExec 732;
  1652. function MakeLibrary(const Vectors: APTR;const Structure: APTR; const Init: APTR; DataSize: LongWord; SegList: APTR): PLibrary; syscall IExec 736;
  1653. function Emulate(const InitPC: APTR; const TagList: PTagItem): LongWord; syscall IExec 740;
  1654. // 744 EmulateTags
  1655. // 748 DebugPrintF
  1656. function IsNative(const Code: APTR): LongBool; syscall IExec 752;
  1657. function RawMayGetChar(): LongInt;syscall IExec 756;
  1658. procedure RawPutChar(c: AnsiChar); syscall IExec 760;
  1659. procedure GetCPUInfo(const TagList: PTagItem); syscall IExec 764;
  1660. // 768 GetCPUInfoTags
  1661. function OwnerOfMem(const Address: APTR): PTask; syscall IExec 772;
  1662. function AddResetCallback(ResetCallBack: PInterrupt): LongBool; syscall IExec 776;
  1663. function RemResetCallback(ResetCallBack: PInterrupt): LongBool; syscall IExec 780;
  1664. function ItemPoolAlloc(ItemPool: APTR): APTR; syscall IExec 784;
  1665. procedure ItemPoolFree(ItemPool: APTR); syscall IExec 788;
  1666. procedure ItemPoolGC(ItemPool: APTR); syscall IExec 792;
  1667. function ItemPoolControl(ItemPool: APTR; const TagList: PTagItem): LongWord; syscall IExec 796;
  1668. // 800 ItemPoolControlTags
  1669. procedure ItemPoolFlush(ItemPool: APTR); syscall IExec 804;
  1670. function GetHead(List: PList): PNode; syscall IExec 808;
  1671. function GetTail(List: PList): PNode; syscall IExec 812;
  1672. function GetSucc(Node: PNode): PNode; syscall IExec 816;
  1673. function GetPred(Node: PNode): PNode; syscall IExec 820;
  1674. procedure IceColdReboot(); syscall IExec 824;
  1675. function KMemCacheCreate(VMA: APTR; const Name: STRPTR; Size: LongWord; Align: LongWord; const Constructor_: APTR; const Destructor_: APTR; Flag: LongWord; UserData: APTR): APTR; syscall IExec 828;
  1676. procedure KMemCacheDestroy(Cache: APTR); syscall IExec 832;
  1677. function KMemCacheAlloc(Cache: APTR; Flags: LongWord): APTR; syscall IExec 836;
  1678. procedure KMemCacheFree(Cache: APTR; Obj: APTR); syscall IExec 840;
  1679. procedure KMemCacheGrow(Cache: APTR; Flags: LongWord); syscall IExec 840;
  1680. function KMemCacheReap(Cache: APTR; NumPages: LongWord; Flags: LongWord): LongWord; syscall IExec 848;
  1681. function KMemCacheFind(const Name: STRPTR): APTR; syscall IExec 852;
  1682. function PageGet(VMA: APTR; NumPages: LongWord; Alignment: LongWord): APTR; syscall IExec 856;
  1683. function PageMap(PageList: APTR; NumPages: LongWord; Attrs: LongWord; Flags: LongWord): LongBool; syscall IExec 860;
  1684. procedure PageUnmap(PageList: APTR; NumPages: LongWord); syscall IExec 864;
  1685. procedure PageDrop(PageList: APTR; NumPages: LongWord); syscall IExec 868;
  1686. function PageFindByVA(AddressSpace: APTR; VirtualAddress: APTR): APTR; syscall IExec 872;
  1687. procedure PageHash(Page: APTR); syscall IExec 876;
  1688. procedure PageUnhash(Page: APTR); syscall IExec 880;
  1689. function PageBackendAlloc(Order: LongWord; Flags: LongWord): APTR; syscall IExec 884;
  1690. procedure PageBackendFree(Addr: APTR; Order: LongWord); syscall IExec 888;
  1691. procedure PageBackendLock(); syscall IExec 892;
  1692. procedure PageBackendUnlock(); syscall IExec 896;
  1693. // 900
  1694. // 904
  1695. // 908
  1696. function RMapAlloc(Map: APTR; Size: LongWord; Flags: LongWord): APTR; syscall IExec 912;
  1697. procedure RMapFree(Map: APTR; Addr: APTR; Size: LongWord); syscall IExec 916;
  1698. function VMAreaInit(AddrSpace: APTR; Shared: LongBool; Area: APTR; const Tags: PTagItem): LongBool; syscall IExec 920;
  1699. // 924 VMAreaInitTags
  1700. procedure VMAreaTerm(Area: APTR); syscall IExec 928;
  1701. function AllocVecTagList(Size: LongWord; const Tags: PTagItem): APTR; syscall IExec 932;
  1702. // 936 AllocVecTags
  1703. function PageMapAligned(PageList: Pointer; NumPages: LongWord; Alignment: LongWord; Attrs: LongWord; Flags: LongWord): LongBool; syscall IExec 940;
  1704. function RMapExtAlloc(Map: APTR; Size: LongWord; Alignment: LongWord; Flags: LongWord): APTR; syscall IExec 944;
  1705. procedure RMapExtFree(Map: APTR; Addr: APTR; Size: LongWord); syscall IExec 948;
  1706. procedure PageBackendAllocAligned(Order: LongWord; Alignment: LongWord; Flags: LongWord); syscall IExec 952;
  1707. function AllocNamedMemory(ByteSize: LongWord; const Space: STRPTR; const Name: STRPTR; TagList: PTagITem): APTR; syscall IExec 956;
  1708. // 960 AllocNamedMemoryTags
  1709. function FreeNamedMemory(const Space: STRPTR; const Name: STRPTR): LongBool; syscall IExec 964;
  1710. function FindNamedMemory(const Space: STRPTR; const Name: STRPTR): Pointer; syscall IExec 968;
  1711. procedure UpdateNamedMemory(const Space: STRPTR; const Name: STRPTR); syscall IExec 972;
  1712. function LockNamedMemory(const Space: STRPTR; const Name: STRPTR): Pointer; syscall IExec 976;
  1713. function AttemptNamedMemory(const Space: STRPTR; const Name: STRPTR): Pointer; syscall IExec 980;
  1714. procedure UnlockNamedMemory(const Space: STRPTR; const Name: STRPTR); syscall IExec 984;
  1715. function ScanNamedMemory(SCHook: PHook; Flags: LongWord; User: APTR): LongWord; syscall IExec 988;
  1716. function AllocTaskMemEntry(MemList: PMemList): PMemList; syscall IExec 992;
  1717. function PagerFindPageOut(NFlags: LongWord): APTR; syscall IExec 996;
  1718. function PagerPageIn(PPage: APTR; NFlags: LongWord): LongBool; syscall IExec 1000;
  1719. function PagerPageOut(PPage: APTR; NFlags: LongWord; PReceiver: APTR): LongBool; syscall IExec 1004;
  1720. function PagerAssignPager(PPage: APTR; NFlags: LongWord): LongBool; syscall IExec 1008;
  1721. procedure MutexObtain(Mutex: APTR); syscall IExec 1012;
  1722. function MutexAttempt(Mutex: APTR): LongBool; syscall IExec 1016;
  1723. procedure MutexRelease(Mutex: APTR); syscall IExec 1020;
  1724. function MutexAttemptWithSignal(Mutex: APTR; SigSet: LongWord): LongWord; syscall IExec 1024;
  1725. function NewStackRun(InitPC: APTR; const TagList: PTagItem): LongInt; syscall IExec 1028;
  1726. // 1032 NewStackRunTags
  1727. function BitMask(No: ShortInt): LongInt; inline;
  1728. function IsListEmpty(List: PList): Boolean; inline;
  1729. function IsMinListEmpty(List: PMinList): Boolean; inline;
  1730. function IsMsgPortEmpty(mp: PMsgPort): Boolean; inline;
  1731. procedure NewListType(var List: PList; NType: Byte); inline;
  1732. function CreateExtIO(const Mp: PMsgPort; Size: Integer): PIORequest;
  1733. procedure DeleteExtIO(ioReq: PIORequest);
  1734. implementation
  1735. function BitMask(No: ShortInt): LongInt; inline;
  1736. begin
  1737. BitMask := 1 shl No;
  1738. end;
  1739. function IsListEmpty(List: PList): Boolean; inline;
  1740. begin
  1741. IsListEmpty := List^.lh_TailPred = PNode(List);
  1742. end;
  1743. function IsMinListEmpty(List: PMinList): Boolean; inline;
  1744. begin
  1745. IsMinListEmpty := List^.mlh_TailPred = PMinNode(List);
  1746. end;
  1747. function IsMsgPortEmpty(Mp: PMsgPort): Boolean; inline;
  1748. begin
  1749. with Mp^ do
  1750. IsMsgPortEmpty := mp_MsgList.lh_TailPred = PNode(@mp_MsgList);
  1751. end;
  1752. procedure NewListType(var List: PList; NType: Byte); inline;
  1753. begin
  1754. NewList(List);
  1755. List^.lh_Type := NType;
  1756. end;
  1757. function CreateExtIO(const Mp: PMsgPort; Size: Integer): PIORequest;
  1758. begin
  1759. CreateExtIO := nil;
  1760. if not Assigned(mp) then
  1761. Exit;
  1762. CreateExtIO := System.AllocMem(Size);
  1763. if Assigned(CreateExtIO) then
  1764. begin
  1765. CreateExtIO^.io_Message.mn_Node.ln_Type := NT_REPLYMSG;
  1766. CreateExtIO^.io_Message.mn_ReplyPort := Mp;
  1767. CreateExtIO^.io_Message.mn_Length := Size;
  1768. end;
  1769. end;
  1770. procedure DeleteExtIO(ioReq: PIORequest);
  1771. begin
  1772. if Assigned(ioReq) then
  1773. begin
  1774. ioReq^.io_Message.mn_Node.ln_Type := Byte(-1);
  1775. ioReq^.io_Device := Pointer(-1);
  1776. ioReq^.io_Unit := Pointer(-1);
  1777. System.FreeMem(ioReq);
  1778. end;
  1779. end;
  1780. end.