From 4658e8dfa9560dd181e34fbbefec119d4a6a0e8c Mon Sep 17 00:00:00 2001 From: zhangdengyu Date: Sat, 7 Jan 2023 18:20:48 +0800 Subject: [PATCH] =?UTF-8?q?fixed=206d172b1=20from=20https://gitee.com/zhan?= =?UTF-8?q?gdengyu/kernel=5Fliteos=5Fm/pulls/1000=20fix=EF=BC=9Amutex=20tr?= =?UTF-8?q?ace=E4=B8=ADArchLRGet=E7=AD=89=E6=8E=A5=E5=8F=A3=E6=94=B9?= =?UTF-8?q?=E5=8F=98=E5=AE=9E=E7=8E=B0=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 方案描述: 将ArchLRGet等接口在使用IAR环境时,实现方式从函数改为宏 Close #I69D9N Signed-off-by: zhangdengyu Change-Id: If417bc2ec9febf064c63da198faf4ac000d70c52 --- arch/include/los_arch.h | 52 ++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/arch/include/los_arch.h b/arch/include/los_arch.h index 4f7311b7..cb5cea02 100644 --- a/arch/include/los_arch.h +++ b/arch/include/los_arch.h @@ -42,33 +42,37 @@ extern "C" { #endif /* __cplusplus */ #if defined(__ICCARM__) || defined(__CC_ARM) -STATIC INLINE UINTPTR ArchSpGet(VOID) -{ - UINTPTR sp; - __asm("mov %0, sp" : "=r" (sp)); - return sp; -} +#define ARCH_SP_GET() \ +({ \ + UINTPTR sp; \ + __asm("mov %0, sp" : "=r" (sp)); \ + (sp); \ +}) +#define ArchSpGet ARCH_SP_GET -STATIC INLINE UINTPTR ArchPspGet(VOID) -{ - UINTPTR psp; - __asm("mrs %0, psp" : "=r" (psp)); - return psp; -} +#define ARCH_PSP_GET() \ +({ \ + UINTPTR psp; \ + __asm("mrs %0, psp" : "=r" (psp)); \ + (psp); \ +}) +#define ArchPspGet ARCH_PSP_GET -STATIC INLINE UINTPTR ArchMspGet(VOID) -{ - UINTPTR msp; - __asm("mrs %0, msp" : "=r" (msp)); - return msp; -} +#define ARCH_MSP_GET() \ +({ \ + UINTPTR msp; \ + __asm("mrs %0, msp" : "=r" (msp)); \ + (msp); \ +}) +#define ArchMspGet ARCH_MSP_GET -STATIC INLINE UINTPTR ArchLRGet(VOID) -{ - UINTPTR lr; - __asm("mov %0, lr" : "=r" (lr)); - return lr; -} +#define ARCH_LR_GET() \ +({ \ + unsigned int lr; \ + __asm("mov %0, lr" : "=r" (lr)); \ + (lr); \ +}) +#define ArchLRGet ARCH_LR_GET #elif defined(__CLANG_ARM) || defined(__GNUC__) STATIC INLINE UINTPTR ArchSpGet(VOID) { -- Gitee