如果 JMP 指令在 NASM 中失败,运行代码?
我正在写一个引导加载程序,正在考虑如何跳转到内核。我看到人们使用jmp 0x8000
(或内核所在的任何地址)来加载它。但是如果 JMP 由于某种原因失败(比如内核中没有任何内容,或者当我们处于 32 位模式时内核是 64 位),我怎样才能让 NASM 运行一些不同的代码呢?例如,它会尝试 JMP 到内核地址,但如果那里的任何内容都无法/不会运行,它可能会打印一条消息,指出无法加载内核?
I'm writing a bootloader and was thinking about how to jump to the kernel. I saw that people use jmp 0x8000
(or whatever address the kernel is at) in order to load it. but if the JMP fails for whatever reason (like there being nothing at the kernel, or the kernel being 64 bit when we are in 32 bit mode,) how could I make NASM run some different code instead? for example, It would attempt a JMP to the kernel address but in the case that whatever is there can't/won't run, it could print a message stating that the kernel could not be loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论