Theseus is a modern OS written from scratch in Rust that explores 𝐢𝐧𝐭𝐫𝐚𝐥𝐢𝐧𝐠𝐮𝐚𝐥 𝐝𝐞𝐬𝐢𝐠𝐧: closing the semantic gap between compiler and hardware by maximally leveraging the power of language safety and affine types. Theseus aims to shift OS responsibilities like resource management into the compiler.
The current code catches the mistake and reports an error. The duplicate region is created due to a bug in the check_and_add_free_region function. After returning from a recursive call, the original area's end frame should be updated to not include the region that was just added to the free list.
I believe there is an unspoken assumption that the list of reserved regions will be in ascending order, but that is not always the case.
In the screenshots below, the original code adds the region 0x2098000..=0x1FFDE000 twice.
The current code catches the mistake and reports an error. The duplicate region is created due to a bug in the
check_and_add_free_region
function. After returning from a recursive call, the original area's end frame should be updated to not include the region that was just added to the free list.I believe there is an unspoken assumption that the list of reserved regions will be in ascending order, but that is not always the case.
In the screenshots below, the original code adds the region 0x2098000..=0x1FFDE000 twice.