Changeset 625 for trunk/hal/generic
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (6 years ago)
- Location:
- trunk/hal/generic
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/generic/hal_context.h
r457 r625 2 2 * hal_context.h - Generic Thread Context Access API definition. 3 3 * 4 * Author Alain Greiner (2016 )4 * Author Alain Greiner (2016,2017,2018,2019) 5 5 * 6 6 * Copyright (c) UPMC Sorbonne Universites … … 31 31 // and hal_fpu_context_t, defined in hal_context.c file, that are accessed with generic 32 32 // void* pointers stored in the thread descriptor. 33 // - the "hal_c ontext_t" struct is used forthe CPU registers values at context switch.34 // - the "hal_fpu_context_t" struct is used for the FPU registers when required.33 // - the "hal_cpu_context_t" struct saves the CPU registers values at context switch. 34 // - the "hal_fpu_context_t" struct saves the FPU registers values at FPU switch. 35 35 ////////////////////////////////////////////////////////////////////////////////////////// 36 36 … … 56 56 57 57 /**************************************************************************************** 58 * This function is used to implement the fork() system call. 59 * 1) It saves in a remote (child) thread CPU context the current CPU registers values. 60 * Three slots are not simple copies of the parent registers values : 61 * - the thread pointer is set to the child thread local pointer. 62 * - the stack pointer is set to parrent SP + (child_base - parent_base). 63 * - the status register is set to kernel mode with IRQ disabled. 64 * 2) It copies the content of the calling (parent) thread kernel_stack, 65 * to the remote (child) thread kernel_stack. 58 * This function is called the sys_fork() function to complete the fork mechanism. 59 * It is called by th local parent thread to initialize the CPU context of the remote 60 * child thread, identified by the <thread_xp> argument. 61 * It makes three actions: 62 * 1) It copies the current values of the CPU registers of the core running the parent 63 * thread to the remote child CPU context. 64 * 2) It patches four slots of this remote child CPU context: 65 * - the c0_th slot is set to the child thread descriptor pointer. 66 * - the sp_29 slot is set to the child kernel stack pointer. 67 * - the c0_sr slot is set to kernel mode with IRQ disabled. 68 * - the c2_ptpr slot is set to the child process GPT value. 69 * 3) It copies the content of the parent thread kernel_stack, to the child thread 70 * kernel_stack, because the COW mechanism is not available on architectures where 71 * the data MMU is de-activated in kernel mode. 66 72 **************************************************************************************** 67 * @ thread_xp : extended pointer on the remotethread descriptor.73 * @ thread_xp : extended pointer on the child thread descriptor. 68 74 ***************************************************************************************/ 69 75 void hal_cpu_context_fork( xptr_t thread_xp ); -
trunk/hal/generic/hal_gpt.h
r624 r625 167 167 168 168 /**************************************************************************************** 169 * This function is used to implement the "fork" system call: It copies one GPT entry 170 * identified by the <vpn> argument, from a remote <src_gpt_xp> to a local <dst_gpt>. 169 * This function is used to implement the "fork" system call: It copies a remote 170 * source PTE, identified by the <src_gpt_xp> and <src_vpn> arguments, to a local 171 * destination PTE, identified by the <dst_gpt> and <dst_vpn> arguments. 171 172 * It does nothing if the source PTE is not MAPPED and SMALL. 172 173 * It optionnally activates the "Copy on Write" mechanism: when the <cow> argument is 173 174 * true: the GPT_WRITABLE flag is reset, and the GPT_COW flag is set. 174 * A new second level PT2 (s) is allocated fordestination GPT if required.175 * A new second level PT2 is allocated for the destination GPT if required. 175 176 * It returns in the <ppn> and <mapped> arguments the PPN value for the copied PTE, 176 177 * and a boolean indicating if the PTE is mapped and small, and was actually copied. 177 178 **************************************************************************************** 178 * @ dst_gpt : [in] local pointer on the local destination GPT. 179 * @ src_gpt_xp : [in] extended pointer on the remote source GPT. 180 * @ vpn_base : [in] vpn defining the PTE to be copied. 179 * @ dst_gpt : [in] local pointer on local destination GPT. 180 * @ dst_vpn : [in] vpn defining the PTE in the desination GPT. 181 * @ src_gpt_xp : [in] extended pointer on remote source GPT. 182 * @ src_vpn : [in] vpn defining the PTE in the source GPT. 181 183 * @ cow : [in] activate the COPY-On-Write mechanism if true. 182 184 * @ ppn : [out] PPN value (only if mapped is true). … … 185 187 ***************************************************************************************/ 186 188 error_t hal_gpt_pte_copy( gpt_t * dst_gpt, 189 vpn_t dst_vpn, 187 190 xptr_t src_gpt_xp, 188 vpn_t vpn,191 vpn_t src_vpn, 189 192 bool_t cow, 190 193 ppn_t * ppn, -
trunk/hal/generic/hal_special.h
r624 r625 101 101 * This function returns the current value of stack pointer from core register. 102 102 ****************************************************************************************/ 103 uint32_t hal_get_sp( void ); 104 105 /***************************************************************************************** 106 * This function returns the current value of the return adddress from core register. 107 ****************************************************************************************/ 108 uint32_t hal_get_ra( void ); 109 110 /***************************************************************************************** 111 * This function registers a new value in the core stack pointer and returns previous one. 112 ****************************************************************************************/ 113 inline uint32_t hal_set_sp( void * new_val ); 103 reg_t hal_get_sp( void ); 114 104 115 105 /***************************************************************************************** 116 106 * This function returns the faulty address in case of address exception. 117 107 ****************************************************************************************/ 118 uint32_t hal_get_bad_vaddr( void );108 reg_t hal_get_bad_vaddr( void ); 119 109 120 110 /***************************************************************************************** -
trunk/hal/generic/hal_vmm.h
r623 r625 59 59 error_t hal_vmm_kernel_update( struct process_s * process ); 60 60 61 /**************************************************************************************** 62 * Depending on the hardware architecture, this function displays the current state 63 * of the VMM of the process identified by the <process> argument. 64 * It displays all valit GPT entries when the <mapping> argument is true. 65 **************************************************************************************** 66 * @ process : local pointer on user process descriptor. 67 * @ return 0 if success / return ENOMEM if failure. 68 ***************************************************************************************/ 69 void hal_vmm_display( struct process_s * process, 70 bool_t mapping ); 71 72 73 61 74 #endif /* HAL_VMM_H_ */
Note: See TracChangeset
for help on using the changeset viewer.