home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / cbm / nduk-v39.lha / V39 / include / exec / memory.i < prev    next >
Text File  |  1992-09-24  |  4KB  |  118 lines

  1.     IFND    EXEC_MEMORY_I
  2. EXEC_MEMORY_I    SET    1
  3. **
  4. **    $VER: memory.i 39.3 (20.05.92)
  5. **    Includes Release 39.108
  6. **
  7. **    Definitions and structures used by the memory allocation system
  8. **
  9. **    (C) Copyright 1985-1992 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. **
  12.  
  13.     IFND EXEC_NODES_I
  14.     INCLUDE "exec/nodes.i"
  15.     ENDC    ; EXEC_NODES_I
  16.  
  17.  
  18. *---------------------------------------------------------------------
  19. *
  20. *   Memory List Structures
  21. *
  22. *---------------------------------------------------------------------
  23. *
  24. *   A memory list appears in two forms:  One is a requirements list
  25. *   the other is a list of already allocated memory.  The format is
  26. *   the same, with the reqirements/address field occupying the same
  27. *   position.
  28. *
  29. *   The format is a linked list of ML structures each of which has
  30. *   an array of ME entries.
  31. *
  32. *---------------------------------------------------------------------
  33.  
  34.  STRUCTURE ML,LN_SIZE
  35.     UWORD   ML_NUMENTRIES        ; The number of ME structures that follow
  36.     LABEL   ML_ME            ; where the ME structures begin
  37.     LABEL   ML_SIZE    ;Note: does NOT include any "ME" structures.
  38.  
  39.  
  40.  STRUCTURE ME,0
  41.     LABEL   ME_REQS            ; the AllocMem requirements
  42.     APTR    ME_ADDR            ; the address of this block (an alias
  43.                     ;    for the same location as ME_REQS)
  44.     ULONG   ME_LENGTH            ; the length of this region
  45.     LABEL   ME_SIZE
  46.  
  47.  
  48. *------ memory options:
  49. *------ see the AllocMem() documentation for details------*
  50.  
  51. MEMF_ANY    EQU 0        ;Any type of memory will do
  52.     BITDEF  MEM,PUBLIC,0
  53.     BITDEF  MEM,CHIP,1
  54.     BITDEF  MEM,FAST,2
  55.     BITDEF  MEM,LOCAL,8        ;Memory that does not go away at RESET
  56.     BITDEF  MEM,24BITDMA,9    ;DMAable memory within 24 bits of address
  57.     BITDEF  MEM,KICK,10        ;Memory that can be used for KickTag stuff
  58.  
  59.     BITDEF  MEM,CLEAR,16    ;AllocMem: NULL out area before return
  60.     BITDEF  MEM,LARGEST,17    ;AvailMem: return the largest chunk size
  61.     BITDEF  MEM,REVERSE,18    ;AllocMem: allocate from the top down
  62.     BITDEF  MEM,TOTAL,19    ;AvailMem: return total size of memory
  63.  
  64.     BITDEF  MEM,NO_EXPUNGE,31    ;AllocMem: Do not cause expunge on failure
  65.  
  66. *----- Current alignment rules for memory blocks (may increase) -----
  67. MEM_BLOCKSIZE    EQU 8
  68. MEM_BLOCKMASK    EQU (MEM_BLOCKSIZE-1)
  69.  
  70.  
  71. *---------------------------------------------------------------------
  72. *
  73. *   Low memory handler data structure
  74. *
  75. * Note:  This structure is *READ ONLY* and only EXEC can create it!
  76. *---------------------------------------------------------------------
  77.  STRUCTURE MemHandlerData,0
  78.     ULONG   memh_RequestSize    ; Requested allocation size
  79.     ULONG   memh_RequestFlags    ; Requested allocation flags
  80.     ULONG   memh_Flags        ; Flags (see blow)
  81.     LABEL   memh_SIZEOF
  82.  
  83. * Flag definitions:
  84.     BITDEF  MEMH,RECYCLE,0    ; 0==First time, 1==recycle
  85.  
  86. *------ Low Memory handler return values
  87. MEM_DID_NOTHING    EQU    0    ; Nothing we could do...
  88. MEM_ALL_DONE    EQU    -1    ; We did all we could do
  89. MEM_TRY_AGAIN    EQU    1    ; We did some, try the allocation again
  90.  
  91. *---------------------------------------------------------------------
  92. *
  93. *   Memory Region Header
  94. *
  95. *---------------------------------------------------------------------
  96.  
  97.  STRUCTURE  MH,LN_SIZE            ; (LN_TYPE will be set to NT_MEMORY)
  98.     UWORD   MH_ATTRIBUTES        ; characteristics of this region
  99.     APTR    MH_FIRST            ; first free region
  100.     APTR    MH_LOWER            ; lower memory bound
  101.     APTR    MH_UPPER            ; upper memory bound+1
  102.     ULONG   MH_FREE            ; number of free bytes
  103.     LABEL   MH_SIZE
  104.  
  105.  
  106. *---------------------------------------------------------------------
  107. *
  108. *   Memory Chunk
  109. *
  110. *---------------------------------------------------------------------
  111.  
  112.  STRUCTURE  MC,0
  113.     APTR    MC_NEXT            ; ptr to next chunk
  114.     ULONG   MC_BYTES            ; chunk byte size
  115.     APTR    MC_SIZE
  116.  
  117.     ENDC    ; EXEC_MEMORY_I
  118.