4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-01-21 07:39:21 +08:00
rt-thread-official/components/mprotect/examples/mprotect_example_exception_hook.c
tangzz98 acc66c5479
实现MPU抽象层 (#8080)
- 为RT-Thread设计MPU抽象层,支持ARMV7-M,ARMV8-M架构,让用户使用MPU检测栈溢出等内存问题,实现线程内存隔离
- 在components/mp目录下提供通用的API,libcpu目录下提供各处理器架构的具体实现
- 在STM32U575 NUCLEO, STM32H75 NUCLEO开发板测试通过
2023-10-30 08:24:55 -04:00

21 lines
618 B
C

/*
* Copyright (c) 2006-2023, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2023-9-25 tangzz98 the first version
*/
#include <rtthread.h>
#include <mprotect.h>
void mprotect_example_exception_hook(rt_mem_exception_info_t *info)
{
rt_kprintf("Memory manage exception\n");
rt_kprintf("Faulting thread: %s\n", info->thread->parent.name);
rt_kprintf("Faulting address: %p\n", info->addr);
rt_kprintf("Faulting region: %p - %p", info->region.start, (void *)((rt_size_t)info->region.start + info->region.size));
}