9494/* 03-08-2023 Scott Larson Check module stack for */
9595/* overlap, */
9696/* resulting in version 6.2.1 */
97- /* xx-xx-xxxx Xiuwen Cai Modified comment(s), */
97+ /* xx-xx-xxxx Xiuwen Cai, Yajun xia Modified comment(s), */
9898/* added option for random */
9999/* number stack filling, */
100+ /* fixed the kernel stack */
101+ /* allocation issue, */
100102/* resulting in version 6.x */
101103/* */
102104/**************************************************************************/
@@ -327,9 +329,8 @@ ULONG i;
327329 /* Initialize thread control block to all zeros. */
328330 TX_MEMSET (thread_ptr , 0 , sizeof (TX_THREAD ));
329331
330- #if TXM_MODULE_MEMORY_PROTECTION
331- /* If this is a memory protected module, allocate a kernel stack. */
332- if ((module_instance -> txm_module_instance_property_flags ) & TXM_MODULE_MEMORY_PROTECTION )
332+ /* If the thread runs on user mode, allocate the kernel stack for syscall. */
333+ if ((module_instance -> txm_module_instance_property_flags ) & TXM_MODULE_USER_MODE )
333334 {
334335 ULONG status ;
335336
@@ -354,6 +355,7 @@ ULONG i;
354355 thread_ptr -> tx_thread_module_kernel_stack_size = TXM_MODULE_KERNEL_STACK_SIZE ;
355356 }
356357
358+ #if TXM_MODULE_MEMORY_PROTECTION
357359 /* Place the stack parameters into the thread's control block. */
358360 thread_ptr -> tx_thread_module_stack_start = stack_start ;
359361 thread_ptr -> tx_thread_module_stack_size = stack_size ;
0 commit comments