summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Vlasov <vsu@altlinux.ru>2008-07-16 15:13:20 +0400
committerH. Peter Anvin <hpa@zytor.com>2008-07-16 08:27:31 -0700
commitc4e683cea05b735fe793a5fe0f49584db3a5c67c (patch)
treebac43852073b7f4eae03efe17b5342b0b24eb22c
parent982211477ce6fe4e5ecaa1657be76df7a10dce08 (diff)
downloadsyslinux-c4e683cea05b735fe793a5fe0f49584db3a5c67c.tar.gz
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 <vsu@altlinux.ru> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/modules/chain.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index e6409b4e..9ca118c0 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 ) {