mprotect_example_exception_hook.c 618 B

1234567891011121314151617181920
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-9-25 tangzz98 the first version
  9. */
  10. #include <rtthread.h>
  11. #include <mprotect.h>
  12. void mprotect_example_exception_hook(rt_mem_exception_info_t *info)
  13. {
  14. rt_kprintf("Memory manage exception\n");
  15. rt_kprintf("Faulting thread: %s\n", info->thread->parent.name);
  16. rt_kprintf("Faulting address: %p\n", info->addr);
  17. rt_kprintf("Faulting region: %p - %p", info->region.start, (void *)((rt_size_t)info->region.start + info->region.size));
  18. }