delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/27/13:46:00

Date: Wed, 27 Sep 2000 23:15:27 +0530
Message-Id: <200009271745.XAA00757@midpec.com>
From: Prashant TR <tr AT midpec DOT com>
To: eliz AT is DOT elta DOT co DOT il
CC: djgpp AT delorie DOT com
In-reply-to: <Pine.SUN.3.91.1000927070443.26042B@is> (message from Eli
Zaretskii on Wed, 27 Sep 2000 07:06:17 +0200 (IST))
Subject: Re: Rebooting the PC
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000927070443 DOT 26042B AT is>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

| Date: Wed, 27 Sep 2000 07:06:17 +0200 (IST)
| From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
| 
| Sorry, but I'm a bit confused by this thread.  Can someone tell me if 
| there's something in section 22.26 of the FAQ that needs to be changed or 
| updated or made more clear?
| 
| Thanks!
| 

From what I've tried out with my experiments, here's a gist of what
I've found (Yes, some change to the FAQ is needed).

1> Under plain DOS, I would never recommend anyone to use INT
   19H. Several programs hook this interrupt and you can't guarantee
   what it will do. It might reboot, or it may not. Here's an example.

   If you do not load HIMEM, you can't get to Windows by typing "win"
   at the command prompt. But try INT 19H, and you'll be surprised. It
   starts loading Windows! I don't know if this behaviour persists on
   all Win 9x systems. But it does happen on my Win 95.

   IMHO, under DOS, it is best to use the port 64h to do the
   work. That's what the NMI handler in the BIOS does. The code looks
   something like this...

   smsw ax
   test al, 1
   jnz try64
   cli
hltloop:
   hlt
   jmp hltloop
try64:
   mov al, 0feh
   out 64h, al
   jmp hltloop

   (Could be optimized)

2> Under Windows, there isn't any legal way to reboot your
   system. Here's a summary of what each one does:

   Port 64h - Simply terminates and closes DOS box completely.

   __dpmi_int(0x19, &regs) - Waits for a short interval and shows a
   dialog box that says "Program terminated Unexpectedly". This is due
   to the calling of the real mode "int 19h".

   PM int 19h - Closes dialog box immeldiately just like in the first
   case.

   But of course, there are several ways to crash (reboot) the
   system. You could start writing zeros to the entire 1st 1MB of
   memory ;-). Lots of other things can be done, too ;-).

3> As far as Linux is concerned, it can be done only after iopl is set
   to 3 or if you have access to /dev/port.

   See <asm/io.h> under Linux for the iopl function.

In general, I would say - Follow the BIOS code. It does the right
thing!

-- 
Prashant TR <tr AT midpec DOT com>
Web: http://www.midpec.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019