allow retrieving info about a supervisor allocation
This commit is contained in:
parent
8cba145c90
commit
094fe05bdd
@ -43,6 +43,7 @@ typedef struct {
|
|||||||
|
|
||||||
void memory_init(void);
|
void memory_init(void);
|
||||||
void free_memory(supervisor_allocation* allocation);
|
void free_memory(supervisor_allocation* allocation);
|
||||||
|
supervisor_allocation* allocation_from_ptr(void *ptr);
|
||||||
supervisor_allocation* allocate_remaining_memory(void);
|
supervisor_allocation* allocate_remaining_memory(void);
|
||||||
|
|
||||||
// Allocate a piece of a given length in bytes. If high_address is true then it should be allocated
|
// Allocate a piece of a given length in bytes. If high_address is true then it should be allocated
|
||||||
|
@ -82,6 +82,15 @@ void free_memory(supervisor_allocation* allocation) {
|
|||||||
allocation->ptr = NULL;
|
allocation->ptr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
supervisor_allocation* allocation_from_ptr(void *ptr) {
|
||||||
|
for (size_t index = 0; index < CIRCUITPY_SUPERVISOR_ALLOC_COUNT; index++) {
|
||||||
|
if (allocations[index].ptr == ptr) {
|
||||||
|
return &allocations[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
supervisor_allocation* allocate_remaining_memory(void) {
|
supervisor_allocation* allocate_remaining_memory(void) {
|
||||||
if (low_address == high_address) {
|
if (low_address == high_address) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user