halt (-p)and reboot the system in PM

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
njmarshal

halt (-p)and reboot the system in PM

Post by njmarshal »

HELLO ,everyone!
a nice day!
Now I wanna to add my os the function of halt (halt -p) and reboot !(but I dont konw how to do ?
I found some usefull information ,and I also need yoiur help

can anyone give me some code in gcc or nasm (gcc will be better) in this filed!

thanks ahead !
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:halt (-p)and reboot the system in PM

Post by Pype.Clicker »

njmarshal wrote: HELLO ,everyone!
a nice day!
lucky you! here i have grey sky and wet floor.
Now I wanna to add my os the function of halt (halt -p) and reboot !(but I dont konw how to do ?
I found some usefull information ,and I also need yoiur help

can anyone give me some code in gcc or nasm (gcc will be better) in this filed!

thanks ahead !
there are several methods for rebooting, including
[*]load a 0-sized IDT and issue an interrupt (that'll triple fault and reset)
[*] the 'pulse RESET line from 8042 controller', which should be documented at Bona Fide

In order to shutdown the system, you need to use the APM/ACPI (preferably calling the BIOS). There should be code for that in The Mobius

Using INT15h (according to Tim's code which appears to be Menuet code)
  • disconnect interface (ax=5304, bx=0)
  • connect real mode interface (ax=5301,bx=0)
  • enable power management (ax=5308, cx=bx=1)
  • enable device power management(ax=530D, cx=bx=1)
  • engage power management (ax=530f,cx=bx=1)
  • driver version (ax=530E, bx=0, cx=102)
  • set power state(ax=5307, bx=1, cx=3)
Post Reply