Caffeine wrote:
For the writes, I am a little lost on how to write 16 bits to the register.
You already have a function to write an 8-bit value to a port, right? Create a copy of that function, but adapted for 16 bits. Like this:
Code:
void outportw (unsigned short _port, unsigned short _data) {
__asm__ __volatile__ ("outw %1, %0" : : "dN" (_port), "a" (_data));
}
So I have fixed that, but it still is not saving. I'm starting to think it might have something to do with qemu not saving. I've removed all of the warnings its giving me and such, but it still isn't saving when I restart the OS. When I write to an LBA and read it back before restarting it, it works, but when closing qemu and rerunning the code, it does not work. I did not use snapshot mode or anything when I created the disk, so I have no clue what is wrong.
Also, adding pollATA() before outportb(ATA_PRIMARY_COMM_REGSTAT, 0xE7); causes the OS to stall. Anyways, removing that, the output is:
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
[email protected]:ide_data_writew IDE PIO wr @ 0x1f0 (Data: Word); val 0x0000; bus 0x561b275cf190; IDEState 0x561b275cf210
...
[email protected]:ide_sector_write sector=3 nsectors=1
[email protected]:ide_ioport_write IDE PIO wr @ 0x1f7 (Command); val 0xe7; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_exec_cmd IDE exec cmd: bus 0x561b275cf190; state 0x561b275cf210; cmd 0xe7
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
...
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0xc0; bus 0x561b275cf190 IDEState 0x561b275cf210
[email protected]:ide_ioport_read IDE PIO rd @ 0x1f7 (Status); val 0x50; bus 0x561b275cf190 IDEState 0x561b275cf210