execd.inc 61 KB

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