Re: Request for Guidance on Userland Startup Issue in Custom OS
Hi Mohammad, Unfortunately, this is still a pretty big, vague question. It's not clear what "userspace does not start" means in the context of your OS. If you want to look at Tock, which I'm not clear is long-term useful for a Unix-like OS, you could take a look at our code for 32-bit x86 that switches to userspace: https://github.com/tock/tock/blob/master/arch/x86/src/boundary/switch_to_use... The hard part is not normally switching to userspace once, it's reliably switching back and forth between kernel and userspace, while making progress on both that's challenging. You'll note that most of our assembly there is 1) saving the kernel state and 2) restoring the userspace state. The userspace state is defined here: https://github.com/tock/tock/blob/master/arch/x86/src/boundary/context.rs#L2... To start with, I'd recommend focusing on a one-way transition, from kernel to userspace. If you can get your code to run at all, that's a victory. Then you can work on returning from userspace. As for debugging, honestly using GDB to step through assembly is quite valuable. It might have a hard time following the transition, but being able to see how memory and registers are set up and manipulated is pretty useful. Good luck! Branden Ghena TockOS On Sun, Apr 12, 2026 at 1:28 PM Mohammad Muzamil via Devel < devel@lists.tockos.org> wrote:
Dear Tock OS Team, I hope you are doing well. My name is Mohammad Muzamil, and I am currently working on a small operating system project called Qunix. GitHub repository:
https://github.com/MohammadMuzamil23/Qunix-Operating-System/ <https://urldefense.com/v3/__https://github.com/MohammadMuzamil23/Qunix-Opera...>
I am currently facing an issue where the system boots successfully, but the userland does not start. I have been trying to debug the kernel-to-userland transition, but I am currently stuck and unable to identify the root cause. Since I am studying embedded and systems-level OS design, I have been learning from the architecture and security model of Tock OS, and it has been very helpful for understanding safe isolation and user-space execution. If possible, I would greatly appreciate any guidance on: Common causes of userland failing to start in embedded OS designs Debugging approaches for kernel → user space transition Or any design patterns that help ensure reliable userland execution Even a small pointer would be extremely helpful and would guide me in the right direction. Thank you very much for your time and for your work on secure embedded operating systems. Best regards, Mohammad Muzamil
participants (1)
-
Branden Ghena