Description: Sync liteos_m to OpenHarmony.
Reviewed-by: likailong
This commit is contained in:
11
kernel/arch/risc-v/los_arch_interrupt.h
Normal file → Executable file
11
kernel/arch/risc-v/los_arch_interrupt.h
Normal file → Executable file
@@ -67,17 +67,6 @@ typedef struct {
|
||||
LosExcContext *context;
|
||||
} LosExcInfo;
|
||||
|
||||
typedef UINT32 (*EXC_INFO_SAVE_CALLBACK)(UINT32, VOID*);
|
||||
|
||||
typedef struct {
|
||||
ExcInfoType uwType;
|
||||
UINT32 uwValid;
|
||||
EXC_INFO_SAVE_CALLBACK pFnExcInfoCb;
|
||||
VOID* pArg;
|
||||
} ExcInfoArray;
|
||||
|
||||
#define MAX_EXC_MEM_SIZE 0
|
||||
|
||||
/**
|
||||
* @ingroup los_hwi
|
||||
* Highest priority of a hardware interrupt.
|
||||
|
||||
@@ -74,18 +74,18 @@
|
||||
.endm
|
||||
|
||||
.macro PUSH_CALLEE_REG
|
||||
SREG s11, 9 * REGBYTES(sp)
|
||||
SREG s10, 10 * REGBYTES(sp)
|
||||
SREG s9, 11 * REGBYTES(sp)
|
||||
SREG s8, 12 * REGBYTES(sp)
|
||||
SREG s7, 13 * REGBYTES(sp)
|
||||
SREG s6, 14 * REGBYTES(sp)
|
||||
SREG s5, 15 * REGBYTES(sp)
|
||||
SREG s4, 26 * REGBYTES(sp)
|
||||
SREG s3, 27 * REGBYTES(sp)
|
||||
SREG s2, 28 * REGBYTES(sp)
|
||||
SREG s1, 29 * REGBYTES(sp)
|
||||
SREG s0, 30 * REGBYTES(sp)
|
||||
SREG s11, 9 * REGBYTES(sp)
|
||||
SREG s10, 10 * REGBYTES(sp)
|
||||
SREG s9, 11 * REGBYTES(sp)
|
||||
SREG s8, 12 * REGBYTES(sp)
|
||||
SREG s7, 13 * REGBYTES(sp)
|
||||
SREG s6, 14 * REGBYTES(sp)
|
||||
SREG s5, 15 * REGBYTES(sp)
|
||||
SREG s4, 26 * REGBYTES(sp)
|
||||
SREG s3, 27 * REGBYTES(sp)
|
||||
SREG s2, 28 * REGBYTES(sp)
|
||||
SREG s1, 29 * REGBYTES(sp)
|
||||
SREG s0, 30 * REGBYTES(sp)
|
||||
.endm
|
||||
|
||||
.macro POP_ALL_REG
|
||||
|
||||
29
kernel/arch/risc-v/los_interrupt.c
Normal file → Executable file
29
kernel/arch/risc-v/los_interrupt.c
Normal file → Executable file
@@ -44,8 +44,6 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
static ExcInfoArray g_excArray[OS_EXC_TYPE_MAX];
|
||||
|
||||
LosExcInfo g_excInfo;
|
||||
#define RISCV_EXC_TYPE_NUM 16
|
||||
#define RISCV_EXC_LOAD_MISALIGNED 4
|
||||
@@ -344,7 +342,7 @@ STATIC VOID ExcInfoDisplay(const LosExcContext *excBufAddr)
|
||||
|
||||
PRINTK("taskName = %s\n\r", g_losTask.runTask->taskName);
|
||||
PRINTK("taskID = %u\n\r", g_losTask.runTask->taskID);
|
||||
PRINTK("system mem addr:0x%x\n\r", (UINTPTR)OS_SYS_MEM_ADDR);
|
||||
PRINTK("system mem addr:0x%x\n\r", (UINTPTR)LOSCFG_SYS_HEAP_ADDR);
|
||||
ExcInfoDisplayContext(&g_excInfo);
|
||||
}
|
||||
|
||||
@@ -361,7 +359,7 @@ VOID HalExcEntry(const LosExcContext *excBufAddr)
|
||||
g_excInfo.type = excBufAddr->mcause & 0x1FF;
|
||||
g_excInfo.context = (LosExcContext *)excBufAddr;
|
||||
|
||||
if (g_excInfo.nestCnt > 2) {
|
||||
if (g_excInfo.nestCnt > 2) { /* 2: Number of layers of exception nesting */
|
||||
PRINTK("hard faule!\n\r");
|
||||
goto SYSTEM_DEATH;
|
||||
}
|
||||
@@ -381,24 +379,11 @@ VOID HalExcEntry(const LosExcContext *excBufAddr)
|
||||
DisplayTaskInfo();
|
||||
|
||||
SYSTEM_DEATH:
|
||||
OsDoExcHook(EXC_INTERRUPT);
|
||||
while (1) {
|
||||
}
|
||||
}
|
||||
|
||||
VOID HalExcRegister(ExcInfoType type, EXC_INFO_SAVE_CALLBACK func, VOID *arg)
|
||||
{
|
||||
ExcInfoArray *excInfo = NULL;
|
||||
if ((type >= OS_EXC_TYPE_MAX) || (func == NULL)) {
|
||||
PRINT_ERR("HalExcRegister ERROR!\n");
|
||||
return;
|
||||
}
|
||||
excInfo = &(g_excArray[type]);
|
||||
excInfo->uwType = type;
|
||||
excInfo->pFnExcInfoCb = func;
|
||||
excInfo->pArg = arg;
|
||||
excInfo->uwValid = TRUE;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID HalTaskBackTrace(UINT32 taskID)
|
||||
{
|
||||
LosTaskCB *taskCB = NULL;
|
||||
@@ -435,11 +420,19 @@ LITE_OS_SEC_TEXT VOID HalBackTrace(VOID)
|
||||
BackTrace(fp);
|
||||
}
|
||||
|
||||
#if (LOSCFG_MEM_LEAKCHECK == 1)
|
||||
VOID HalRecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 jumpCount,
|
||||
UINTPTR stackStart, UINTPTR stackEnd)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/* stack protector */
|
||||
UINT32 __stack_chk_guard = 0xd00a0dff;
|
||||
|
||||
VOID __stack_chk_fail(VOID)
|
||||
{
|
||||
OsDoExcHook(EXC_STACKOVERFLOW);
|
||||
/* __builtin_return_address is a builtin function, building in gcc */
|
||||
LOS_Panic("stack-protector: Kernel stack is corrupted in: %p\n",
|
||||
__builtin_return_address(0));
|
||||
|
||||
33
kernel/arch/risc-v/los_timer.c
Normal file → Executable file
33
kernel/arch/risc-v/los_timer.c
Normal file → Executable file
@@ -33,6 +33,7 @@
|
||||
#include "los_config.h"
|
||||
#include "los_arch_interrupt.h"
|
||||
#include "riscv_hal.h"
|
||||
#include "los_timer.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -42,7 +43,7 @@ extern "C" {
|
||||
|
||||
#define NS_PER_SECOND 1000000000.0
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 HalTickStart(OS_TICK_HANDLER handler)
|
||||
WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler)
|
||||
{
|
||||
g_sysClock = OS_SYS_CLOCK;
|
||||
g_cyclesPerTick = g_sysClock / LOSCFG_BASE_CORE_TICK_PER_SECOND;
|
||||
@@ -66,6 +67,36 @@ LITE_OS_SEC_TEXT_MINOR VOID HalGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
|
||||
return;
|
||||
}
|
||||
|
||||
WEAK VOID HalDelay(UINT32 ticks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WEAK UINT64 HalGetExpandTick(VOID)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
WEAK INT32 HalGetRtcTime(UINT64 *usec)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user