随笔分类 -  assembly

摘要:int main(){ int a = 1; int c = 2; int b; __asm { MOV EAX, a; MOV EBX, c; ADD EAX, EBX; MOV b, EAX; } cout << "b = " << b << endl; cout << "a = " << a 阅读全文
posted @ 2019-07-18 20:30 MoonXu 阅读(313) 评论(0) 推荐(0) 编辑
摘要:黑客工具 hacker disassembler engine download IDApro 阅读全文
posted @ 2019-07-17 17:24 MoonXu 阅读(216) 评论(0) 推荐(0) 编辑
摘要:sudo apt install nasm 64bit: nasm -f elf64 test.asm ld -s -o test test.o 32bit: nasm -f elf32 test.asm ld -m elf_i386 -s -o test test.o 阅读全文
posted @ 2019-07-17 16:58 MoonXu 阅读(291) 评论(0) 推荐(0) 编辑
摘要:/usr/include/x86_64-linux-gnu/asm 阅读全文
posted @ 2019-07-17 15:40 MoonXu 阅读(729) 评论(0) 推荐(0) 编辑
摘要:汇编指令都是以.开头 .align integer, pad //pad是用于填充的一般为空或0The .align directive causes the next data generated to be aligned modulo integer bytes.Integer must be 阅读全文
posted @ 2019-07-10 15:28 MoonXu 阅读(747) 评论(0) 推荐(0) 编辑
摘要:.section .data.section .text.global _start.global fun_start: pushl $5 call fun addl $4, %esp movl %eax, %ebx movl $1, %eax int $0x80.type fun, @functi 阅读全文
posted @ 2019-06-27 23:32 MoonXu 阅读(162) 评论(0) 推荐(0) 编辑
摘要:.section .data.section .text.global _start_start: pushl $5 pushl $4 call fun addl $8, %esp pushl %eax pushl $7 pushl $2 call fun addl $8, %esp popl %e 阅读全文
posted @ 2019-06-27 18:18 MoonXu 阅读(227) 评论(0) 推荐(0) 编辑
摘要:as --32 --gstabs -o power.o power.s ld -m elf_i386 -o power power.s 执行 as 命令时带上参数 --gstabs 可以告诉汇编器在生成的目标代码中加上符号表,同时需要注意的是, 在用 ld 命令进行链接时不要加上 -s 参数,否则目 阅读全文
posted @ 2019-06-27 09:53 MoonXu 阅读(372) 评论(0) 推荐(0) 编辑
摘要:sudo apt-get install gcc-multilib sudo apt-get install g++-multilib gcc -m32 -S a.c -o a.s gcc -m64 -S a.c -o a1.s 阅读全文
posted @ 2019-06-24 16:41 MoonXu 阅读(225) 评论(0) 推荐(0) 编辑
摘要:16个通用寄存器: 阅读全文
posted @ 2019-06-04 15:22 MoonXu 阅读(163) 评论(0) 推荐(0) 编辑
摘要:.long expression1, expression2, ..., expressionNThe .long directive generates a long integer (32-bit, two's complement value) for eachexpression into 阅读全文
posted @ 2019-05-28 18:26 MoonXu 阅读(104) 评论(0) 推荐(0) 编辑
摘要:Assembler Directives .align integer, padThe .align directive causes the next data generated to be aligned modulo integer bytes.Integer must be a posit 阅读全文
posted @ 2019-05-28 17:10 MoonXu 阅读(318) 评论(0) 推荐(0) 编辑
摘要:1: / define numeric label "1"one: / define symbolic label "one"/ ... assembler code ...jmp 1f / jump to first numeric label "1" defined/ after this in 阅读全文
posted @ 2019-05-28 10:46 MoonXu 阅读(298) 评论(0) 推荐(0) 编辑
摘要:•1st parameter: EBX • 2nd parameter: ECX • 3rd parameter: EDX • 4th parameter: ESI • 5th parameter: EDI 阅读全文
posted @ 2019-05-20 17:39 MoonXu 阅读(221) 评论(0) 推荐(0) 编辑
摘要:.datax: .long 1 .long 5 .long 8 .long 13sum: .long 0 .text.global _start_start: movl $4, %eax movl $0, %ebx movl $x,%ecxtop: addl (%ecx), %ebx addl $4 阅读全文
posted @ 2019-05-20 17:19 MoonXu 阅读(941) 评论(0) 推荐(0) 编辑
摘要:1.编译时加-pg选项,例如:gcc -pg test.c-o test_gprof。其中test后的_gprof一定要加上。会生成gmon.out。 2.运行程序。gprof test_gprof gmon.out 阅读全文
posted @ 2019-03-30 17:09 MoonXu 阅读(219) 评论(0) 推荐(0) 编辑
摘要:as -g --32 -o hello.o hello.s ld -m elf_i386 -o hello hello.o gdb hello 阅读全文
posted @ 2019-03-19 14:17 MoonXu 阅读(155) 评论(0) 推荐(0) 编辑
摘要:1.as -o power.o power.s ld -o power power.o ./power 段错误 2.as --32 power.s-o power.o ld -m elf_i386 power.o -o power 正确运行 阅读全文
posted @ 2019-03-19 14:15 MoonXu 阅读(302) 评论(0) 推荐(0) 编辑
摘要:mkdir /tools/binutils -p //新建一个安装目录 .configure prefix=/tools/binutils make sudo make install binutils工具就安装到/tools/binutils中去了 阅读全文
posted @ 2019-03-18 23:31 MoonXu 阅读(3510) 评论(0) 推荐(0) 编辑
摘要:invalid instruction suffix for `push' 错误原因是,在64位系统和32位系统的as命令对于某些汇编指令的处理支持不一样造成的 在代码头部添加.code32即可。 阅读全文
posted @ 2019-03-18 20:57 MoonXu 阅读(396) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示