使用ASM将文件加载到内存中?

发布于 2024-12-01 13:19:14 字数 500 浏览 1 评论 0原文

我正在开发一个小型 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 技术交流群。

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

发布评论

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

评论(2

那一片橙海, 2024-12-08 13:19:14

详细信息将取决于您的硬件架构和文件系统。您能给我们提供更多详细信息吗?

听起来您正在开发自己的操作系统。特别是因为您已经用“引导加载程序”标记了您的问题。或者您希望在其他操作系统中执行此操作?

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?

迟到的我 2024-12-08 13:19:14

如果不进行系统调用,则无法从用户态执行此操作。您也不知道“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).

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