使用 NASM 编写操作系统内核

发布于 2024-09-02 19:48:48 字数 267 浏览 1 评论 0原文

我想知道编写在 NASM 上编译的简单内核的标准方法是什么?

为了更清楚地说明: 我能够通过以下方式定义代码块:

[segment code]
[segment .code]
segment code
segment .code

[section code]
[section .code]
section code
section .code

我需要知道执行此操作的标准方法是什么,以及它们之间有什么区别...

谢谢

I want to know what is the standard way for writing a -simple- kernel to be compiled on NASM?

To get it clearer:
I was able to define the code block with all the following ways:

[segment code]
[segment .code]
segment code
segment .code

[section code]
[section .code]
section code
section .code

I need to know what is the standard way to do that, And what is the difference between them...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

滥情稳全场 2024-09-09 19:48:48

如上所述,您的问题已在 NASM 文档中找到答案。

事实是......当您加载代码时,这些部分并没有多大意义。一个要加载的内核,需要一个完整的bootloader,而一个bootloader有512b来加载GDTr,使能A20,进入保护模式,跳转到_kmain。
请访问 OSDev.org 了解更多示例和信息。

Your question is answer in the NASM documentation, as stated above.

The truth is.. the sections do not mean verymuch when you load your code. A kernel to be loaded, needs a complete bootloader, and a bootloader has 512b to load GDTr, , enabling A20, entering protected mode, and jumping to _kmain.
Checkout OSDev.org for more examples, and information.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文