Mail Archives: djgpp/1997/07/05/11:08:08
At 07:28 7/4/1997 +0100, you wrote:
>In message <199707041814 DOT LAA22009 AT adit DOT ap DOT net>, Nate Eldredge
><eldredge AT ap DOT net> wrote :
>>So perhaps INT 19 is not the best way to reboot. Other solutions:
>>The standard way to reboot has always been a real-mode jump to F000h:FFF0h.
>>For a warm boot, store 1234h at 0040h:0072h first; for a cold boot, store
0000h.
>Well, how do you do that from C?
>I don't want to use TASM.
How about this (untested)?
#include <dpmi.h>
void reboot(void)
{
__dpmi_regs registers;
#ifdef WARMBOOT
_farpokew(_dos_ds,0x00472,0x1234); /* tell it to warm boot
#else
_farpokew(_dos_ds,0x00472,0x0000); /* tell it to cold boot
#endif
registers.x.ss = 0;
registers.x.sp = 0; /* have it make its own stack */
registers.x.flags = 0; /* it can figure out those too */
registers.x.cs = 0xF000;
registers.x.ip = 0xFFF0; /* go to 0xF000:0xFFF0 */
__dpmi_simulate_real_mode_procedure_retf(®isters);
/* Note that we actually did a far call, but it makes no difference
since it should never return anyway */
/* If we get here, something went wrong */
fprintf(stderr,"Panic! Attempt to reboot didn't work!\n");
}
HTH
Nate Eldredge
eldredge AT ap DOT net
- Raw text -