[comp.sys.ibm.pc] System boot and INT 19

bsrdp@warwick.ac.uk (Hylton Boothroyd) (01/10/90)

In article <77@qmsseq.imagen.com> pipkins@qmsseq.UUCP (Jeff Pipkins) writes:
> The int 19h vector is supposed to do a warm boot.

I wonder how many of those who repeat these recipes have tried them.
The use of INT 19 is curiously under-documented even in the MSDOS
interrupt list.

In my current version of MSDOS (3.20), the MSDOS external command
PRINT.EXE is in fact a TSR which hooks INT 19 for its own purposes.  I
haven't traced through the use of INT 19, or traced whether it hands on
gracefully up the chain, but I do know that the warm-start recipes that
appear here every so often simply don't work for me.

It remains a mystery how to replicate the warm start effect of
Ctrl-Alt-Del.  [And I have worked through several of the likely things
in SIMTEL.]

jb@altair.uucp (John Birchfield) (01/10/90)

In article <357@clover.warwick.ac.uk> bsrdp@warwick.ac.uk (Hylton Boothroyd) writes:
>In article <77@qmsseq.imagen.com> pipkins@qmsseq.UUCP (Jeff Pipkins) writes:
>> The int 19h vector is supposed to do a warm boot.
>
>I wonder how many of those who repeat these recipes have tried them.
>The use of INT 19 is curiously under-documented even in the MSDOS
>interrupt list.
...
>It remains a mystery how to replicate the warm start effect of
>Ctrl-Alt-Del.  [And I have worked through several of the likely things
>in SIMTEL.]


The following c program will do it ...
------------------------------------------------------------------------
int (far *reboot) () = (int (far *) ()) 0xffff0000;

main ()
{
	(*reboot) ();
}
------------------------------------------------------------------------
+----------------------
| John Birchfield      
| jb@altair.csustan.edu
+----------------------

darcy@druid.uucp (D'Arcy J.M. Cain) (01/11/90)

In article <357@clover.warwick.ac.uk> bsrdp@warwick.ac.uk (Hylton Boothroyd) writes:
>In article <77@qmsseq.imagen.com> pipkins@qmsseq.UUCP (Jeff Pipkins) writes:
>> The int 19h vector is supposed to do a warm boot.
>
>I wonder how many of those who repeat these recipes have tried them.
>The use of INT 19 is curiously under-documented even in the MSDOS
>interrupt list.
>
>In my current version of MSDOS (3.20), the MSDOS external command
>PRINT.EXE is in fact a TSR which hooks INT 19 for its own purposes.  I
>haven't traced through the use of INT 19, or traced whether it hands on
>gracefully up the chain, but I do know that the warm-start recipes that
>appear here every so often simply don't work for me.
>
>It remains a mystery how to replicate the warm start effect of
>Ctrl-Alt-Del.  [And I have worked through several of the likely things
>in SIMTEL.]
First let me add some information.  The following will do a warm boot:

	mov	ax, 40h
	mov	ds, ax
	mov word ptr [72h], 1234h
	jmp	0ffff:0000

Note the value to stuff into location 0472h is 1234 HEX.  The ROM BIOS
looks at that location to decide whether it was just turned on or if it
is booting from a live system.

Second can anyone tell me if int 19h will restore interupt vectors
properly if they were changed using DOS int 21h service 25h (Set
Interupt Vector) or does the program have to catch this as well?  I
always assumed the former but some of the discussion here suggests
the latter.


-- 
D'Arcy J.M. Cain (darcy@druid)     |   Thank goodness we don't get all 
D'Arcy Cain Consulting             |   the government we pay for.
West Hill, Ontario, Canada         |
No disclaimers.  I agree with me   |

pipkins@qmsseq.imagen.com (Jeff Pipkins) (01/12/90)

I have a copy of the old original IBM PC Tech Ref manual, with BIOS listings,
and also the IBM PC/AT Tech Ref manual with the same.  I looked up the INT 9h
keyboard interrupt service routine at the place where Ctrl-Alt-Del is 
detected.  Guess what -- it doesn't use INT 19h to do the warm boot.  Instead,
it loads the value 1234h into a variable called RESET_FLAG and then jumps
into the power-on-self-test (POST) routines at a label called RESET.  Both
the PC and AT code handles it the same way.  I have not checked to see whether
both BIOSes locate RESET and RESET_FLAG at the same addresses.

So it appears that Ctrl-Alt-Del does not directly involve DOS!  I wonder if
the reset function calls INT 19h at all later on?  I wonder what INT 19h is
for anyway!

Maybe the safest kludge for doing a warm boot would be to synthesize the
Ctrl-Alt-Del key sequence (ugly).  Before trying to set those bits in the
BIOS keybord status byte and doing an INT 9h, remember to consider the
8259 interrupt controller and the EOI sequence.  Whim: maybe you could catch
the next timer interrupt, check the ISR register to make sure that no
lower-level interrupts are being serviced (if so, chain and wait for next
timer interrupt), then set the bits in the keyboard status byte, and jump
into the INT 9h vector; Then whoever is responsible for the EOI will
send it and it will be used to EOI the timer instead of the keyboard.  Kinda
nasty, but if you close your eyes, hold your breath and jump in with both
feet it just might work.

If anyone decides to try this, please don't credit my name to it.  I'd like
to keep what little reputation I have...  >;-)

