- Timestamp:
- Aug 13, 2018, 1:43:20 PM (6 years ago)
- Location:
- trunk/hal
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_user.h
r457 r459 2 2 * hal_user.h - User-side, architecture specific API definition. 3 3 * 4 * Author Alain Greiner (2016,2017 )4 * Author Alain Greiner (2016,2017,2018) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites -
trunk/hal/tsar_mips32/core/hal_context.c
r457 r459 186 186 // get remote child thread cluster and local pointer 187 187 cxy_t child_cxy = GET_CXY( child_xp ); 188 thread_t * child_ptr = (thread_t *)GET_PTR( child_xp );188 thread_t * child_ptr = GET_PTR( child_xp ); 189 189 190 190 // get remote child cpu_context local pointer … … 257 257 // get thread cluster and local pointer 258 258 cxy_t cxy = GET_CXY( thread_xp ); 259 thread_t * ptr = (thread_t *)GET_PTR( thread_xp );259 thread_t * ptr = GET_PTR( thread_xp ); 260 260 261 261 // get context pointer … … 358 358 { 359 359 // allocate a local FPU context in kernel stack 360 hal_fpu_context_t context;360 hal_fpu_context_t src_context; 361 361 362 362 // get remote child cluster and local pointer 363 363 cxy_t thread_cxy = GET_CXY( thread_xp ); 364 thread_t * thread_ptr = (thread_t *)GET_PTR( thread_xp );364 thread_t * thread_ptr = GET_PTR( thread_xp ); 365 365 366 366 asm volatile( … … 399 399 "swc1 $f31, 31*4(%0) \n" 400 400 ".set reorder \n" 401 : : "r"(&context) ); 401 : : "r"(&src_context) ); 402 403 // get local pointer on target thread FPU context 404 void * dst_context = hal_remote_lpt( XPTR( thread_cxy , &thread_ptr->fpu_context ) ); 402 405 403 406 // copy local context to remote child context) 404 hal_remote_memcpy( XPTR( thread_cxy , &thread_ptr->fpu_context ),405 XPTR( local_cxy , & context ),407 hal_remote_memcpy( XPTR( thread_cxy , dst_context ), 408 XPTR( local_cxy , &src_context ), 406 409 sizeof( hal_fpu_context_t ) ); 407 410 … … 411 414 void hal_fpu_context_restore( thread_t * thread ) 412 415 { 416 // get pointer on FPU context and cast to uint32_t 413 417 uint32_t ctx = (uint32_t)thread->fpu_context; 414 418 -
trunk/hal/tsar_mips32/core/hal_exception.c
r457 r459 311 311 { 312 312 assert( false , __FUNCTION__ , 313 "thread %x in process %x / core[%x,%d] / epc %x / vaddr %x / cycle %d\n", 314 this->trdid, this->process->pid, local_cxy, this->core->lid, 315 excPC, bad_vaddr, (uint32_t)hal_get_cycles() ); 313 "thread %x in process %x / epc %x / badvaddr %x / cycle %d\n", 314 this->trdid, this->process->pid, excPC, bad_vaddr, (uint32_t)hal_get_cycles() ); 316 315 317 316 return EXCP_KERNEL_PANIC; … … 428 427 case XCODE_CPU: // can be non fatal 429 428 { 430 if( ((uzone[UZ_CR] >> 28) & 0x3) == 1 ) // unavailableFPU431 { 432 error = hal_fpu_exception( this ); 429 if( ((uzone[UZ_CR] >> 28) & 0x3) == 1 ) // FPU 430 { 431 error = hal_fpu_exception( this ); // FPU exception 433 432 } 434 433 else -
trunk/hal/tsar_mips32/core/hal_shared_types.h
r452 r459 1 1 /* 2 * hal_ kernel_types.h - Data types shared by kernel & libraries for TSAR-MIPS32.2 * hal_shared_types.h - Data types shared by kernel & libraries for TSAR-MIPS32. 3 3 * 4 4 * Author Alain Greiner (2016) … … 26 26 27 27 /*******************i*************************************************************** 28 * This file defines - for the TSAR_MIPS32 architecture - the <reg_t> type, used 29 * by the hal_user_syscall() function, called by several user-level libraries 30 * to pass syscall arguments to the kernel, and used by the do_syscall() function, 31 * called by the kernel syscall handler, to analyse arguments. 32 * It is also used by various kernel functions such as the hal_*_irq() functions 33 * to save/restore the SR register value. 28 * This file defines - for the TSAR_MIPS32 architecture - types that can be used 29 * by both the kernel and the user applications. 30 * 31 * - the <reg_t> type, is used by the hal_user_syscall() function, called by 32 * several user-level libraries to pass syscall arguments to the kernel, 33 * and used by the do_syscall() kernel function, to analyse arguments. 34 * It is also used by the hal_*_irq() kernel functions to save/restore 35 * the SR register value. 34 36 **********************************************************************************/ 35 37 … … 40 42 typedef unsigned long int reg_t; // core register 41 43 42 #endif /* HAL_TYPES_H_ */44 #endif -
trunk/hal/tsar_mips32/core/hal_special.c
r457 r459 113 113 void hal_fpu_enable() 114 114 { 115 // set CU1 bit (FPU enable) in c0_sr 115 116 asm volatile 116 117 ( ".set noat \n" … … 120 121 "mtc0 $27, $12 \n" 121 122 ".set at \n" ); 123 124 // set CU1 bit in calling thread UZONE 125 uint32_t * uzone = CURRENT_THREAD->uzone_current; 126 uzone[34] |= 0x20000000; 122 127 } 123 128 … … 125 130 void hal_fpu_disable() 126 131 { 132 // reset CU1 bit (FPU enable) in c0_sr 127 133 asm volatile 128 134 ( ".set noat \n" … … 133 139 "mtc0 $27, $12 \n" 134 140 ".set at \n"); 141 142 // reset CU1 bit in calling thread UZONE 143 uint32_t * uzone = CURRENT_THREAD->uzone_current; 144 uzone[34] &= 0xDFFFFFFF; 135 145 } 136 146
Note: See TracChangeset
for help on using the changeset viewer.