Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to reboot a computer immediately by programming?

945 views
Skip to first unread message

Lighter

unread,
Sep 26, 2006, 5:23:35 AM9/26/06
to
How to reboot a computer immediately by programming?

What I mean by "reboot a computer immediately by programming" is, in
the aspect of effectiveness, equivalent to pressing the RESET button on
the front panel of your computer.

I figure there is no way to do this in user mode. However, I believe
there must be a way to do this in kernel mode or in Real-address mode.
But, I don't know how to do this.

Who can tell me the correct ways?

Thanks in advance. Any help will be highly appreciated.

Slor

unread,
Sep 26, 2006, 3:05:16 PM9/26/06
to
Despite all prevention efforts, "Lighter" <spam...@crayne.org> wrote in
news:1159262615.4...@k70g2000cwa.googlegroups.com:

> I figure there is no way to do this in user mode. However, I believe
> there must be a way to do this in kernel mode or in Real-address mode.
> But, I don't know how to do this.
>

Try this:

jmp f000:e05b

--
James
http://www.e-host-direct.com
Reliable web hosting from $12/year.

Rod Pemberton

unread,
Sep 26, 2006, 3:08:56 PM9/26/06
to

----- Original Message -----
From: "Lighter" <spam...@crayne.org>
Newsgroups: comp.lang.asm.x86
Sent: Tuesday, September 26, 2006 5:23 AM
Subject: How to reboot a computer immediately by programming?

"Lighter" <spam...@crayne.org> wrote in message
news:1159262615.4...@k70g2000cwa.googlegroups.com...


> How to reboot a computer immediately by programming?
>
> What I mean by "reboot a computer immediately by programming" is, in
> the aspect of effectiveness, equivalent to pressing the RESET button on
> the front panel of your computer.
>
> I figure there is no way to do this in user mode. However, I believe
> there must be a way to do this in kernel mode or in Real-address mode.

Basically, correct. By "user mode" you mean privilege level 3 (i.e., Ring
3). By "kernel mode" you mean privilege level 0 (i.e. Ring 0). In
privilege 3, you can't (well, aren't supposed to be able to anyway) reset
the computer via software at all. I'm unsure about Ring 1 & 2...

> But, I don't know how to do this.
>
> Who can tell me the correct ways?

I'm listing the ones I know. I'm interested in any other methods both
legitimate and "cpu bugs" or hacks for any generation of CPU...

1) Intel 286 method: (RM or PM but not Ring 3) Initialize the idt with null
selector(s) using the lidt instruction. And, then call an interrupt (i.e.,
into instruction). (This is the only true "correct" method.)
2) IBM method: (RM or PM but not Ring 3) Output FEh to port 64h using the
'out' instruction, thereby forcing 8042 compatible keyboard controllers to
reset the PC. (This is the original method used IBM on the PC.)
3) BIOS method (RM), far call to FFFF:0000h. This may require setting
values at 0472h and/or CMOS 0fh. See Ralph Brown's Interrupt list for more
information.
4) Int 0x19 (RM), this interrupt is supposed to restart the BIOS bootstrap
loader, but it usually doesn't work because it has been revectored by the OS
or other reasons.
5) Int 0x18 (RM), obsolete interrupt. Some BIOS' will reset the computer
via a call to this interrupt.


Rod Pemberton

spam...@crayne.org

unread,
Sep 26, 2006, 3:14:48 PM9/26/06
to

In real mode (booted to DOS):

MOV AX,0040
MOV DS,AX
MOV Word Ptr [0072],1234
JMP F000:FFF0

Doesn't work in windows.
--
ArarghMail609a at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the garbage from the reply address.

Robert Redelmeier

unread,
Sep 26, 2006, 6:54:14 PM9/26/06
to
Rod Pemberton <spam...@crayne.org> wrote in part:

> Basically, correct. By "user mode" you mean privilege level
> 3 (i.e., Ring 3). By "kernel mode" you mean privilege
> level 0 (i.e. Ring 0). In privilege 3, you can't (well,
> aren't supposed to be able to anyway) reset the computer
> via software at all. I'm unsure about Ring 1 & 2...

