使用ASM将文件加载到内存中?
我正在开发一个小型 ASM 程序,需要从以下位置加载另一个平面二进制文件 磁盘/软盘/硬盘,然后开始执行它。我似乎不知道如何扫描 本地文件夹或系统文件(例如 main.bin),然后跳转到代码的 main: 部分。
so for example we have a small file called main.bin, which is a
compiled flat binary of nasm code. there is a label called main:
what i need to do is find the file main.bin and load into memory
at address 0x0500, then jmp/give control to the loaded program and
have it start working at the main: label in the code.
如果有人可以帮助我,我将不胜感激。感谢您的阅读:)
i'm working on a small ASM program that needs to load another flat binary from
the disk/floppy/hdd w/e, and then start executing it. i can't seem to figure out how to scan
the local folder, or system for a file say main.bin, and then jump to the main: part of the code.
so for example we have a small file called main.bin, which is a
compiled flat binary of nasm code. there is a label called main:
what i need to do is find the file main.bin and load into memory
at address 0x0500, then jmp/give control to the loaded program and
have it start working at the main: label in the code.
if anyone can help me with this, it would be appreciated. thanks for reading :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
详细信息将取决于您的硬件架构和文件系统。您能给我们提供更多详细信息吗?
听起来您正在开发自己的操作系统。特别是因为您已经用“引导加载程序”标记了您的问题。或者您希望在其他操作系统中执行此操作?
The details will depend on your hardware architecture and on your file system. Can you give us some more details?
Sounds like you're developing your own operating system. Particularly since you've tagged your question with "bootloader". Or are you hoping to do this within some other operating system?
如果不进行系统调用,则无法从用户态执行此操作。您也不知道“main”在平面二进制文件中的位置(目标文件将是一个不同的故事)。
You can't do this from user land without making a system call. You also won't know where 'main' is on a flat binary (an object file would be a different story).