Pre Merge pull request !1100 from Peshkov Ivan/master

This commit is contained in:
Peshkov Ivan 2024-01-27 08:20:45 +00:00 committed by Gitee
commit 270cd2fc2b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 105 additions and 96 deletions

View File

@ -43,25 +43,25 @@
.equ OS_CONTROL_FPCA_ENABLE, 0x4 .equ OS_CONTROL_FPCA_ENABLE, 0x4
.equ OS_CONTROL_KERNEL_MODE, 0x2 .equ OS_CONTROL_KERNEL_MODE, 0x2
#if (LOSCFG_SECURE == 1) #if (LOSCFG_SECURE == 1)
.equ OS_CONTROL_USER_MODE, 0x3 .equ OS_CONTROL_USER_MODE, 0x3
.equ OS_TASK_FLAG_USER_TASK, 0x0200 .equ OS_TASK_FLAG_USER_TASK, 0x0200
#endif #endif
.section .text .section .text
.thumb .thumb
.macro SIGNAL_CONTEXT_RESTORE .macro SIGNAL_CONTEXT_RESTORE
push {r12, lr} push {r12, lr}
blx OsSignalTaskContextRestore bl OsSignalTaskContextRestore
pop {r12, lr} pop {r12, lr}
cmp r0, #0 cmp r0, #0
mov r1, r0 mov r1, r0
bne SignalContextRestore bne SignalContextRestore
.endm .endm
.type HalStartToRun, %function .type HalStartToRun, %function
.global HalStartToRun .global HalStartToRun
HalStartToRun: HalStartToRun:
.fnstart .fnstart
.cantunwind .cantunwind
@ -153,25 +153,25 @@ ArchTaskSchedule:
.global HalPendSV .global HalPendSV
HalPendSV: HalPendSV:
.fnstart .fnstart
.cantunwind .cantunwind
mrs r12, PRIMASK mrs r12, PRIMASK
cpsid I cpsid I
HalTaskSwitch: HalTaskSwitch:
SIGNAL_CONTEXT_RESTORE SIGNAL_CONTEXT_RESTORE
push {r12, lr} push {r12, lr}
blx OsSchedTaskSwitch bl OsSchedTaskSwitch
pop {r12, lr} pop {r12, lr}
cmp r0, #0 cmp r0, #0
mov r0, lr mov r0, lr
bne TaskContextSwitch bne TaskContextSwitch
msr PRIMASK, r12 msr PRIMASK, r12
bx lr bx lr
TaskContextSwitch: TaskContextSwitch:
mov lr, r0 mov lr, r0
mrs r0, psp mrs r0, psp
stmfd r0!, {r4-r12} stmfd r0!, {r4-r12}

View File

@ -118,42 +118,42 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupGuardCreator(VOID)
(VOID)LOS_SwtmrStart(cpupSwtmrID); (VOID)LOS_SwtmrStart(cpupSwtmrID);
return LOS_OK; return LOS_OK;
} }
#endif #endif
/***************************************************************************** /*****************************************************************************
Function : OsCpupDaemonInit Function : OsCpupDaemonInit
Description: initialization of CPUP Daemon Description: initialization of CPUP Daemon
Input : None Input : None
Return : LOS_OK or Error Information Return : LOS_OK or Error Information
*****************************************************************************/ *****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit() LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit(void)
{ {
#if (LOSCFG_BASE_CORE_SWTMR == 1) #if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator(); (VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1; g_irqCpupInitFlg = 1;
#endif #endif
return LOS_OK; return LOS_OK;
} }
#endif #endif
/***************************************************************************** /*****************************************************************************
Function : OsCpupInit Function : OsCpupInit
Description: initialization of CPUP Description: initialization of CPUP
Input : None Input : None
Return : LOS_OK or Error Information Return : LOS_OK or Error Information
*****************************************************************************/ *****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit() LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit(void)
{ {
UINT32 size; UINT32 size;
CHAR *cpupMem = NULL; CHAR *cpupMem = NULL;
size = g_taskMaxNum * sizeof(OsCpupCB); size = g_taskMaxNum * sizeof(OsCpupCB);
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1) #if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB); size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
#endif #endif
cpupMem = LOS_MemAlloc(m_aucSysMem0, size); cpupMem = LOS_MemAlloc(m_aucSysMem0, size);
if (cpupMem == NULL) { if (cpupMem == NULL) {
return LOS_ERRNO_CPUP_NO_MEMORY; return LOS_ERRNO_CPUP_NO_MEMORY;

View File

@ -199,26 +199,25 @@ static UINT32 Testcase(VOID)
} }
} }
ret = LOS_EventDestroy(&g_eventCB1); ret = LOS_EventDestroy(&g_eventCB1);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_EventDestroy(&g_eventCB2); ret = LOS_EventDestroy(&g_eventCB2);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
ret = LOS_EventDestroy(&g_eventCB3); ret = LOS_EventDestroy(&g_eventCB3);
ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT); ICUNIT_GOTO_EQUAL(ret, LOS_OK, ret, EXIT);
return LOS_OK; // cleanup resources after tests
EXIT:
EXIT: LOS_SwtmrDelete(g_swtmrId3);
LOS_SwtmrDelete(g_swtmrId3); LOS_SwtmrDelete(g_swtmrId2);
LOS_SwtmrDelete(g_swtmrId2); LOS_SwtmrDelete(g_swtmrId1);
LOS_SwtmrDelete(g_swtmrId1); LOS_TaskDelete(g_testTaskID02);
LOS_TaskDelete(g_testTaskID02); LOS_TaskDelete(g_testTaskID03);
LOS_TaskDelete(g_testTaskID03);
return LOS_OK;
return LOS_OK; }
}
VOID ItLosSwtmr035(VOID) // IT_Layer_ModuleORFeature_No VOID ItLosSwtmr035(VOID) // IT_Layer_ModuleORFeature_No
{ {

View File

@ -119,9 +119,19 @@ LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs001, Function | MediumTest | L
*/ */
LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs002, Function | MediumTest | Level1) LITE_TEST_CASE(PosixMathFuncTestSuite, testMathAbs002, Function | MediumTest | Level1)
{ {
// the first case ( abs(-2147483648) ) is UB
// quote from "man abs": "Trying to take the absolute value of the most negative integer is not defined."
// so this case is disabled for non-GCC toolchains
#ifdef LOSCFG_COMPILER_GCC
const int testCount = 3; const int testCount = 3;
int testValues[] = {-2147483648, -2147483647, 2147483647}; int testValues[] = {-2147483648, -2147483647, 2147483647};
int expected[] = {-2147483648, 2147483647, 2147483647}; int expected[] = {-2147483648, 2147483647, 2147483647};
#else
const int testCount = 2;
int testValues[] = {-2147483647, 2147483647};
int expected[] = {2147483647, 2147483647};
#endif
int ret; int ret;
for (int i = 0; i < testCount; ++i) { for (int i = 0; i < testCount; ++i) {
ret = abs(testValues[i]); ret = abs(testValues[i]);

View File

@ -355,7 +355,7 @@ LITE_TEST_CASE(MqueueFuncTestSuite, TestMqOpenENOSPC, Function | MediumTest | Le
*/ */
LITE_TEST_CASE(MqueueFuncTestSuite, TestMqCloseEBADF, Function | MediumTest | Level2) LITE_TEST_CASE(MqueueFuncTestSuite, TestMqCloseEBADF, Function | MediumTest | Level2)
{ {
ICUNIT_TRACK_EQUAL(mq_close(NULL), -1, -1); ICUNIT_TRACK_EQUAL(mq_close((mqd_t)NULL), -1, -1);
ICUNIT_TRACK_EQUAL(errno, EBADF, errno); ICUNIT_TRACK_EQUAL(errno, EBADF, errno);
return 0; return 0;
} }
@ -411,7 +411,7 @@ LITE_TEST_CASE(MqueueFuncTestSuite, TestMqSendEBADFEMSGSIZE, Function | MediumTe
queue = mq_open(qName, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr); queue = mq_open(qName, O_CREAT | O_RDWR | O_NONBLOCK, S_IRUSR | S_IWUSR, &attr);
ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue); ICUNIT_ASSERT_NOT_EQUAL(queue, (mqd_t)-1, queue);
ret = mq_send(NULL, MQ_MSG, 1, MQ_MSG_PRIO); ret = mq_send((mqd_t)NULL, MQ_MSG, 1, MQ_MSG_PRIO);
ICUNIT_TRACK_EQUAL(ret, -1, ret); ICUNIT_TRACK_EQUAL(ret, -1, ret);
ICUNIT_TRACK_EQUAL(errno, EBADF, errno); ICUNIT_TRACK_EQUAL(errno, EBADF, errno);