Changeset 407 for trunk/hal/generic/hal_context.h
- Timestamp:
- Nov 7, 2017, 3:08:12 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_context.h
r337 r407 40 40 41 41 /**************************************************************************************** 42 * This function allocates, from the local cluster, the physical memory required for 43 * the thread CPU context, initialises it, and links the context to the thread. 42 * This function allocates memory for a CPU context and links it to the thread 43 * identified by the <thread> argument. The context is not initialised. 44 **************************************************************************************** 45 * @ return 0 if success / return -1 if failure. 46 ***************************************************************************************/ 47 error_t hal_cpu_context_alloc( struct thread_s * thread ); 48 49 /**************************************************************************************** 50 * This function allocates memory for a CPU context, initialize it from scratch, 51 * and links it to the thread identified by the <thread> argument. 44 52 **************************************************************************************** 45 53 * @ thread : pointer on the thread descriptor. 46 * @ return 0 if success / return ENOMEM if error54 * @ return 0 if success / return -1 if failure. 47 55 ***************************************************************************************/ 48 56 error_t hal_cpu_context_create( struct thread_s * thread ); 49 57 50 58 /**************************************************************************************** 51 * This function allocates, from the local cluster, the physical memory required for 52 * a thread CPU context, initialises it from values contained in "src" thread context, 53 * and links the context to the "dst" thread. 59 * This function display the following slots of a thread CPU context: 60 * - GPR : gp_28 , sp_29 , ra_31 61 * - CP0 : c0_sr , c0_th , c0_epc 62 * - CP2 : c2_ptpr , c2-mode 54 63 **************************************************************************************** 55 * @ dst : pointer on the destination thread descriptor. 56 * @ src : pointer on the source thread descriptor. 57 * @ return 0 if success / return ENOMEM if error 64 * @ thread : local pointer on the thread descriptor. 58 65 ***************************************************************************************/ 59 error_t hal_cpu_context_copy( struct thread_s * dst, 60 struct thread_s * src ); 66 void hal_cpu_context_display( struct thread_s * thread ); 61 67 62 68 /**************************************************************************************** … … 67 73 void hal_cpu_context_destroy( struct thread_s * thread ); 68 74 69 /**************************************************************************************** 70 * This function performs a context switch, saving the CPU register values into the 71 * old thread, and initializing these registers with the values of the new thread. 72 **************************************************************************************** 73 * @ old : pointer on current thread. 74 * @ new : pointer on the thread we want to switch to. 75 ***************************************************************************************/ 76 void hal_cpu_context_switch( struct thread_s * old , struct thread_s * new ); 75 76 77 78 79 77 80 78 81 /**************************************************************************************** 79 * This function loads the relevant CPU registers from values contained in 80 * the thread context. It should be called for a thread that has not been executed yet. 81 * It reset the loadable flag in thread descriptor. 82 * This function allocates memory for a FPU context, reset all entries, 83 * and links it to the thread identified by the <thread> argument. 82 84 **************************************************************************************** 83 85 * @ thread : pointer on the thread descriptor. 86 * @ return 0 if success / return -1 if failure. 84 87 ***************************************************************************************/ 85 void hal_cpu_context_load( struct thread_s * thread );88 error_t hal_fpu_context_alloc( struct thread_s * thread ); 86 89 87 90 /**************************************************************************************** 88 * This function allocates, from the local cluster, the physical memory required for 89 * the thread FPU context, and initialises the thread pointer. 90 **************************************************************************************** 91 * @ thread : pointer on the thread descriptor. 92 * @ return 0 if success / return ENOMEM if error 93 ***************************************************************************************/ 94 error_t hal_fpu_context_create( struct thread_s * thread ); 95 96 /**************************************************************************************** 97 * This function allocates, from the local cluster, the physical memory required for 98 * a thread FPU context, initialises it from values contained in "src" thread context, 99 * and link the context to the "dst" thread. 91 * This function copies a FPU context defined by the <src> argument to the FPU context 92 * defined by the <dst> argument. It is used by the fork system call. 100 93 **************************************************************************************** 101 94 * @ dst : pointer on the destination thread descriptor. 102 95 * @ src : pointer on the source thread descriptor. 103 * @ return 0 if success / return ENOMEM if error104 96 ***************************************************************************************/ 105 error_thal_fpu_context_copy( struct thread_s * dst,97 void hal_fpu_context_copy( struct thread_s * dst, 106 98 struct thread_s * src ); 107 99
Note: See TracChangeset
for help on using the changeset viewer.