0

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.

1
  • "using VirtioBlk driver in custom operating system" - This note is quite useless. It is known that every OS uses drivers for access a hardware, and it is known that every "custom OS" has drivers written for it. Also, every OS implements context switch in its own way. So, your problem description is like "At some point the data has read successfully and at some other point the data has read incorrectly". Most likely the problem is about your code, and without the code we cannot help you with such problem. See what minimal reproducible example is.
    – Tsyvarev
    Commented May 28 at 7:08

0

Browse other questions tagged or ask your own question.