[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Incorrect values in APM cseg_len and cseg_16_len fields
From: |
Vladimir Andreev |
Subject: |
Re: Incorrect values in APM cseg_len and cseg_16_len fields |
Date: |
Wed, 29 Nov 2017 20:44:18 +0300 |
Hello!
It seems this bug nobody care. If I had write access to grub repo I would fix
it by myself.
25.11.2017, 22:44, "Владимир Андреев" <address@hidden>:
> Hello!
>
> GRUB provides ability to pass APM BIOS data to payload as well as to show it
> to user via "lsapm" command.
> Pointed data is obtained via grub_apm_get_info function which in turn calls
> INT 0x15 AH 0x53 BIOS service routine.
> BIOS returns data via CPU registers and then received data is being scattered
> into fields of grub_apm_info struct.
>
> According to APM BIOS spec v.1.2 low part of ESI register contains cseg_len
> value and high part of this register contains cseg_16_len value.
> But in current implementation of grub_apm_get_info function these we have
> reverse assignment, i.e. low part of ESI is assigned to cseg_16_len and high
> part is assigned to cseg_len.
>
> The following diff contains bug fix:
>
> diff --git a/grub-core/commands/i386/pc/lsapm.c
> b/grub-core/commands/i386/pc/lsapm.c
> index c82476d..d1c699b 100644
> --- a/grub-core/commands/i386/pc/lsapm.c
> +++ b/grub-core/commands/i386/pc/lsapm.c
> @@ -59,8 +59,8 @@ grub_apm_get_info (struct grub_apm_info *info)
> info->offset = regs.ebx;
> info->cseg_16 = regs.ecx & 0xffff;
> info->dseg = regs.edx & 0xffff;
> - info->cseg_len = regs.esi >> 16;
> - info->cseg_16_len = regs.esi & 0xffff;
> + info->cseg_len = regs.esi & 0xffff;
> + info->cseg_16_len = regs.esi >> 16;
> info->dseg_len = regs.edi;
>
> return 1;
>
> --
> With Best regards, Vladimir Andreev
--
С уважением, Владимир Андреев