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 Called just before a thread is freed
29 extern void Proc_ClearThread(tThread *Thread);
31 * \brief Get the ID of this CPU
32 * \return Zero based CPU ID
34 extern int GetCPUNum(void);
36 * \brief Create a copy of the current process
37 * \param Flags Options for the clone
38 * \return ID of the new thread/process
40 extern tTID Proc_Clone(Uint Flags);
42 * \brief Create a new kernel thread for the process
43 * \param Fnc Thread root function
44 * \param Ptr Argument to pass the root function
45 * \return ID of new thread
47 extern tTID Proc_NewKThread( void (*Fnc)(void*), void *Ptr );
49 * \brief Start a user task
50 * \param Entrypoint User entrypoint
51 * \param Base Base of executable (argument for ld-acess)
52 * \param ArgC Number of arguments when the program was invoked
53 * \param ArgV Heap allocated arguments and environment (two NULL terminated lists)
54 * \param DataSize Size of the \a ArgV buffer in bytes
55 * \note This function should free \a ArgV
57 extern void Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, char **ArgV, int DataSize) NORETURN;
59 * \brief Call the fault handler for a thread
60 * \param Thread Thread that is at fault :)
62 extern void Proc_CallFaultHandler(tThread *Thread);
64 * \brief Dump the CPU state for a thread
66 extern void Proc_DumpThreadCPUState(tThread *Thread);
68 * \brief Select a new task and run it, suspending this
70 extern void Proc_Reschedule(void);
73 * \brief Clear the user's memory space back to the minimum required to run
75 extern void MM_ClearUser(void);
77 * \brief Dump the address space to the debug channel
78 * \param Start First address
79 * \param End Last address
81 extern void MM_DumpTables(tVAddr Start, tVAddr End);
84 * \brief Check if a buffer is valid (and all user if originally user)
85 * \param Addr Base address
86 * \param Size Size of the buffer in bytes
87 * \return Boolean valid (0: invalid, non-0: Valid)
89 extern int MM_IsValidBuffer(tVAddr Addr, size_t Size);