During the kernel initialization phase, I am able to read data correctly from the boot sector using the VirtioBlk driver. The data read at this stage is as expected. However, after the kernel performs a context switch (entering a task and then returning to the kernel), any subsequent attempts to read data result in corruption. The data read after this point does not match the expected results, suggesting a problem with either the disk read operation or a memory corruption issue. Before context switch :enter image description here graph 1 After context switch enter image description here graph 2
Direct Inspection: I manually opened the .img file to check the disk data, and it remains correct. Kernel Restart: Terminating and then restarting the kernel without making any changes results in the same issue, confirming that initial reads are correct but subsequent reads post-context switch are not.