组装编译器如何知道在哪里放置功能?
组装编译器如何知道在哪里放置标签/功能?
我一直在考虑这个问题,但找不到答案。
示例代码:
Func1:
mov %ax, 0x100
jmp Func1
如何知道将其放置在.bin/.o文件中的位置?
否则它只是跳到功能的结尾。
我尝试创建自己的操作代码只是为了使我的模拟器跳过功能。但是,当需要称呼它时,它会以偏移 + 1的形式跳到它来跳过功能操作代码。 \
要清楚,我正在制作自己的仿真器和编译器,以了解更多处理器的工作方式。我可以创建简单的编译器,但是在某个时候,我必须添加跳跃,有条件的跳跃和比较。
我在Python中创建模拟器。
如果有人知道答案,请回答。我为我的英语不好而道歉。
How do assembly compilators know where to place labels/functions?
I have been thinking about this problem and I couldn't find the answer.
Example code:
Func1:
mov %ax, 0x100
jmp Func1
How does it know where to place it in good position in .bin/.o file?
Or it just jumps to end of the Function.
I tried to create my own operation code just to make my emulator skip the function. But when it needs to be called it gets jumped to it with offset + 1 to skip the function operation code. \
To be clear, I'm making my own emulator and compilator to understand more how processors work. I can create simple compilators but at some point I must add jumps, conditional jumps and comparisons.
I create my emulator in python.
If anyone knows answer please answer. And I apologise for my bad english.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论