[syslinux] can't get write_sectors to work...

Robert Jordan rjordan at notampering.com
Mon Sep 20 15:56:20 PDT 2010


On Mon, Sep 20, 2010 at 10:40 AM, Robert Jordan <rjordan at notampering.com>wrote:

>
>
> On Mon, Sep 20, 2010 at 6:27 AM, Pierre-Alexandre Meyer <pierre at mouraf.org
> > wrote:
>
>> On Sun, Sep 19, 2010 at 9:23 PM, Robert Jordan <rjordan at notampering.com>wrote:
>>
>>> Thanks for the patch Pierre.  Unfortunately it doesn't seem to have
>>> changed the behavior at all.  If you have any other ideas let me know.
>>
>>
>> Sorry, I've sent you a half-cooked patch:
>>
>> diff --git a/com32/gpllib/disk/write.c b/com32/gpllib/disk/write.c
>> index 89e530d..b1b12e0 100644
>> --- a/com32/gpllib/disk/write.c
>> +++ b/com32/gpllib/disk/write.c
>> @@ -37,9 +37,9 @@ int write_sectors(const struct driveinfo *drive_info,
>> const unsigned int lba,
>>  {
>>      com32sys_t inreg, outreg;
>>      struct ebios_dapa *dapa = __com32.cs_bounce;
>>  -    void *buf = (char *)__com32.cs_bounce + size;
>> +    void *buf = (char *)__com32.cs_bounce + SECTOR * size;
>>
>> -    memcpy(buf, data, size);
>> +    memcpy(buf, data, SECTOR * size);
>>      memset(&inreg, 0, sizeof inreg);
>>
>>      if (drive_info->ebios) {
>> @@ -97,7 +97,7 @@ int write_sectors(const struct driveinfo *drive_info,
>> const unsigned int lba,
>>  int write_verify_sector(struct driveinfo *drive_info,
>>                         const unsigned int lba, const void *data)
>>  {
>> -    return write_verify_sectors(drive_info, lba, data, SECTOR);
>> +    return write_verify_sectors(drive_info, lba, data, 1);
>>  }
>>
>>  /**
>>
>>
>>
>>> Meanwhile I'll see if I can figure anything out on my own.
>>>
>>
>> I'll try to reproduce it here as well.
>>
>> Thanks,
>>
>> --
>> Pierre-Alexandre Meyer
>> http://pub.mouraf.org/blog
>>
>
>
> Hi Pierre,
>
> Using this patch write_verify_sector now succeeds, but the disk still does
> not seem to be written.  For example if I write a new boot sector and reboot
> the system the old boot sector is still intact.  Could there be a cache that
> needs to be flushed?  I looked at the int 13h documentation and there are
> several cache functions, but they all seem to be proprietary and deprecated.
>

Just in case anyone is searching for a solution to this problem in the
archives:

I was attempting to write 512 sectors per call, but the limit is actually
127.  It seems that errno_disk should have been set to 9, but for some
reason it was reporting success.  So, the full solution is to apply the
patch and write no more than 127 sectors per call.

Thanks for the help!



More information about the Syslinux mailing list