Skip to content

Conversation

@ryanbreen
Copy link
Owner

Summary

  • Fix multiple init_shell processes being spawned on ARM64 boot
  • Add TODO for ARM64 render queue implementation

Root Cause

When run_userspace_from_ext2 transitions to userspace, timer interrupts may have already saved thread 0's (idle) context with ELR pointing to kernel_main. Later, when thread 0 is scheduled, it would resume kernel_main instead of going to the idle loop, causing multiple init_shell processes to spawn repeatedly.

Fix

After calling spawn_as_current() but before transitioning to userspace, explicitly reset thread 0's saved context to point to idle_loop_arm64. This ensures thread 0 always goes to the idle loop when scheduled.

Test plan

  • Build ARM64 kernel
  • Run serial-only boot test - verify only one init_shell is created
  • Run graphical boot test - verify no crashes

🤖 Generated with Claude Code

When run_userspace_from_ext2 transitions to userspace, timer interrupts
may have already saved thread 0's (idle) context with ELR pointing to
kernel_main. Later, when thread 0 is scheduled, it would resume
kernel_main instead of going to the idle loop, causing multiple
init_shell processes to spawn.

Fix by explicitly resetting thread 0's context to point to
idle_loop_arm64 after spawn_as_current() but before transitioning
to userspace. This ensures thread 0 always goes to the idle loop.

Also adds TODO comment for ARM64 render queue implementation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ryanbreen ryanbreen merged commit 7923d39 into main Jan 30, 2026
1 of 2 checks passed
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.

2 participants