Browse Source

fix(thd): subtract ptr by kstack size on freeing

greatbridf 2 years ago
parent
commit
38c7861ce7
1 changed files with 1 additions and 1 deletions
  1. 1 1
      include/kernel/process.hpp

+ 1 - 1
include/kernel/process.hpp

@@ -95,7 +95,7 @@ public:
     constexpr ~thread()
     {
         if (kstack)
-            free_n_raw_pages(to_page(kstack), 2);
+            free_n_raw_pages(to_page(kstack - THREAD_KERNEL_STACK_SIZE), 2);
     }
 };