使用nasm关闭计算机 [英] Shutting down computer with nasm

查看:85
本文介绍了使用nasm关闭计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能通过nasm关闭或关闭计算机的电源(有区别吗?).我知道您可以使用它来重新启动:

Is it possible to shut down or kill the power (is there a difference?) to a computer from nasm. I know you can use this to reboot:

mov al, 0xFE
out 0x64, al

有等同于关机的功能吗? 我正在制作自己的16位操作系统.

Is there an equivalent for shutting down? I am making my own 16 bit OS.

推荐答案

您所拥有的代码不能保证正常工作.它取决于两个事实:

The code you have is not guaranteed to work. It relies on two facts:

  • 操作系统将物理IO内存映射到进程内存空间.
  • 机器具有BIOS.

两者都不是真的.

以编程方式重新启动或关闭计算机的唯一可靠方法是调用相应的OS API.

The only reliable way to reboot or shutdown the machine programatically is to call the corresponding OS API.

调用OS API的一种替代方法(因为您正在编写 ,因此需要使用该API :-)"是使用ACPI.并非所有机器都支持ACPI,但有四个版本.

An alternative to calling the OS API (which you need, since you are writing the OS :-)) is using ACPI. Not all machines support ACPI an of these that do, there's at four different ACPI revisions.

http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface?wasRedirected=true
http://www.acpi.info

这篇关于使用nasm关闭计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