With `ioperm()` [Linux & perhaps *BSD], you can get [root]
permissions to write to ports -- like 0FEh to 64h.

> I'm listing the ones I know. I'm interested in any other methods both
> legitimate and "cpu bugs" or hacks for any generation of CPU...


> 1) Intel 286 method: (RM or PM but not Ring 3) Initialize the idt with null
> selector(s) using the lidt instruction. And, then call an interrupt (i.e.,
> into instruction). (This is the only true "correct" method.)

This is a variation of a "triple fault", and only resets the
processor. No change to memory or devices.

> 2) IBM method: (RM or PM but not Ring 3) Output FEh to port 64h using the
> 'out' instruction, thereby forcing 8042 compatible keyboard controllers to
> reset the PC. (This is the original method used IBM on the PC.)

This is probably closest to pressing the reset button.
The reset signal should go throughout the system.

> 3) BIOS method (RM), far call to FFFF:0000h. This may
> require setting values at 0472h and/or CMOS 0fh. See Ralph
> Brown's Interrupt list for more information.

Again, a soft reset that only works if the BIOS hasn't been remapped.
What BIOS does depends on its' programming.

> 4) Int 0x19 (RM), this interrupt is supposed to restart the
> BIOS bootstrap loader, but it usually doesn't work because
> it has been revectored by the OS or other reasons.

Ditto

> 5) Int 0x18 (RM), obsolete interrupt. Some BIOS' will
> reset the computer via a call to this interrupt.

Ditto?

-- Robert

Donald Harris

unread,
Sep 26, 2006, 8:51:44 PM9/26/06
to

<spam...@crayne.org> wrote in message
news:kuuih2hjupvm917mp...@4ax.com...

I don't do Windows, but in DOS it used to be INT 19h for a warm boot, and
clear 472h and 473h first to do a cold boot.

Don

Rod Pemberton

unread,
Sep 27, 2006, 2:45:20 AM9/27/06
to

----- Original Message -----
From: "Robert Redelmeier" <red...@ev1.net.invalid>
Newsgroups: comp.lang.asm.x86
Sent: Tuesday, September 26, 2006 6:54 PM
Subject: Re: How to reboot a computer immediately by programming?

"Robert Redelmeier" <red...@ev1.net.invalid> wrote in message
news:qciSg.5339$GR....@newssvr29.news.prodigy.net...


> Rod Pemberton <spam...@crayne.org> wrote in part:
> > Basically, correct. By "user mode" you mean privilege level
> > 3 (i.e., Ring 3). By "kernel mode" you mean privilege
> > level 0 (i.e. Ring 0). In privilege 3, you can't (well,
> > aren't supposed to be able to anyway) reset the computer
> > via software at all. I'm unsure about Ring 1 & 2...
>
> With `ioperm()` [Linux & perhaps *BSD], you can get [root]
> permissions to write to ports -- like 0FEh to 64h.
>
> > I'm listing the ones I know. I'm interested in any other methods both
> > legitimate and "cpu bugs" or hacks for any generation of CPU...
>
>
> > 1) Intel 286 method: (RM or PM but not Ring 3) Initialize the idt with
null
> > selector(s) using the lidt instruction. And, then call an interrupt
(i.e.,
> > into instruction). (This is the only true "correct" method.)
>
> This is a variation of a "triple fault", and only resets the
> processor.

Yes, history:
http://blogs.msdn.com/larryosterman/archive/2005/02/08/369243.aspx

> No change to memory or devices.

Maybe. The lidt restarts the CPU in RM at FFFF:0000h, i.e. BIOS reset. The
memory location 40:72h and CMOS location 0fh determine what type of reset is
performed: cold, warm, exit PM, a number of return from virtual modes
including one which jumps to the address in 40:67h, and motherboard
manufacturer specific test modes. If a cold or warm boot is selected, the
memory and devices the BIOS and CPU normally reset should be properly reset.

