From: ramesh@utdallas.edu (R. Ramesh) Subject: Re: Reboot patch Date: Fri, 6 Mar 1992 16:45:52 GMT
In article <1992Mar6.082511.724@colorado.edu>, drew@cs.colorado.edu (Drew Eckhardt) writes:
|> I finally got fed up enough with the reboot code in Linux since day one,
|> which would never work on my system. Now, in real mode, or v8086 mode,
|> a far jump to ffff:0 always worked right, irregardless of A20 or whatever
|> else was going on, and on every compatable in the world.
|>
|> This business with the PPI chip, A20, and reset never seemed to work. So, I
|> switched to the real mode method. What my patch does is disable paging,
|> kick it back into real mode, and do a far jump to ffff:0.
|>
|> How it works :
|>
|> When we switch to real mode, eip may be truncated. So, _reboot is within
|> the first 64K (head.s). reboot in keyboard.S jumps there, while still
|> in protected mode. In _reboot,I turn off paging, and protection with a mov to
|> CR0, and then now in realmode, I jump to ffff:0 with a real mode far jump.
|> That's it.
|>
|> Here are the cdiffs :
|>
|> *** head.s Fri Jan 10 21:50:17 1992
|> --- head.s+ Fri Mar 6 01:09:04 1992
|> ***************
|> *** 142,147 ****
|> --- 142,155 ----
|> L6:
|> jmp L6 # main should never return here, but
|> # just in case, we know what happens.
|> + .globl _reboot
|> + _reboot:
|> + cli # we don't have a real mode IDT at 0x00000000
|> + movl %cr0, %eax # get cr0, so we can disable paging and protection
|> + andl $7ffffffe, %eax # disable paging and protection
|> + movl %eax, %cr0
|> + .byte 0xea # real mode far jump
|> + .word 0x0000, 0xffff # to reboot address
|>
|> /* This is the default interrupt "handler" :-) */
|> int_msg:
|>
|>
|> *** keyboard.S Fri Mar 6 00:44:03 1992
|> --- keyboard.S+ Fri Mar 6 00:43:50 1992
|> ***************
|> *** 659,664 ****
|> reboot:
|> call kb_wait
|> movw $0x1234,0x472 /* don't do memory check */
|> ! movb $0xfc,%al /* pulse reset and A20 low */
|> ! outb %al,$0x64
|> ! die: jmp die
|> --- 659,663 ----
|> reboot:
|> call kb_wait
|> movw $0x1234,0x472 /* don't do memory check */
|> ! jmp _reboot
|> !
Thank much in advance Drew (I think it should work). I ask all of you who can
to try this code right away. If this works in all cases (I think it should, my
reading of Crawford and Drew's reply to my questions seem to suggest this)
then we can make it a standard in Linux (if not 0.13/0/95 in the next version).
I have a 486/33 from Gateway and I will try this on that machine and report if
there is a problem. I would appreciate if others having different m/c's try
the same.
Once again thanks Drew.
Ramesh