Page 1 of 1

Rebooting the computer

Posted: Wed Apr 15, 2009 2:08 pm
by imate900
(I apperantly test my OSes in VirtualBox)

I do:

Code: Select all

int 0x19
but I can't reboot the machine. Can you help me? Is there some special way to do this?

Re: Rebooting the computer

Posted: Wed Apr 15, 2009 2:14 pm
by JohnnyTheDon
The easiest (and most effective) way is through the keyboard controller

Re: Rebooting the computer

Posted: Wed Apr 15, 2009 2:16 pm
by kay10
You could try something like this:

Code: Select all

db 0xEA
dw 0x0000
dw 0xFFFF
This is a far jump to a BIOS function to reboot the system when I'm right.

EDIT: too slow...

EDIT 2: I think this method might only work in real mode

Re: Rebooting the computer

Posted: Wed Apr 15, 2009 2:26 pm
by imate900
JohnnyTheDon wrote:The easiest (and most effective) way is through the keyboard controller
Now, my OS locks up when I do "reboot". I can send you the source code and floppy I use. In fact, I'll attach it:

Re: Rebooting the computer

Posted: Wed Apr 15, 2009 2:28 pm
by imate900
kay10 wrote:You could try something like this:

Code: Select all

db 0xEA
dw 0x0000
dw 0xFFFF
This is a far jump to a BIOS function to reboot the system when I'm right.

EDIT: too slow...

EDIT 2: I think this method might only work in real mode
I love you!!!! It reboots!

EDIT: my OS is real mode.

Re: Rebooting the computer

Posted: Wed Apr 15, 2009 2:44 pm
by earlz
I always thought the easiest way to reboot(in protected mode) was to trash the IDT, then divide by zero.. triple-fault==reboot.

Re: Rebooting the computer

Posted: Thu Apr 16, 2009 4:46 am
by jal
earlz wrote:I always thought the easiest way to reboot(in protected mode) was to trash the IDT, then divide by zero.. triple-fault==reboot.
The easiest way to stop a car is to run it into a tree. Not recommended either.


JAL

Re: Rebooting the computer

Posted: Thu Apr 16, 2009 5:27 am
by Love4Boobies
kay10 wrote:You could try something like this:

Code: Select all

db 0xEA
dw 0x0000
dw 0xFFFF
This is a far jump to a BIOS function to reboot the system when I'm right.

EDIT: too slow...

EDIT 2: I think this method might only work in real mode
That's not a function to reboot the BIOS, it's the BIOS itself. That's what gets ran once you turn your PC on. However, it might not be a good idea to do things this way; The BIOS may expect a certain state for hardware and you're not going to have that by jumping into the BIOS initialization code. It's sort of like re-executing the MBR (provided it's still in the rightful memory location); you'll still have the same video mode (say graphics), etc. Some of the things probably won't affect you very much (the video mode is likely to change properly unless you're using DOS in which case you won't see anything).

The safest way is using ACPI or APM if they're there. If you want to use black magic, triple fault is also an easy ticket to reboot :)