Standard disclaimers apply -- try at your own risk -- not responsible for
damages -- etc.

fisher@sc2a.unige.ch (Markus Fischer) (01/12/90)

In article <357@clover.warwick.ac.uk>, bsrdp@warwick.ac.uk (Hylton Boothroyd) writes:
> [...]
> I wonder how many of those who repeat these recipes have tried them.
> The use of INT 19 is curiously under-documented even in the MSDOS
> interrupt list.
> [...]
> It remains a mystery how to replicate the warm start effect of
> Ctrl-Alt-Del.

It seems the place where to look is in the keyboard driver, as Ctrl-Alt-Del is
after all interpreted by it.  Now I havn't done any hacking in the recent
drivers, but a few years ago, I had to modify the Olivetti MS-DOS 2.11 swiss-
french driver (it was incompatible with the needs of WordPerfect v. 3.21, or
the like - WP used Ctrl- and Alt- Numbers (first row of the keyboard), which
had been remapped in that particular driver...).

Anyway, here is the significant dissasembled code:

	cmp	AH, 05			; Alt-Ctr shift state
	jnz	(further)		; jump to next shift state
	cmp	AL, 53			; Del scan code
	jnz	ACF1			; jump to next function
	;
	; Alt-Ctrl-Del function
	;
	ES:				; is hex 40
	mov	word ptr [0072],1234	; no memory check (but how ?)
	jmp	F000:FFF0		; WARM BOOT !!!
					; (never returns)
ACF1:	cmp	AL, 3B			; F1 scan code
	jnz	ACF2			; jump to next function
	[...]				; Alt-Ctrl-F1 function...

All the variants of `warmboot.com' I have seen use essentially the same idea.
I'm really nothing of an assembler-expert, so I dont know the difference
between
	jmp	F000:FFF0
and
	jmp	FFFF:0000
which is often used instead, it seems that both work (it's the same location
after all).

In any case, this is what you get when you strike Ctrl-Alt-Del...

So long,

Markus Fischer, Dpt. of Anthropology, Geneva

bsrdp@warwick.ac.uk (Hylton Boothroyd) (01/13/90)

In article <357@clover.warwick.ac.uk> bsrdp@warwick.ac.uk I wrote:
> > The int 19h vector is supposed to do a warm boot.
> ...
> the warm-start recipes that appear here every so often simply don't
> work for me.
>
> It remains a mystery how to replicate the warm start effect of
> Ctrl-Alt-Del.

Thanks to those who posted directly to me or here in this newsgroup I
now know:
  a) INT 19 is not the correct general route, and I cannot expect it to
     work,
  b) setting 0040:0072 to 1234hex and jumping to ffff:0000 is the
     standard IBM PC way to achieve a warm boot, and I can reasonably
     expect it to work,
  c) (b) will work only if the BIOS ROM created by a manufacturer for
     his particular machine emulates this particular feature of the IBM
     PC - it is nothing to do with how MSDOS works,
  d) the manufacturer of my XT clone arranged to test for 1234 in his
     BIOS ROM but by mistake included code that alters 0040:0072 before
     the test is reached!
  e) as a result of (d) my XT clone has no proper warm boot from
     Ctrl-Alt-Del - it just gives a cold boot.

I feel very foolish about (e). Evidently I have become so used to what
I am working with that I have long ago ceased to notice this flaw. But
this thread has at least made me explore it properly.

Hylton

bsrdp@warwick.ac.uk (Hylton Boothroyd) (01/17/90)

A sequel.

In article <361@clover.warwick.ac.uk> bsrdp@warwick.ac.uk (Hylton
Boothroyd) I wrote:
>   b) setting 0040:0072 to 1234hex and jumping to ffff:0000 is the
>      standard IBM PC way to achieve a warm boot, and I can reasonably
>      expect it to work,
and commented that it didn't work on my XT clone and looked like a
mistake in the BIOS ROM.

A few minutes ago I finally connected with the man who wrote the BIOS
back in 1985. The absence of a warm boot via ffff:0000 wasn't a mistake
- it was deliberate.  The aim of clone makers was to have XT
functionality with BIOS code that was manifestly different from IBM's
and therefore manifestly not in breach of copyright.  That required a
great deal of ingenuity, and ffff:0000 was left to give a cold boot.
There was a different point of entry, via the keyboard driver, for a
warm boot conditioned by 0040:0072.

Miracle. He had the BIOS printout still on his shelves. He quoted me the
jump address in my version of the ROM, and two minutes later I had a
warm reboot programme.

Hylton