Re: software reset

Andi Kleen
2003-04-29T15:07:51Z

joe briggs <jbriggs@briggsmedia.com> writes:

> Can anyone tell me how to absolutely force a reset on a i386? Specifically,
> is there a system call that will call the assembly instruction to assert the
> RESET bus line? I try to use the "reboot(LINUX_REBOOT_CMD_RESTART,0,0,NULL)"
> call, but it will not always work. Occassionally, I experience a "missed
> interrupt" on a Promise IDE controller, and while I can telnet into the
> system, I can't reset it. Any help greatly appreciated! Since these systems
> are 1000's of miles away, the need to remotely reset it paramont.

The most reliable way is to force a triple fault; load zero into
the IDT register and then trigger an exception. The linux kernel
does that in fact for reboot and so far I haven't seen any machine failing
to reset yet.

-Andi

If you don't trust reboot you can use something like (untested!).
Compile with -c and load with insmod. I'm pretty sure it will reset
your box.

#define MODULE 1
#define __KERNEL__ 1
#include <linux/module.h>

int init_module(void)
{
static struct {
short limit;
unsigned ptr;
} desc = { 64000, 0 };

asm volatile("lidt %0" : "m" (desc));
asm volatile("movl %0,%%esp ; int $3" : "g" (0));
}