Skip to content

Improve processes kernel stack - #126

Open
Amjad50 wants to merge 2 commits into
masterfrom
improve-user-kernel-stack
Open

Improve processes kernel stack#126
Amjad50 wants to merge 2 commits into
masterfrom
improve-user-kernel-stack

Conversation

@Amjad50

@Amjad50 Amjad50 commented Jul 29, 2025

Copy link
Copy Markdown
Owner

Summary

Related issue

Changes

Checklist

  • The changes are tested and works as expected (mention if not)
  • Tests if applicable (new features, regression tests, etc...)
  • Documentation
  • Needed README changes

Amjad50 added 2 commits July 29, 2025 08:42
This will allow us to modify TSS next, which is useful in managing user
space kernel stacks

Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
Previously each process had its own isolated process-specific kernel stack
space that was VM-switched on process context switches. This approach had
limitations when processes needed to be switched from kernel mode.

This commit changes the architecture to use shared kernel stacks that are
mapped to all processes but allocated per-process from a pool.

Key changes:
- Replace per-process VM-specific kernel stacks with shared pool approach
- Add `ProcessKernelStack` allocator with bitmap-based management
- Move kernel stack allocation from VM switching to process creation
- Update TSS to load process-specific kernel stack on context switch
- This supports 32768 concurrent processes kernel stacks (number is too
  large, just used it to fit into 4096 u8 array XD)

Benefits:
- Allows safer process switching from kernel mode contexts
- Reduces VM switching complexity for kernel stack management

Signed-off-by: Amjad Alsharafi <26300843+Amjad50@users.noreply.github.com>
@Amjad50
Amjad50 force-pushed the improve-user-kernel-stack branch from 2ee4016 to 20d8820 Compare July 29, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant