Hi,
How can you turn off a computer from protected mode in C?
Thanks,
Stephen
Shutting down the computer
Re:Shutting down the computer
Hi,
For APM there's a protected mode interface (16 bit and/or 32 bit) that's supported by some BIOSs, but not all. This option probably can't be done with C alone.
ACPI is an overcomplicated mess, requiring an interpretter for it's own OOP language (AML). It should be possible to do this all in C though.
Direct hardware/IO depends on the motherboard/chipset, so you'd heaps of "motherboard drivers" - one for each motherboard.
Then there's computers that lack the needed hardware, and therefore don't have any method of turning the power off (e.g. Pentium and older computers).
Cheers,
Brendan
There's 3 options - APM, ACPI and direct hardware/IO instructions.Stephen wrote:How can you turn off a computer from protected mode in C?
For APM there's a protected mode interface (16 bit and/or 32 bit) that's supported by some BIOSs, but not all. This option probably can't be done with C alone.
ACPI is an overcomplicated mess, requiring an interpretter for it's own OOP language (AML). It should be possible to do this all in C though.
Direct hardware/IO depends on the motherboard/chipset, so you'd heaps of "motherboard drivers" - one for each motherboard.
Then there's computers that lack the needed hardware, and therefore don't have any method of turning the power off (e.g. Pentium and older computers).
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re:Shutting down the computer
Thats ok, I can use NASM code as well.Brendan wrote:For APM there's a protected mode interface (16 bit and/or 32 bit) that's supported by some BIOSs, but not all. This option probably can't be done with C alone.
Re:Shutting down the computer
There is also the "Power button" method witch work on all computers
Re:Shutting down the computer
Yeah, but the trick is to get the software to push the button. ;Daladdin wrote: There is also the "Power button" method witch work on all computers
Re:Shutting down the computer
You can also reprogram what that button does using ACPI (not sure about APM) so it could open the painting program or some other weird thing instead...
Re:Shutting down the computer
hi,
if it helps anyone here is a reboot
if it helps anyone here is a reboot
Code: Select all
void reboot()
{
volatile unsigned char good = 0x02;
while ((good & 0x02) != 0)
good = inportb(0x64);
outportb(0x64, 0xFE);
for(;;);
}
Re:Shutting down the computer
Thanks, but I already have a reboot. I was kinda hoping that it would be that simple to shut down the computer
-Stephen
-Stephen