Changeset 625 for trunk/kernel/kern/thread.h
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/thread.h
r619 r625 3 3 * 4 4 * Author Ghassan Almaless (2008,2009,2010,2011,2012) 5 * Alain Greiner (2016,2017,2018 )5 * Alain Greiner (2016,2017,2018,2019) 6 6 * 7 7 * Copyright (c) UPMC Sorbonne Universites … … 29 29 #include <shared_syscalls.h> 30 30 #include <hal_special.h> 31 #include <hal_kentry.h> 31 32 #include <xlist.h> 32 33 #include <list.h> … … 100 101 { 101 102 uint32_t pgfault_nr; /*! cumulated number of page fault */ 102 uint32_t sched_nr; /*! TODO ??? [AG] */103 uint32_t u_err_nr; /*! TODO ??? [AG] */104 uint32_t m_err_nr; /*! TODO ??? [AG] */105 103 cycle_t last_cycle; /*! last cycle counter value (date) */ 106 104 cycle_t usr_cycles; /*! user execution duration (cycles) */ … … 121 119 * 122 120 * WARNING (1) Don't modify the first 4 fields order, as this order is used by the 123 * hal_kentry assembly code for some architectures (TSAR).121 * hal_kentry assembly code for the TSAR architectures. 124 122 * 125 123 * WARNING (2) Most of the thread state is private and accessed only by this thread, … … 165 163 uint32_t * ack_rsp_count; /*! pointer on acknowledge response counter */ 166 164 167 intptr_t u_stack_base; /*! user stack base address */ 168 uint32_t u_stack_size; /*! user stack size (bytes) */ 165 vseg_t * user_stack_vseg; /*! local pointer on user stack vseg */ 169 166 170 167 void * entry_func; /*! pointer on entry function */ … … 248 245 249 246 /*************************************************************************************** 250 * This function is used by the sys_fork() system call to create the "child" thread 251 * in the local cluster. It allocates memory for a thread descriptor, and initializes 252 * it from the "parent" thread descriptor defined by the <parent_thread_xp> argument. 247 * This function is used by the sys_fork() syscall to create the "child" main thread 248 * in the local cluster. It is called, generally through the RPC_PROCESS_MAKE_FORK, 249 * by the process_make_fork() function. It allocates memory from the local cluster 250 * for a "child" thread descriptor, and initializes it from the "parent" thread 251 * descriptor defined by the <parent_thread_xp> argument. 253 252 * The new thread is attached to the core that has the lowest load in local cluster. 254 253 * It is registered in the "child" process defined by the <child_process> argument. … … 259 258 * uses physical addressing on some architectures). 260 259 * The CPU and FPU execution contexts are created and linked to the new thread. 261 * but the actual context copy is NOT done, and must be done by by the sys_fork().260 * but the actual context copy is NOT done, and is done by the sys_fork() function. 262 261 * The THREAD_BLOCKED_GLOBAL bit is set => the thread must be activated to start. 263 262 *************************************************************************************** … … 273 272 /*************************************************************************************** 274 273 * This function is called by the process_make_exec() function to re-initialise the 275 * thread descriptor of the calling thread (that will become the new process main 276 * thread), and immediately jump to user code without returning to kentry!!! 274 * calling thread descriptor, that will become the new process main thread. 277 275 * It must be called by the main thread of the calling process. 276 * - The calling thread TRDID is not modified. 277 * - The kernel stack (currently in use) is not modified. 278 278 * - A new user stack vseg is created and initialised. 279 * - The kernel stack (currently in use) is not modified.280 279 * - The function calls the hal_cpu_context_exec() to re-initialize the CPU context 281 * an jump to user code.280 * and the uzone registered in kernel stack, an jump to user code. 282 281 *************************************************************************************** 283 282 * @ entry_func : main thread entry point. … … 329 328 330 329 /*************************************************************************************** 331 * This low-level function is called by the sched_handle_signals() function to releases 332 * the physical memory allocated for a thread in a given cluster, when this thread 333 * is marked for delete. This include the thread descriptor itself, the associated 334 * CPU and FPU context, and the physical memory allocated for an user thread local stack. 330 * This low-level function is called by the sched_handle_signals() function when a 331 * thread is marked for delete. It removes the thread identified by the <thread> 332 * argument from the process th_tbl[], and releases all physical memory allocated for 333 * this. This includes the thread descriptor itself, the associated CPU and FPU context, 334 * and the physical memory allocated for an user thread stack. 335 335 *************************************************************************************** 336 336 * @ thread : pointer on the thread descriptor to release. 337 * @ return t rue, if the thread was the last registerd thread in local process.338 **************************************************************************************/ 339 voidthread_destroy( thread_t * thread );337 * @ return the number of threads registered in the process th_tbl[] before deletion. 338 **************************************************************************************/ 339 uint32_t thread_destroy( thread_t * thread ); 340 340 341 341 /*************************************************************************************** … … 383 383 * This function is used by the four sys_thread_cancel(), sys_thread_exit(), 384 384 * sys_kill() and sys_exit() system calls to mark for delete a given thread. 385 * It set the THREAD_BLOCKED_GLOBAL bit and set the the THREAD_FLAG_REQ_DELETE bit386 * in thethread descriptor identified by the <thread_xp> argument, to ask the scheduler385 * It set the THREAD_BLOCKED_GLOBAL bit and set the THREAD_FLAG_REQ_DELETE bit in the 386 * thread descriptor identified by the <thread_xp> argument, to ask the scheduler 387 387 * to asynchronously delete the target thread, at the next scheduling point. 388 * The calling thread can run in any cluster, as it uses remote accesses, but 389 * the target thread cannot be the main thread of the process identified by the <pid> 390 * argument, because the main thread must be deleted by the parent process argument. 388 * The calling thread can run in any cluster, as it uses remote accesses. 389 * This function makes a kernel panic if the target thread is the main thread, 390 * because * the main thread deletion will cause the process deletion, and a process 391 * must be deleted by the parent process, running the wait function. 391 392 * If the target thread is running in "attached" mode, and the <is_forced> argument 392 393 * is false, this function implements the required sychronisation with the joining
Note: See TracChangeset
for help on using the changeset viewer.