Kernel - Cleaned up rear PCI api
[tpg/acess2.git] / Kernel / include / hal_proc.h
1 /**
2  * Acess2
3  * - By John Hodge (thePowersGang)
4  *
5  * include/hal_proc.h
6  * - HAL Process management functions
7  * 
8  */
9 #ifndef _HAL_PROC_H_
10 #define _HAL_PROC_H_
11 /**
12  * \file hal_proc.h
13  * \brief Achitecture defined thread/process management functions
14  */
15
16 #include <threads_int.h>
17
18 /**
19  * \brief Initialise the architecture dependent side of threading
20  */
21 extern void     ArchThreads_Init(void);
22 /**
23  * \brief Start preemptive multithreading (if needed)
24  */
25 extern void     Proc_Start(void);
26 /**
27  * \brief Get the ID of this CPU
28  * \return Zero based CPU ID
29  */
30 extern int      GetCPUNum(void);
31 /**
32  * \brief Create a copy of the current process
33  * \param Flags Options for the clone
34  * \return ID of the new thread/process
35  */
36 extern tTID     Proc_Clone(Uint Flags);
37 /**
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
42  */
43 extern tTID     Proc_NewKThread( void (*Fnc)(void*), void *Ptr );
44 /**
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
52  */
53 extern void     Proc_StartUser(Uint Entrypoint, Uint Base, int ArgC, char **ArgV, int DataSize) NORETURN;
54 /**
55  * \brief Call the fault handler for a thread
56  * \param Thread        Thread that is at fault :)
57  */
58 extern void     Proc_CallFaultHandler(tThread *Thread);
59 /**
60  * \brief Dump the CPU state for a thread
61  */
62 extern void     Proc_DumpThreadCPUState(tThread *Thread);
63 /**
64  * \brief Select a new task and run it, suspending this
65  */
66 extern void     Proc_Reschedule(void);
67
68 /**
69  * \brief Clear the user's memory space back to the minimum required to run
70  */
71 extern void     MM_ClearUser(void);
72 /**
73  * \brief Dump the address space to the debug channel
74  * \param Start First address
75  * \param End   Last address
76  */
77 extern void     MM_DumpTables(tVAddr Start, tVAddr End);
78
79 #endif

UCC git Repository :: git.ucc.asn.au