Skip to main content

Module usertest

Module usertest 

Source
Expand description

Minimal Ring 3 test task for Strat9-OS.

Creates a user address space with a tiny machine code blob that:

  1. Calls SYS_DEBUG_LOG to print β€œHello Ring 3!” to serial
  2. Calls SYS_PROC_EXIT to cleanly exit

This tests the full SYSCALL/SYSRET pipeline without needing an ELF loader.

ConstantsΒ§

USER_CODE_ADDR πŸ”’
User code virtual address (must be in lower half, page-aligned).
USER_STACK_ADDR πŸ”’
User stack virtual address (page-aligned).
USER_STACK_TOP πŸ”’
User stack top (stack grows down, so this is base + 4096).

StaticsΒ§

USER_TASK_AS πŸ”’
Static storage for the user address space (accessed by the trampoline).

FunctionsΒ§

create_user_test_task
Create and schedule a minimal Ring 3 test task.
ring3_trampoline πŸ”’
Trampoline that switches to user address space and does IRETQ to Ring 3.
write_user_code πŸ”’
Write the user-mode test program into the code page.