/**
- * \fn void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, char **ArgV, char **EnvP, int DataSize)
+ * \fn void Proc_StartUser(Uint Entrypoint, Uint *Bases, int ArgC, char **ArgV, char **EnvP, int DataSize)
* \brief Starts a user task
*/
void Proc_StartUser(Uint Entrypoint, Uint *Bases, int ArgC, char **ArgV, char **EnvP, int DataSize)
* \fn int Proc_Demote(Uint *Err, int Dest, tRegs *Regs)
* \brief Demotes a process to a lower permission level
* \param Err Pointer to user's errno
+ * \param Dest New Permission Level
+ * \param Regs Pointer to user's register structure
*/
int Proc_Demote(Uint *Err, int Dest, tRegs *Regs)
{
__asm__ __volatile__ ("mov %0, %%cr3"::"a"(gCurrentThread->MemState.CR3));
// Switch threads
__asm__ __volatile__ (
- "mov %1, %%esp\n\t"
- "mov %2, %%ebp\n\t"
- "jmp *%3" : :
+ "mov %1, %%esp\n\t" // Restore ESP
+ "mov %2, %%ebp\n\t" // and EBP
+ "jmp *%3" : : // And return to where we saved state (Proc_Clone or Proc_Scheduler)
"a"(SWITCH_MAGIC), "b"(gCurrentThread->SavedState.ESP),
- "d"(gCurrentThread->SavedState.EBP), "c"(gCurrentThread->SavedState.EIP));
+ "d"(gCurrentThread->SavedState.EBP), "c"(gCurrentThread->SavedState.EIP)
+ );
for(;;); // Shouldn't reach here
}
+
+// === EXPORTS ===
+EXPORT(Proc_SpawnWorker);