4 * [Generated from alloc, 25 September 1996]
7 #if !defined(__CC_NORCROFT) || !defined(__arm)
8 #error You must use the Norcroft ARM Compiler for Sapphire programs
11 #pragma include_only_once
12 #pragma force_top_level
21 /*----- Overview ----------------------------------------------------------*
33 /* --- alloc_register --- *
35 * On entry: R0 == pointer to allocator function
36 * R1 == pointer to free function
37 * R2 == workspace pointer to pass to them in R12
41 * Use: Registers two functions to be used as a heap manager by
44 * The allocator is entered with R0 as the size of block
45 * required, and should exit with CC and R0 == pointer to the
46 * block allocated if successful, CS if there wasn't enough
47 * memory and generate any other errors that occur. Registers
48 * other than R0 must be preserved.
50 * The freer is entered with R0 == pointer to block to free.
51 * It should exit with all registers preserved. If anything
52 * goes wrong, it should generate an error.
55 extern routine alloc_register;
57 /* --- alloc_useOSHeap --- *
59 * On entry: R1 == pointer to OS_Heap-managed heap to use
63 * Use: Registers an OS_Heap heap to use to allocate memory when
67 extern routine alloc_useOSHeap;
71 * On entry: R0 == size of block to allocate from current heap
73 * On exit: R0 == pointer to block and CC if it all worked
74 * CS if there wasn't enough memory (R0 corrupted)
76 * Use: Allocates R0 bytes from a heap manager. This routine will
77 * attempt to allocate memory from the current heaps in order
78 * of registration (i.e. the Sapphire OS_Heap first etc.) until
79 * either one which can service the request is found, or all
80 * the heaps have been tried.
87 * On entry: R0 == pointer to block allocated by alloc
91 * Use: Frees a block allocated by alloc, regardless of which heap
97 /* --- alloc_init --- *
103 * Use: Initialises the alloc system, and sets it up to use the
104 * kernel-provided OS_Heap area.
107 extern routine alloc_init;
109 /* --- alloc_error --- *
113 * On exit: V set and R0 == pointer to an error about not having enough
116 * Use: Returns an error suitable for displaying to a user if there
117 * isn't enough memory left.
120 extern routine alloc_error;
122 /*----- That's all, folks -------------------------------------------------*/