3 * - By John Hodge (thePowersGang)
6 * - HAL Process management functions
13 * \brief Achitecture defined thread/process management functions
17 #include <threads_int.h>
20 * \brief Initialise the architecture dependent side of threading
22 extern void ArchThreads_Init(void);
24 * \brief Start preemptive multithreading (if needed)
26 extern void Proc_Start(void);
28 * \brief Called just before a thread is freed
30 extern void Proc_ClearThread(tThread *Thread);
32 * \brief Called just before a process is freed
34 extern void Proc_ClearProcess(tProcess *Process);
36 * \brief Get the ID of this CPU
37 * \return Zero based CPU ID
39 extern int GetCPUNum(void);
41 * \brief Create a copy of the current process
42 * \param Flags Options for the clone
43 * \return ID of the new thread/process
45 extern tTID Proc_Clone(Uint Flags);
47 * \brief Create a new kernel thread for the process
48 * \param Fnc Thread root function
49 * \param Ptr Argument to pass the root function
50 * \return ID of new thread
52 extern tTID Proc_NewKThread( void (*Fnc)(void*), void *Ptr );
54 * \brief Start a user task
55 * \param Entrypoint User entrypoint
56 * \param Base Base of executable (argument for ld-acess)
57 * \param ArgC Number of arguments when the program was invoked
58 * \param ArgV Heap allocated arguments and environment (two NULL terminated lists)
59 * \param DataSize Size of the \a ArgV buffer in bytes
60 * \note This function should free \a ArgV
62 extern void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, const char **ArgV, int DataSize) NORETURN;
64 * \brief Call the fault handler for a thread
65 * \param Thread Thread that is at fault :)
67 extern void Proc_CallFaultHandler(tThread *Thread);
69 * \brief Dump the CPU state for a thread
71 extern void Proc_DumpThreadCPUState(tThread *Thread);
73 * \brief Select a new task and run it, suspending this
75 extern void Proc_Reschedule(void);
78 * \brief Clear the user's memory space back to the minimum required to run
80 extern void MM_ClearUser(void);
82 * \brief Dump the address space to the debug channel
83 * \param Start First address
84 * \param End Last address
86 extern void MM_DumpTables(tVAddr Start, tVAddr End);
89 * \brief Check if a buffer is valid (and all user if originally user)
90 * \param Addr Base address
91 * \param Size Size of the buffer in bytes
92 * \return Boolean valid (0: invalid, non-0: Valid)
94 extern int MM_IsValidBuffer(tVAddr Addr, size_t Size);