3 * - By John Hodge (thePowersGang)
6 * - HAL Process management functions
13 * \brief Achitecture defined thread/process management functions
16 #include <threads_int.h>
19 * \brief Initialise the architecture dependent side of threading
21 extern void ArchThreads_Init(void);
23 * \brief Start preemptive multithreading (if needed)
25 extern void Proc_Start(void);
27 * \brief Get the ID of this CPU
28 * \return Zero based CPU ID
30 extern int GetCPUNum(void);
32 * \brief Create a copy of the current process
33 * \param Flags Options for the clone
34 * \return ID of the new thread/process
36 extern tTID Proc_Clone(Uint Flags);
38 * \brief Create a new kernel thread for the process
39 * \param Fnc Thread root function
40 * \param Ptr Argument to pass the root function
41 * \return ID of new thread
43 extern tTID Proc_NewKThread( void (*Fnc)(void*), void *Ptr );
45 * \brief Start a user task
46 * \param Entrypoint User entrypoint
47 * \param Base Base of executable (argument for ld-acess)
48 * \param ArgC Number of arguments when the program was invoked
49 * \param ArgV Heap allocated arguments and environment (two NULL terminated lists)
50 * \param DataSize Size of the \a ArgV buffer in bytes
51 * \note This function should free \a ArgV
53 extern void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, char **ArgV, int DataSize) NORETURN;
55 * \brief Call the fault handler for a thread
56 * \param Thread Thread that is at fault :)
58 extern void Proc_CallFaultHandler(tThread *Thread);
60 * \brief Dump the CPU state for a thread
62 extern void Proc_DumpThreadCPUState(tThread *Thread);
64 * \brief Select a new task and run it, suspending this
66 extern void Proc_Reschedule(void);
69 * \brief Clear the user's memory space back to the minimum required to run
71 extern void MM_ClearUser(void);
73 * \brief Dump the address space to the debug channel
74 * \param Start First address
75 * \param End Last address
77 extern void MM_DumpTables(tVAddr Start, tVAddr End);