Re: software reset

From: Andi Kleen (ak@suse.de)
Date: Tue Apr 29 2003 - 10:19:51 EST


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));
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:32 EST