Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MIPS #10

Open
Wiz-IO opened this issue Oct 23, 2018 · 0 comments
Open

MIPS #10

Wiz-IO opened this issue Oct 23, 2018 · 0 comments

Comments

@Wiz-IO
Copy link

Wiz-IO commented Oct 23, 2018

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); // ???
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant