Skip to content

MIPS #10

Description

@Wiz-IO

I'm trying to port LiteOS for MIPS ( Microchip PIC32 )
can you explain in detail the function LOS_StartToRun()
or publish something like a C equivalent

IDA Pro deassembler give this code (approximately)
can you explain it in detail (???)

int LOS_StartToRun() {
int (* func)(int, int, int, int); // ????
OS_NVIC_SYSPRI2 = OS_NVIC_PENDSV_PRI; // ARM
g_bTaskScheduled = 1; // enable task schedule
__asm{ MSR.W CONTROL, #2 } // current stack pointer
g_stLosTask.pstRunTask = g_stLosTask.pstNewTask;
LOS_TASK_CB * V = g_stLosTask.pstNewTask;
g_stLosTask.pstNewTask->usTaskStatus |= OS_TASK_STATUS_RUNNING;
int * R = (int *) ((char ) V->pStackPointer + 100); // ???
int v7 = R[0];
int v8 = R[1];
int v9 = R[2];
int v10 = R[3];
func = (int () (int, int, int, int))R[6]; // ???
R += 26; // ???
__asm{ MSR.W PSP, R } // ARM Process Stack Pointer
__enable_irq(); // global
return func(v7, v8, v9, v10); // ???
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions