Fix gcc-4.7 warnings (promoted to errors by -Werror).

../../lib/metalkit/bios.c: In function ‘BIOSCallInternal’:
  ../../lib/metalkit/bios.c:142:25: error: integer overflow in expression [-Werror=overflow]
  ../../lib/metalkit/bios.c: In function ‘BIOS_Call’:
  ../../lib/metalkit/bios.c:242:11: error: integer overflow in expression [-Werror=overflow]
  ../../lib/metalkit/bios.c:247:17: error: integer overflow in expression [-Werror=overflow]

Thanks to Vinson Lee for reporting it.

Reviewed-by: Kurt Daverman <krd@vmware.com>
This commit is contained in:
José Fonseca 2012-07-24 19:14:41 +01:00
parent 765f9659ed
commit 9cb814fd3a

View file

@ -139,7 +139,7 @@ BIOSCallInternal(void)
asm volatile("xorw %%ax, %%ax \n" asm volatile("xorw %%ax, %%ax \n"
"mov %%ax, %%ss \n" "mov %%ax, %%ss \n"
"mov %0, %%esp \n" "mov %0, %%esp \n"
:: "i" (&BIOS_SHARED->stackTop[-sizeof(Regs)])); :: "i" (BIOS_SHARED->stackTop - sizeof(Regs)));
/* /*
* Pop Regs off the stack. * Pop Regs off the stack.
@ -239,12 +239,12 @@ BIOS_Call(uint8 vector, Regs *regs)
/* /*
* Copy Regs onto the top of the 16-bit stack. * Copy Regs onto the top of the 16-bit stack.
*/ */
memcpy(&BIOS_SHARED->stackTop[-sizeof *regs], regs, sizeof *regs); memcpy(BIOS_SHARED->stackTop - sizeof *regs, regs, sizeof *regs);
BIOSCallInternal(); BIOSCallInternal();
/* Copy Regs back */ /* Copy Regs back */
memcpy(regs, &BIOS_SHARED->stackTop[-sizeof *regs], sizeof *regs); memcpy(regs, BIOS_SHARED->stackTop - sizeof *regs, sizeof *regs);
/* /*
* Back to 32-bit IDT. * Back to 32-bit IDT.