使用 NASM 编写操作系统内核
我想知道编写在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如上所述,您的问题已在 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.