[syslinux] reboot from com32
Miguel
mth at mth.com
Fri Jul 20 20:25:11 PDT 2007
>> Q: Is there a way to do a reboot (either warm or cold) from
>> a com32 program?
[snip]
> 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.
Looks great to me.
*** 5 minutes later ***
Hmm ... it isn't working ... and I'm puzzled.
I pasted this exact code into my com32 source file. When I compiled I got
a warning from gcc saying:
foo.c: In function syslinux_reboot:
foo.c:127: warning: noreturn function does return
I shut this up by turning the __noreturn into a void.
At runtime, it returns. I put in printf statements before and after the
reboot:
void reboot()
{
printf("getting ready to call syslinux_reboot(1)\n");
syslinux_reboot(1);
printf("hmm ... why am I here?\n");
}
Both print messages come out. And I get back to the pxelinux boot: prompt
*** 5 minutes later ***
I made 2 changes
* made it say __noreturn instead of 'void'
* zeroed out the dummy_registers
Behavior is slightly different ... execution seems to be continuing at
some other place in my com32 program.
*** 15 minutes later ***
I'm stumped.
Miguel
More information about the Syslinux
mailing list