简体   繁体   English

用C语言编写的汇编代码是什么?

[英]what is this assembly code in C?

I have some assembly code below that I don't really understand. 我下面有一些我不太了解的汇编代码。 My thoughts are that it is meaningless. 我的想法是,这毫无意义。 Unfortunately I can't provide any more instruction information. 不幸的是,我无法提供更多说明信息。 What would the output in C be? C的输出是什么?

0x1000: iretd   
0x1001: cli 
0x1002: in  eax, dx
0x1003: inc byte ptr [rdi]
0x1005: add byte ptr [rax], al
0x1007: add dword ptr [rbx], eax
0x1009: add byte ptr [rax], al
0x100b: add byte ptr [rdx], 0
0x100e: add byte ptr [rax], al

Thanks 谢谢

The first four bytes (if I did reconstruct them correctly) form 32 bit value 0xFEEDFACF . 前四个字节(如果我正确地重构了它们)形成32位值0xFEEDFACF

Putting that into google led me to: 将其放入Google导致我:

https://gist.github.com/softboysxp/1084476#file-gistfile1-asm-L15 https://gist.github.com/softboysxp/1084476#file-gistfile1-asm-L15

%define MH_MAGIC_64                 0xfeedfacf

Aren't you by accident disassembling Mach-o x64 executable from Mac OS X as raw machine code, instead of reading meta data of file correctly, and disassembling only code section? 您不是偶然将Mac OS X的Mach-o x64可执行文件作为原始机器代码反汇编了,而不是正确地读取文件的元数据并仅反汇编了代码部分吗?

PS in questions like this one, rather include also the source machine code data, so experienced people may check disassembly by targetting different platform, like 32b x86 or 16b real mode code, or completely different CPU, which may help in case you would mistakenly treat machine code with wrong target platform disassembly. PS之类的问题,而不是还包括源机器代码数据,因此有经验的人可能会通过针对不同的平台(例如32b x86或16b实模式代码或完全不同的CPU)来检查反汇编,这可能会在您错误对待的情况下提供帮助目标平台拆卸错误的机器代码。 I had to first assemble your disassembly to see the raw bytes. 我必须首先汇编您的反汇编才能看到原始字节。

iretd is "return from interrupt", cli is "clear interrupt flag" which means disable all maskable interrupts. iretd是“从中断返回”, cli是“清除中断标志”,这意味着禁用所有可屏蔽中断。 The C language does not understand the concept of an interrupt, so it is unlikely that this was compiled from C. In fact, this isn't a single complete fragment of code. C语言不了解中断的概念,因此不太可能是从C编译的。实际上,这不是一个完整的代码片段。

Also add byte ptr [rdx], 0 is adding 0 to a value which doesn't make sense to me unless it is the result of an unoptimised compilation or the result of disassembling something that isn't code. 还要add byte ptr [rdx], 0将0加到一个对我来说没有意义的值,除非这是未经优化的编译结果或反汇编非代码内容的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM