skni-kod / MicrOS

32-bit operating system with kernel written in C. Created by SKNI "KOD".
GNU General Public License v3.0
56 stars 9 forks source link

Kernel can't properly map virtual memory pages after process heap is created #99

Closed MinusPL closed 2 years ago

MinusPL commented 2 years ago

When OS is in userspace it will change page directory, so each user heap can be mapped properly. If kernel needs to allocate above 4 MB of memory (size of memory we allocate as virtual page, OS uses 4 KB paging) it will map it in user page directory belonging to currently active process. This mean that MMU cannot translate address properly after allocating new page in memory, due to lack of information about physical address.

Fix requires changing mapping logic, so kernel can "stop" currently active process and map on its own page directory.

MinusPL commented 2 years ago

Original issue is fixed, but found another issue with memory translation for page directories, that is causing triplefault (fix is already being prepared).