> > 2) IBM method: (RM or PM but not Ring 3) Output FEh to port 64h using
the
> > 'out' instruction, thereby forcing 8042 compatible keyboard controllers
to
> > reset the PC. (This is the original method used IBM on the PC.)
>
> This is probably closest to pressing the reset button.
> The reset signal should go throughout the system.
>

What you're indicating is that the CPU reset and BIOS reset don't
necessarily reset all hardware... I'm not sure how the reset is actually
wired in the PC, but that seems to be different from my experiences. Since
I don't have schematics for this and haven't needed to look at them until
now, I can't comment further.

> > 3) BIOS method (RM), far call to FFFF:0000h. This may
> > require setting values at 0472h and/or CMOS 0fh. See Ralph
> > Brown's Interrupt list for more information.
>
> Again, a soft reset that only works if the BIOS hasn't been remapped.
> What BIOS does depends on its' programming.

True.

>
> > 4) Int 0x19 (RM), this interrupt is supposed to restart the
> > BIOS bootstrap loader, but it usually doesn't work because
> > it has been revectored by the OS or other reasons.
>
> Ditto
>
> > 5) Int 0x18 (RM), obsolete interrupt. Some BIOS' will
> > reset the computer via a call to this interrupt.
>
> Ditto?
>


Rod Pemberton

Mark_Larson

unread,
Sep 27, 2006, 11:32:58 AM9/27/06
to
> 3) BIOS method (RM), far call to FFFF:0000h. This may
> require setting values at 0472h and/or CMOS 0fh. See Ralph
> Brown's Interrupt list for more information.

We actually usually use an alternate method to reset the system in
BIOS. The ICH ( intel based) chipset has support for doing two
different types of resets. If you have an intel motherboard, you can
do this to do a reset. You can also select whether you want to do a
hard reset or a soft reset. The hard reset does a PCI reset. The
register in question is CF9h. Bit 1 is the one that controls a hard or
soft reset. If it's a 1 it does a hard reset, if it's as 0 it does a
soft reset. Bit 2 actually does the reset. In BIOS when we want to
reset we will write a 06h to CF9h. That forces a hard reset since bit
1 and 2 are both set. On non-Intel based motherboards it might still
be there, you'd have to check.

Mark Larson

Rod Pemberton

unread,
Sep 27, 2006, 4:27:31 PM9/27/06
to

----- Original Message -----
From: "Mark_Larson" <spam...@crayne.org>
Newsgroups: comp.lang.asm.x86
Sent: Wednesday, September 27, 2006 11:32 AM
Subject: Re: How to reboot a computer immediately by programming?

"Mark_Larson" <spam...@crayne.org> wrote in message
news:1159371178.5...@i3g2000cwc.googlegroups.com...
> "Rod Pemberton" <spam...@crayne.org> wrote in message
news:003501c6e19f$37567360$6401a8c0@SPRITELY...

Interesting, that's (also) documented in the PORTS.C file of Ralph Brown's
interrupt list.

> ... hard reset or a soft reset. The hard reset does a PCI reset.

Do the use of the hard reset and soft reset in BIOS, using port CF9h,
correspond with to the FFFF:0000h cold and warm boot routines, respectively?
(i.e., cold is a far call to FFFF:0000h with 40:72h set to 0 and warm is a
far call to FFFF:0000h with 40:72h set to 1234h) Or, is another method used
for the cold and warm boot routines?

> We actually usually use an alternate method to reset the system in
> BIOS.

Hmm...

What can you tell us about the values for 40:72h and CMOS 0Fh? Which has
priority, the value at 40:72h or the CMOS 0Fh value? Does 40:72h need to be
a certain value, like 0, to recognize and use the CMOS 0Fh value? I know RB
interrupt list has many values for 40:72h and CMOS 0Fh, but what are the
standard values as you know them for those locations? What special things
have to been done to use them? What were interesting or historical uses of
them? etc...


Rod Pemberton

Dirk Wolfgang Glomp

