Search code examples
capioperating-systemshutdown

shutting down an OS without using API's


I was trying to add a shutdown feature to my home-made OS , but I don't really have such API yet . I was wondering how does the OS's terminates the power?


Solution

  • Your low level code to shut down the hardware is going to depend on the architecture. For shutting down an i386 device with a BIOS, INT 15h is the vector that is eventually used by OS monitors.

    You should consider APM and ACPI schemes for power management, graceful shutdown of peripherals with power management, and poweroff considerations in multi-processor systems.

    I expect that others will give answers leading you to examine Linux APM and ACPI code. In i386 kernels there is a very straightforward apm_power_off() function in arch/x86/kernel/apm_32.c which does an INT 15 shutdown.