Autodocs Libraries:
exec.library AVL_AddNode AVL_FindFirstNode AVL_FindLastNode AVL_FindNextNodeByAddress AVL_FindNextNodeByKey AVL_FindNode AVL_FindPrevNodeByAddress AVL_FindPrevNodeByKey AVL_RemNodeByAddress AVL_RemNodeByKey AbortIO AddDevice AddHead AddIntServer AddLibrary AddMemHandler AddMemList AddPort AddResource AddSemaphore AddTail AddTask Alert AllocAbs AllocEntry AllocMem AllocPooled AllocSignal AllocTrap AllocVec Allocate AttemptSemaphore AttemptSemaphoreShared AvailMem CacheClearE CacheClearU CacheControl CachePostDMA CachePreDMA Cause CheckIO CloseDevice CloseLibrary ColdReboot CopyMem CopyMemQuick CreateIORequest CreateMsgPort CreatePool Deallocate Debug DeleteIORequest DeleteMsgPort DeletePool Disable DoIO Enable Enqueue FindName FindPort FindResident FindSemaphore FindTask Forbid FreeEntry FreeMem FreePooled FreeSignal FreeTrap FreeVec GetCC GetMsg InitCode InitResident InitSemaphore InitStruct Insert MakeFunctions MakeLibrary ObtainQuickVector ObtainSemaphore ObtainSemaphoreList ObtainSemaphoreShared OldOpenLibrary OpenDevice OpenLibrary OpenResource Permit Procure PutMsg RawDoFmt ReleaseSemaphore ReleaseSemaphoreList RemDevice RemHead RemIntServer RemLibrary RemMemHandler RemPort RemResource RemSemaphore RemTail RemTask Remove ReplyMsg SendIO SetExcept SetFunction SetIntVector SetSR SetSignal SetTaskPri Signal StackSwap SumKickData SumLibrary SuperState Supervisor TypeOfMem UserState Vacate Wait WaitIO WaitPort Include GuruMeditation
|
Docs » Autodocs » exec.library » AllocEntry
AllocEntry -- allocate many regions of memory
memList = AllocEntry(memList) D0 A0 struct MemList *AllocEntry(struct MemList *);
This function takes a memList structure and allocates enough memory to hold the required memory as well as a MemList structure to keep track of it. These MemList structures may be linked together in a task control block to keep track of the total memory usage of this task. (See the description of TC_MEMENTRY under RemTask).
memList -- A MemList structure filled in with MemEntry structures.
memList -- A different MemList filled in with the actual memory allocated in the me_Addr field, and their sizes in me_Length. If enough memory cannot be obtained, then the requirements of the allocation that failed is returned and bit 31 is set. WARNING: The result is unusual! Bit 31 indicates failure. EXAMPLES The user wants five regions of 2, 4, 8, 16, and 32 bytes in size with requirements of MEMF_CLEAR, MEMF_PUBLIC, MEMF_CHIP!MEMF_CLEAR, MEMF_CLEAR, and MEMF_PUBLIC!MEMF_CLEAR respectively. The following code fragment would do that: MemListDecl: DS.B LN_SIZE * reserve space for list node DC.W 5 * number of entries DC.L MEMF_CLEAR * entry #0 DC.L 2 DC.L MEMF_PUBLIC * entry #1 DC.L 4 DC.L MEMF_CHIP!MEMF_CLEAR * entry #2 DC.L 8 DC.L MEMF_CLEAR * entry #3 DC.L 16 DC.L MEMF_PUBLIC!MEMF_CLEAR * entry #4 DC.L 32 start: LEA.L MemListDecl(PC),A0 JSR _LVOAllocEntry(a6) BCLR.L #31,D0 BEQ.S success ------- Type of memory that we failed on is in D0
If any one of the allocations fails, this function fails to back out fully. This is fixed by the "SetPatch" program on V1.3 Workbench disks.
<exec/memory.h>
|