From c4e683cea05b735fe793a5fe0f49584db3a5c67c Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Wed, 16 Jul 2008 15:13:20 +0400 Subject: [PATCH] chain.c32: fix bounce buffer handling Fix breakage in the "hide" option support patch: - The code which initialized the global variable "dapa" was lost in commit 81c203f2, therefore EBIOS access did not work properly. Fixed by removing the global variable completely and moving all bounce buffer handling into read_sector() and write_sector(). - write_sector() copied data to the bounce buffer, but then tried to use the pointer to the original buffer in BIOS calls. Signed-off-by: Sergey Vlasov Signed-off-by: H. Peter Anvin --- com32/modules/chain.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/com32/modules/chain.c b/com32/modules/chain.c index e6409b4..9ca118c 100644 --- a/com32/modules/chain.c +++ b/com32/modules/chain.c @@ -168,12 +168,13 @@ struct ebios_dapa { uint16_t off; uint16_t seg; uint64_t lba; -} *dapa; +}; static void *read_sector(unsigned int lba) { com32sys_t inreg; - void *buf = __com32.cs_bounce; + struct ebios_dapa *dapa = __com32.cs_bounce; + void *buf = (char *)__com32.cs_bounce + SECTOR; void *data; memset(&inreg, 0, sizeof inreg); @@ -227,11 +228,13 @@ static void *read_sector(unsigned int lba) return data; } -static int write_sector(unsigned int lba, const void *buf) +static int write_sector(unsigned int lba, const void *data) { com32sys_t inreg; + struct ebios_dapa *dapa = __com32.cs_bounce; + void *buf = (char *)__com32.cs_bounce + SECTOR; - memcpy(__com32.cs_bounce, buf, SECTOR); + memcpy(buf, data, SECTOR); memset(&inreg, 0, sizeof inreg); if ( disk_info.ebios ) { -- 2.7.4