4 ; New heap management for Dynamite
9 ;----- Overview -------------------------------------------------------------
30 [ :LNOT::DEF:dynHeap__dfn
35 ; On entry: R0 == pointer to anchor
36 ; R1 == size to allocate in bytes
37 ; R2 == ID value to store
39 ; On exit: R0 and R1 preserved
40 ; R2 == address of block allocated
42 ; Use: Allocates a block from the Dynamite heap.
48 ; On entry: R0 == pointer to anchor of block to free
52 ; Use: Frees a Dynamite block.
56 ; --- dh_freeWithID ---
58 ; On entry: R0 == ID of all blocks to free
62 ; Use: Frees all allocated blocks with a given ID number.
66 ; --- dh_blockInfo ---
68 ; On entry: R0 == address of block anchor
70 ; On exit: R0 preserved
71 ; R1 == address of block
75 ; Use: Returns information about a Dynamite block
81 ; On entry: R0 == address of anchor block, or 0 for all
83 ; R2 == old ID (if R0 == 0)
87 ; Use: This call is use to change the ID of either an individual
88 ; block (R0 == address of anchor), or the ID of all the
89 ; blocks with the ID passed in R2 (if R0 == 0).
97 ; On exit: CS if there was nothing we could do
99 ; Use: Tries to shunt the free space in the heap off the end and
100 ; back into the operating system's free pool. It does it a
101 ; little bit and then stops, rather like those workmen on the
112 ; Use: Does a full compaction of the heap.
120 ; On exit: R10 corrupted (SWIs don't care about this)
122 ; Use: Locks the heap, so that compaction entirely fails to happen.
130 ; On exit: R10 corrupted (SWIs don't care about this)
132 ; Use: Unlocks the heap, so that compaction can happen again, maybe.
138 ; On entry: R0 == mask of registers to save
140 ; On exit: R10, R11 corrupted
142 ; Use: Saves a load of registers on the Dynamite relocation stack.
143 ; The mask in R0 contains a bit set for each register to save:
144 ; bit 3 set means save R3 etc. Since this is a SWI, only
145 ; R1-R9 can be saved on the stack.
151 ; On entry: R0 == mask of registers to load
153 ; On exit: R10, R11 corrupted
155 ; Use: Loads a load of registers on the Dynamite relocation stack.
156 ; The mask in R0 contains a bit set for each register to load:
157 ; bit 3 set means load R3 etc. Since this is a SWI, only
158 ; R1-R9 can be read from the stack.
164 ; On entry: R0 == address of block anchor
165 ; R1 == new size for block
167 ; On exit: R0 preserved
168 ; R1 == address of block, may have moved
170 ; Use: Changes the size of a block.
174 ; --- dh_midExtend ---
176 ; On entry: R0 == address of block anchor
177 ; R1 == byte offset from block start
178 ; R2 == number of bytes to insert
180 ; On exit: R0 preserved
181 ; R1 == address of block, may have moved
183 ; Use: Inserts or removes bytes at a given offset into a Dynamite
188 ; --- dh_checkHeap ---
192 ; On exit: May return an error
194 ; Use: Checks the current internal format of the heap to make
195 ; sure that it hasn't been corrupted in any way.
196 ; If the integrity check fails then an error is returned.
200 ; --- dh_changeAnchor ---
202 ; On entry: R0 == pointer to anchor for block
203 ; R1 == address of new anchor
207 ; Use: Adjusts a block's anchor, in case it moves.
209 IMPORT dh_changeAnchor
217 ; Use: Outputs a textual description of the dynamite heap, giving
218 ; details of each block within it.
224 ;----- That's all, folks ----------------------------------------------------