Google Groups

Re: Reboot the system


Rod Pemberton Mar 22, 2007 4:36 PM
Posted in group: alt.os.development

<danil...@gmail.com> wrote in message
news:1174596399.763645.322420@n59g2000hsh.googlegroups.com...
> How to make the system reboot?
> Does the system has an I/O port for rebooting?
>

I'm pretty sure I posted these before...  Anyway, these are the methods I
know of.  They all require either 1) port access privilege or 2) Ring 0
privilege.  If someone knows of others, please post.

1) Intel lidt method:
     a) disable NMI, (write 0x8D to port 0x70 (privileged), read port 0x71
(privileged) using 'in' and 'out' instructions)
     b) disable interrupts ('cli' instruction)
     c) lidt a null'd idt (write all 0's to idt and reload with 'lidt'
instruction, Ring 0 privilege)
     d) enable interrupts ('sti' instruction)
     e) call an interrupt (not using 'into' instruction, 64-bit obsolete)

2) IBM 8042 keyboard controller:
     a) disable NMI
     b) disable interrupts
  (a and b are _required_ to maintain a valid keyboard controller state
since BIOS doesn't reset keyboard controller logic)
     c) wait for keyboard controller ready (read port 0x64, wait for bit 1
to clear)
     d) write 0xFE to port 0x64 (privileged)
   (This method won't work for boards without a keyboard controller.)

3) IBM PS/2 fast reset
     a) disable NMI
     b) disable interrupts
     c) write 0x01 to port 0x92 (privileged) (0x03 fails on some
machines...)

4) Intel PCI chipset reset
     a) disable NMI
     b) disable interrupts
     c) write 0x02 to port 0xcf9 (privileged)
     d) write 0x06 to port 0xcf9 (privileged)

5) call BIOS
     a) switch cpu to RM (Ring 0 privilege)
     b) far call to FFFF:0000h.
     c) This may require setting values at 0472h and/or CMOS 0Fh.

6) Int 0x19
     a) switch cpu to RM (Ring 0 privilege)
     b) 'int 0x19' instruction
(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 'mystery' reasons.)

7) Int 0x18
    a) switch cpu to RM (Ring 0 privilege)
    b) 'int 0x18' instruction
(Some BIOS' will reset the computer via a call to this interrupt.)

Rod Pemberton