arch:add faultmask register operation to armv7-m & armv8-m

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-01-01 22:33:52 +08:00 committed by Petro Karashchenko
parent 8fb98bc9d1
commit 172d467c26
2 changed files with 54 additions and 0 deletions

View File

@ -474,6 +474,33 @@ static inline uint32_t getipsr(void)
return ipsr;
}
/* Get/set FAULTMASK */
static inline uint32_t getfaultmask(void) always_inline_function;
static inline uint32_t getfaultmask(void)
{
uint32_t faultmask;
__asm__ __volatile__
(
"\tmrs %0, faultmask\n"
: "=r" (faultmask)
:
: "memory");
return faultmask;
}
static inline void setfaultmask(uint32_t faultmask) always_inline_function;
static inline void setfaultmask(uint32_t faultmask)
{
__asm__ __volatile__
(
"\tmsr faultmask, %0\n"
:
: "r" (faultmask)
: "memory");
}
/* Get/set CONTROL */
static inline uint32_t getcontrol(void) always_inline_function;

View File

@ -451,6 +451,33 @@ static inline uint32_t getipsr(void)
return ipsr;
}
/* Get/set FAULTMASK */
static inline uint32_t getfaultmask(void) always_inline_function;
static inline uint32_t getfaultmask(void)
{
uint32_t faultmask;
__asm__ __volatile__
(
"\tmrs %0, faultmask\n"
: "=r" (faultmask)
:
: "memory");
return faultmask;
}
static inline void setfaultmask(uint32_t faultmask) always_inline_function;
static inline void setfaultmask(uint32_t faultmask)
{
__asm__ __volatile__
(
"\tmsr faultmask, %0\n"
:
: "r" (faultmask)
: "memory");
}
/* Get/set CONTROL */
static inline uint32_t getcontrol(void) always_inline_function;