MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _unpoisoned_pages

Function _unpoisoned_pages

components/mm/mm_page.c:331–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329
330#ifdef RT_DEBUGGING_PAGE_POISON
331static rt_err_t _unpoisoned_pages(char *head, rt_uint32_t size_bits)
332{
333 rt_err_t error = RT_EOK;
334 struct installed_page_reg *page_reg = _find_page_region((rt_ubase_t)head);
335
336 if (page_reg)
337 {
338 int pages_count = 1 << size_bits;
339 long bit_number = ((rt_ubase_t)head - page_reg->region_area.start) / ARCH_PAGE_SIZE;
340
341 /* mark the pages as allocated */
342 for (size_t i = 0; i < pages_count; i++, bit_number++)
343 {
344 rt_spin_lock(&_inst_page_reg_lock);
345 if (rt_bitmap_test_bit(page_reg->usage_trace, bit_number))
346 {
347 error = RT_ERROR;
348 rt_kprintf("%s: Pages[%p, %d] is already in used by others!\n", __func__, head, size_bits);
349 }
350 rt_bitmap_set_bit(page_reg->usage_trace, bit_number);
351 rt_spin_unlock(&_inst_page_reg_lock);
352 }
353 }
354 else
355 {
356 error = RT_EINVAL;
357 }
358
359 return -error;
360}
361
362static rt_err_t _poisoned_pages(char *head, rt_uint32_t size_bits)
363{

Callers 1

_do_pages_allocFunction · 0.85

Calls 6

_find_page_regionFunction · 0.85
rt_bitmap_test_bitFunction · 0.85
rt_kprintfFunction · 0.85
rt_bitmap_set_bitFunction · 0.85
rt_spin_lockFunction · 0.50
rt_spin_unlockFunction · 0.50

Tested by

no test coverage detected