unread,
Sep 28, 2006, 2:17:11 AM9/28/06
to
Donald Harris schrieb:

Is this cold boot efficiency equivalent to pressing the RESET button,
where all hanging components are resetting by the resetwire?

Dirk

Mark_Larson

unread,
Sep 28, 2006, 5:30:32 PM9/28/06
to
Rod Pemberton wrote:
> ----- Original Message -----
> From: "Mark_Larson" <spam...@crayne.org>
> Do the use of the hard reset and soft reset in BIOS, using port CF9h,
> correspond with to the FFFF:0000h cold and warm boot routines, respectively?
> (i.e., cold is a far call to FFFF:0000h with 40:72h set to 0 and warm is a
> far call to FFFF:0000h with 40:72h set to 1234h) Or, is another method used
> for the cold and warm boot routines?

It does not correspond. We force a CF9 reset if you do the JMP. So
if you do the JMP you still get a PCI reset. We also do it for
ctrl-alt-del.

> > We actually usually use an alternate method to reset the system in
> > BIOS.
>
> Hmm...
>
> What can you tell us about the values for 40:72h and CMOS 0Fh? Which has
> priority, the value at 40:72h or the CMOS 0Fh value? Does 40:72h need to be
> a certain value, like 0, to recognize and use the CMOS 0Fh value? I know RB
> interrupt list has many values for 40:72h and CMOS 0Fh, but what are the
> standard values as you know them for those locations? What special things
> have to been done to use them? What were interesting or historical uses of
> them? etc...
>
>
> Rod Pemberton

40:72 does not have to be a certain value to use 0Fh.

CMOS 0Fh
Shutdown Code - 6, 7, 8, 9, A, or C - init 8259
any other code up to 0Ch, don't init 8259


shutdowns 0Fh
< 4, > 0C, or == B do a reset
04 - reboot
05 - send end of interrupt to both 8259s and jump to address in rom
bios area
06,0A - jump to location in rom bios area
07 - int 15 block move
08 - ibm halt
09 - ibm block move compat
0C - return via rom bios area address via iret

You can use 06,0Ah to set up the BIOS to jump back to your program in
the OS after doing this reboot.
CMOS trick, you can set the RTC and CMOS registers to make your system
turn on at a certain time.

Michael Tippach

unread,
Sep 28, 2006, 9:27:19 PM9/28/06
to
Mark_Larson wrote:
>
> If it's a 1 it does a hard reset, if it's as 0 it does a
> soft reset. Bit 2 actually does the reset. In BIOS when we want to
> reset we will write a 06h to CF9h.

Actually, in order to be compatible with non-Intel chip sets that
support CF9 (most do), you want to write 02h first and 06h
afterwards. Otherwise, there will be no reset.

Kevin G. Rhoads

unread,
Sep 29, 2006, 3:00:30 PM9/29/06
to
>Is this cold boot efficiency equivalent to pressing the RESET button,

At prior Lab we had two IBM ATs running DOS 3.3 with clone mono-graphics cards,
one would go into graphics mode just fine, but the other wouldn't and needed the following:

>From a power-off boot-up you ran CBOOT.COM, essentially the same as:
>>MOV AX,0040
>>MOV DS,AX
>>MOV Word Ptr [0072],0
>>JMP F000:FFF0
Then -- after DOS came back, it worked. And continued to work if rebooted using
Ctrl-Alt-Del, CBOOT or WBOOT (w/ 1234 into [72]) or the back-side reset button.

But if you used Ctrl-Alt-Del or WBOOT or the back-side reset, or any combinations
of them, it just wouldn't do monographics right. Not until CBOOT was done.

Go figure.

Bottom line, different kinds of resets reset differing mixes of things. Hardware
MAY be more consistent nowadays, but don't depend on it.

Jean-François Michaud

unread,
Sep 29, 2006, 10:28:00 PM9/29/06
to

Hahaha compatibility. The dream is still alive and well.

Regards
Jean-Francois Michaud

0 new messages