From 4464ef0afc692b8a4861ea68401bcea9457fd7a9 Mon Sep 17 00:00:00 2001 From: TomW Date: Sat, 7 Nov 2015 12:13:07 +0000 Subject: [PATCH] Fixed PIIX code broken in rev 385. --- src/piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/piix.c b/src/piix.c index 54df074..9edab5b 100644 --- a/src/piix.c +++ b/src/piix.c @@ -217,7 +217,7 @@ int piix_bus_master_sector_read(int channel, uint8_t *data) // pclog("Transferring larger - %i bytes\n", 512 - transferred); if (piix_busmaster[channel].addr < (mem_size * 1024 * 1024)) { - int count = 512; + int count = 512 - transferred; if ((piix_busmaster[channel].addr + count) > (mem_size * 1024 * 1024)) count = (mem_size * 1024 * 1024) - piix_busmaster[channel].addr; memcpy(&ram[piix_busmaster[channel].addr], data + transferred, count); @@ -274,7 +274,7 @@ int piix_bus_master_sector_write(int channel, uint8_t *data) // pclog("Transferring larger - %i bytes\n", 512 - transferred); if (piix_busmaster[channel].addr < (mem_size * 1024 * 1024)) { - int count = 512; + int count = 512 - transferred; if ((piix_busmaster[channel].addr + count) > (mem_size * 1024 * 1024)) count = (mem_size * 1024 * 1024) - piix_busmaster[channel].addr; memcpy(data + transferred, &ram[piix_busmaster[channel].addr], count);