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

Function _poisoned_pages

components/mm/mm_page.c:362–391  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362static rt_err_t _poisoned_pages(char *head, rt_uint32_t size_bits)
363{
364 rt_err_t error = RT_EOK;
365 struct installed_page_reg *page_reg = _find_page_region((rt_ubase_t)head);
366
367 if (page_reg)
368 {
369 int pages_count = 1 << size_bits;
370 long bit_number = ((rt_ubase_t)head - page_reg->region_area.start) / ARCH_PAGE_SIZE;
371
372 /* mark the pages as free */
373 for (size_t i = 0; i < pages_count; i++, bit_number++)
374 {
375 rt_spin_lock(&_inst_page_reg_lock);
376 if (!rt_bitmap_test_bit(page_reg->usage_trace, bit_number))
377 {
378 error = RT_ERROR;
379 rt_kprintf("%s: Pages[%p, %d] is freed before!\n", __func__, head, size_bits);
380 }
381 rt_bitmap_clear_bit(page_reg->usage_trace, bit_number);
382 rt_spin_unlock(&_inst_page_reg_lock);
383 }
384 }
385 else
386 {
387 error = RT_EINVAL;
388 }
389
390 return -error;
391}
392
393#endif /* RT_DEBUGGING_PAGE_POISON */
394

Callers 1

_pages_freeFunction · 0.85

Calls 6

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

Tested by

no test coverage detected