[syslinux] [PATCH 1/2] chain.c32: fix bounce buffer handling
Sergey Vlasov
vsu at altlinux.ru
Wed Jul 16 04:13:20 PDT 2008
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 at altlinux.ru>
---
com32/modules/chain.c | 11 +++++++----
1 files 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 ) {
--
1.5.6.2.305.g2938b
More information about the Syslinux
mailing list