File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ typedef struct {
43
43
44
44
void memory_init (void );
45
45
void free_memory (supervisor_allocation * allocation );
46
+ supervisor_allocation * allocation_from_ptr (void * ptr );
46
47
supervisor_allocation * allocate_remaining_memory (void );
47
48
48
49
// 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) {
82
82
allocation -> ptr = NULL ;
83
83
}
84
84
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
+
85
94
supervisor_allocation * allocate_remaining_memory (void ) {
86
95
if (low_address == high_address ) {
87
96
return NULL ;
You can’t perform that action at this time.
0 commit comments