如何制作可启动程序? [英] How to make a bootable program?

查看:97
本文介绍了如何制作可启动程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,这个问题似乎很奇怪,但是让我们说我编译了:

So, the question might seem strange, but let's say that I compile:

int main(void)
{
    int x = 3;
    int y = 4;

    int z = x + y;
}

是否可以使CPU如此运行?如何?例如,这是否允许我写监视器? (如果我没记错的话,内存中有一些地方可以写一些东西来显示.)

Is it possible to make the CPU run just that? How? For example, would this allow me to write to the monitor? (If I remember it correctly, there are places in memory in which you can write stuff to be displayed.)

推荐答案

对于您的程序,除了启动它之外,它不依赖任何操作系统服务.如果要另外进行输入或输出,则几乎可以肯定要依靠操作系统来执行I/O.

In the case of your program, it does not rely on any operating system services other than getting it started. If it were to additionally do input or output, it would almost certainly rely on the operating system to perform the i/o.

如果您想用自己的代码替换操作系统,则可以这样做.存在简约的操作系统和程序加载器.但是,是的,您有很多东西要学习.

If you want to replace the operating system with your own code, then you could well do it. Minimalistic operating systems and program loaders exist. But yes, you have a lot to learn.

这篇关于如何制作可启动程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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