File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ typedef struct {
4343
4444void memory_init (void );
4545void free_memory (supervisor_allocation * allocation );
46+ supervisor_allocation * allocation_from_ptr (void * ptr );
4647supervisor_allocation * allocate_remaining_memory (void );
4748
4849// Allocate a piece of a given length in bytes. If high_address is true then it should be allocated
Original file line number Diff line number Diff line change @@ -82,6 +82,15 @@ void free_memory(supervisor_allocation* allocation) {
8282 allocation -> ptr = NULL ;
8383}
8484
85+ supervisor_allocation * allocation_from_ptr (void * ptr ) {
86+ for (size_t index = 0 ; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT ; index ++ ) {
87+ if (allocations [index ].ptr == ptr ) {
88+ return & allocations [index ];
89+ }
90+ }
91+ return NULL ;
92+ }
93+
8594supervisor_allocation * allocate_remaining_memory (void ) {
8695 if (low_address == high_address ) {
8796 return NULL ;
You can’t perform that action at this time.
0 commit comments