nanvix/microkernel

[pm] Dynamically allocate user/kernel stack of a thread

joaovicentesouto opened this issue · 1 comments

Description

Currently, the thread scheduler has two static stack arrays to create a new context to a user thread. Both arrays are reserved within the memory of the kernel.

Dynamically allocating pages also decrease the kernel size and use only the necessary amount of memory.

Solution

We must change it to allocate dynamically a user or kernel page using the memory system.

Allocation functions provided by HAL to be used:

  • Kernel pages: kpage_get and kpage_put
  • User pages: upage_alloc and upage_free

Update

We will use only kernel pages for a while. In the future, we need to map a kernel page to the user memory to deal with memory protection.

ppenna commented

Closing this issue because the source tree was reset and it may now be invalid.