This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
qdosmsq:traps:trap_1:rehp [2009/01/30 11:44] norman created |
qdosmsq:traps:trap_1:rehp [2021/12/20 17:10] norman [Notes] Formatting fixed. |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== MT_LNKFR/ | ||
+ | This trap frees previously allocated space in a user heap. | ||
+ | ^Call Parameters^^Return Parameters^^ | ||
+ | |D0.B|$0D|D0.L|Corrupted? | ||
+ | |D1.L|Size of area to be linked (back) in to the user heap. |D1.L|Corrupted.| | ||
+ | |D2.L|Unused. |D2.L| Corrupted.| | ||
+ | |D3.L|Unused. |D3.L| Corrupted.| | ||
+ | |A0.L|Address of the area of heap/memory to link (back) in to the user heap (Relative A6). |A0.L|Corrupted.| | ||
+ | |A1.L|Pointer to pointer to free space (Relative A6) or zero. |A1.L| Corrupted.| | ||
+ | |A2.L|Unused. |A2.L| Corrupted.| | ||
+ | |||
+ | ===== Errors ===== | ||
+ | No errors are returned by this trap. | ||
+ | |||
+ | ===== Notes ===== | ||
+ | |||
+ | * All registers not shown above are not used on entry and are preserved on exit. | ||
+ | |||
+ | * A user heap is an area of memory, maybe in the common heap, set aside for use by a single job. The job can allocate areas of this user heap for its own needs, and deallocate them as required. This stops, or reduces fragmentation of the common heap which is used by every task in the system. [[qdosmsq: | ||
+ | |||
+ | * If the long word at (A1,A6) is zero, then this trap will create a new user heap at the address in A0. | ||
+ | |||
+ | * If (A1,A6) is not zero, then you are assumed to be releasing a previously allocated chunk of user heap back into the user heap's free space. | ||
+ | |||
+ | * Normally, the sequence of events would be: | ||
+ | * Allocate some space in the common heap; | ||
+ | * Call MT_LNKFR/ | ||
+ | * Repeat as necessary: | ||
+ | * Allocate space from the heap; | ||
+ | * Use the space allocated; | ||
+ | * Return allocations to the heap; | ||
+ | * End Repeat | ||
+ | * Return the allocated space back to the common heap. | ||
+ | |||
+ | ===== Example ===== | ||
+ | [[qdosmsq: | ||
+ | manipulation traps. |