2
0

exec.pas 63 KB

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