Master the fundamental concepts of protected mode transition through this focused micro-challenge.
The TSS holds ring-0 stack pointer and I/O map base for privilege switches on older multitasking models. Even on modern kernels, a minimal TSS is required so IST or ring transitions know which stack to use on interrupts from ring 3. For example, the x86 Linux per-CPU TSS mainly stores the ring-0 RSP for double-fault stacks.
nasmLoading…
The CPU sets the TSS busy bit when loaded via LTR; do not manually edit it unless you know the double-fault implications. For minimal kernels, only ESP0 and SS0 fields matter; zero the rest. Place the TSS in memory that stays mapped after paging. The TR register holds the selector; verify it points to a system segment type 0x9 (available TSS) in the GDT.
You will define a TSS descriptor in the GDT and load it with LTR. This exercise requires a valid ESP0 and SS0 for future ring-3 entry or interrupt stack switching.
Implement TSS setup in C.
Requirements:
Test:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github