Miguel wrote:> Q: Is there a way to do a reboot (either warm or cold) from a com32
program?
>
> I have a com32 program that sometimes (based upon conditions) needs to
> reboot the system.
>
> I would prefer to do a warm reboot (40:72 = 0x1234), but at this point
> cold would be OK too.
>
> grepping through syslinux-3.51 I only found one reference, in
> iso/pxelinux.asm at the tail end of 'kaboom' ... but presumably
that only
> happens after things go wrong.
>
> It isn't clear to me how to do this since the com32 program is running
in
> 32-bit mode.
>
> Q: Can I just make a pointer to a function, set the value to 0x000FFFF0
> and make a call into the BIOS ROM, even though I am running in 32-bit mode?
>
Not really.
The easiest way is to use __farcall() to call to 0xf000:0xfff0:
__noreturn syslinux_reboot(int warm)
{
static com32sys_t dummy_regs;
uint16_t * const reboot_flag = (uint16_t *)0x472;
*reboot_flag = warm ? 0x1234 : 0;
__farcall(0xf000, 0xfff0, &dummy_regs, NULL);
}
I just added syslinux_reboot() to the git tree.
-hpa