can someone please help me with a different issue I’m facing?
I’m writing a file system so I first set up hard drive communication. First, I use the first two commands in all.sh to create a virtual hard disk and configure it to have one partition and work with ext2. Then I use the third command to create a new qemu virtual machine and load my iso file and virtual hard disk drive.
I have managed to set up disk communication using ata pio (reading and writing sectors) however there are two weird things that are happening.
- after writing to a sector 512 bytes of the letter ‘b’ (except for the 11th which is ‘c’ but doesn’t matter), I want to read this sector and print the data. However, for some reason the last character printed is the letter ‘d’
- I want the state of my virtual hard drive (os-disk.qcow2) to be saved between multiple runnings of my code. For example, I’m running my code, writing and reading from the sector. Then, I close my qemu vm, remove the writing opration and run the code again (reading from the sector only). I expected to be able to read the data that was preiously written to the disk (previous running) but for some reason the output is empty as if the sector is empty.
https://gist.github.com/yfrandom2020/7992c1f02307156384941f2a65da3906
The first Image is an example of running with write and read to the sector.
The second Image is an example of running with only read instruction (commented the lines relating to write in kernel.cpp) after running the previous example.
The code is in the git gist here: https://gist.github.com/yfrandom2020/7992c1f02307156384941f2a65da3906
Could the problem be something with loading the virtual hard disk? or maybe not saving it correctly somehow? Thanks in advance