Changeset 457 for trunk/hal/tsar_mips32/core/hal_context.c
- Timestamp:
- Aug 2, 2018, 11:47:13 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/tsar_mips32/core/hal_context.c
r432 r457 22 22 */ 23 23 24 #include <hal_ types.h>24 #include <hal_kernel_types.h> 25 25 #include <hal_switch.h> 26 26 #include <memcpy.h> … … 136 136 } // end hal_cpu_context_alloc() 137 137 138 ///////////////////////////////////////////////// //139 // The following context slots are initialised :138 ///////////////////////////////////////////////// 139 // The following context slots are initialised 140 140 // GPR : a0_04 / sp_29 / ra_31 141 141 // CP0 : c0_sr / c0_th / c0_epc 142 142 // CP2 : c2_ptpr / c2_mode 143 /////////////////////////////////////////////////// 144 error_t hal_cpu_context_create( thread_t * thread ) 145 { 146 // allocate memory for a CPU context 147 error_t error = hal_cpu_context_alloc( thread ); 148 149 if( error ) return error; 150 143 ///////////////////////////////////////////////// 144 void hal_cpu_context_init( thread_t * thread ) 145 { 151 146 hal_cpu_context_t * context = (hal_cpu_context_t *)thread->cpu_context; 147 148 assert( (context != NULL ), __FUNCTION__, "CPU context not allocated" ); 152 149 153 150 // initialisation depends on thread type … … 173 170 context->c2_mode = 0x3; 174 171 } 175 176 return 0; 177 178 } // end hal_cpu_context_create() 172 } // end hal_cpu_context_init() 179 173 180 174 //////////////////////////////////////////// … … 243 237 assert( (current == child_ptr) , __FUNCTION__ , "current = %x / child = %x\n"); 244 238 } 245 246 239 } // end hal_cpu_context_fork() 240 241 ////////////////////////////////////////////// 242 void hal_cpu_context_exec( thread_t * thread ) 243 { 244 // re_initialize CPU context 245 hal_cpu_context_init( thread ); 246 247 // restore CPU registers ... and jump 248 hal_do_cpu_restore( (hal_cpu_context_t *)thread->cpu_context ); 249 250 } // end hal_cpu_context_exec() 247 251 248 252 ///////////////////////////////////////////////// … … 312 316 313 317 } // end hal_fpu_context_alloc() 318 319 ////////////////////////////////////////////// 320 void hal_fpu_context_init( thread_t * thread ) 321 { 322 hal_fpu_context_t * context = thread->fpu_context; 323 324 assert( (context != NULL) , __FUNCTION__ , "fpu context not allocated" ); 325 326 memset( context , 0 , sizeof(hal_fpu_context_t) ); 327 } 314 328 315 329 //////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.