C库在x86 / x64汇编 [英] c library x86/x64 assembler
本文介绍了C库在x86 / x64汇编的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有用于装配在x86 / x64汇编字符串运算codeS?
Is there a C library for assembling a x86/x64 assembly string to opcodes?
例如code:
/* size_t assemble(char *string, int asm_flavor, char *out, size_t max_size); */
unsigned char bytes[32];
size_t size = assemble("xor eax, eax\n"
"inc eax\n"
"ret",
asm_x64, &bytes, 32);
for(int i = 0; i < size; i++) {
printf("%02x ", bytes[i]);
}
/* Output: 31 C0 40 C3 */
我已经看过 asmpure ,但它需要在非Windows的机器上运行的修改。
I have looked at asmpure, however it needs modifications to run on non-windows machines.
我其实都需要一个汇编和反汇编,有一个库,它提供了?
I actually both need an assembler and a disassembler, is there a library which provides both?
推荐答案
当然 - 您可以使用 LLVM 。严格来说,这是C ++的,但也有是C接口。它会同时处理装配和拆卸你正在尝试做了。
Sure - you can use llvm. Strictly speaking, it's C++, but there are C interfaces. It will handle both the assembling and disassembling you're trying to do, too.
这篇关于C库在x86 / x64汇编的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文