草庐IT

ASSEMBLY

全部标签

C程序编译ASM文件的命令

这个问题在这里已经有了答案:32-bitabsoluteaddressesnolongerallowedinx86-64Linux?(1个回答)关闭4年前。使用à64位Linux系统并使用NASM。我也在尝试将我的ASM(hello.asm)文件与C文件(main.c)链接并编译为执行文件。我创建了一个ASM文件,使用printHello函数通过printf打印“Hello”。externprintf,exitsection.dataformatdb"Hello",10,0section.textglobalprintHelloprintHello:subrsp,8movrsi,0x1

linux - syscall如何知道要跳转到哪里?

Closed.Thisquestionneedstobemorefocused。它当前不接受答案。想要改善这个问题吗?更新问题,使它仅关注editingthispost的一个问题。1年前关闭。ImprovethisquestionLinux如何确定要通过syscall执行的另一个进程的地址?喜欢这个例子吗?movrax,59movrdi,progNamesyscall澄清一下,我的问题似乎有点困惑,我要问的是syscall如何工作,与传递的寄存器或参数无关。当调用其他进程时,如何知道要跳转,返回的位置。 最佳答案 系统调用sysca

linux - syscall如何知道要跳转到哪里?

Closed.Thisquestionneedstobemorefocused。它当前不接受答案。想要改善这个问题吗?更新问题,使它仅关注editingthispost的一个问题。1年前关闭。ImprovethisquestionLinux如何确定要通过syscall执行的另一个进程的地址?喜欢这个例子吗?movrax,59movrdi,progNamesyscall澄清一下,我的问题似乎有点困惑,我要问的是syscall如何工作,与传递的寄存器或参数无关。当调用其他进程时,如何知道要跳转,返回的位置。 最佳答案 系统调用sysca

c - 在 AT&T IA-32 Linux 汇编程序 (gas) 上拆分字符串

.section.dataastring:.asciz"11010101"format:.asciz"%d\n".section.text.globl_start_start:xorl%ecx,%ecxmovbastring(%ecx,1),%almovzbl%al,%eaxpushl%eaxpushl$formatcallprintfaddl$8,%espmovl$1,%eaxmovl$0,%ebxint$0x80假设我想分解.asciz字符串1101011并得到它的第一个。我该怎么做?上面的代码不工作,它打印49或其他东西。 最佳答案

c - 在 AT&T IA-32 Linux 汇编程序 (gas) 上拆分字符串

.section.dataastring:.asciz"11010101"format:.asciz"%d\n".section.text.globl_start_start:xorl%ecx,%ecxmovbastring(%ecx,1),%almovzbl%al,%eaxpushl%eaxpushl$formatcallprintfaddl$8,%espmovl$1,%eaxmovl$0,%ebxint$0x80假设我想分解.asciz字符串1101011并得到它的第一个。我该怎么做?上面的代码不工作,它打印49或其他东西。 最佳答案

c - 使用 ARM 内联汇编在没有 libc 的情况下进行系统调用

这个问题在这里已经有了答案:Can_startbethethumbfunction?(3个答案)关闭8年前。我想在不使用libc的情况下编写一个小型独立可执行文件。模拟一些libc函数我需要的是具有使用内联汇编进行系统调用的函数:intsyscall(inta,...){return__asm__volatile(/*DOSTHHERE*/);}我正在使用Linux和ARM处理器。编辑:找到解决方案:intsyscall(intn,...){return__asm__volatile("movr7,r0\nmovr0,r1\nmovr1,r2\nmovr2,r3\nswi#1\n");

c - 使用 ARM 内联汇编在没有 libc 的情况下进行系统调用

这个问题在这里已经有了答案:Can_startbethethumbfunction?(3个答案)关闭8年前。我想在不使用libc的情况下编写一个小型独立可执行文件。模拟一些libc函数我需要的是具有使用内联汇编进行系统调用的函数:intsyscall(inta,...){return__asm__volatile(/*DOSTHHERE*/);}我正在使用Linux和ARM处理器。编辑:找到解决方案:intsyscall(intn,...){return__asm__volatile("movr7,r0\nmovr0,r1\nmovr1,r2\nmovr2,r3\nswi#1\n");

linux - 在 i386 的 linux 内核 2.6.11 中,此内联汇编 (:"0"(THREAD_SIZE - 1)) 的含义是什么

在do_IRQ中可以找到如下代码!#ifdefCONFIG_DEBUG_STACKOVERFLOW/*Debuggingcheckforstackoverflow:istherelessthan1KBfree?*/{longesp;__asm____volatile__("andl%%esp,%0":"=r"(esp):"0"(THREAD_SIZE-1));if(unlikely(esp我没看懂这个asm汇编的意思asm_volatile_("andl%%esp,%0":"=r"(esp):"0"(THREAD_SIZE-1));THREAD_SIZE-1意味着什么?我记得括号里的符

linux - 在 i386 的 linux 内核 2.6.11 中,此内联汇编 (:"0"(THREAD_SIZE - 1)) 的含义是什么

在do_IRQ中可以找到如下代码!#ifdefCONFIG_DEBUG_STACKOVERFLOW/*Debuggingcheckforstackoverflow:istherelessthan1KBfree?*/{longesp;__asm____volatile__("andl%%esp,%0":"=r"(esp):"0"(THREAD_SIZE-1));if(unlikely(esp我没看懂这个asm汇编的意思asm_volatile_("andl%%esp,%0":"=r"(esp):"0"(THREAD_SIZE-1));THREAD_SIZE-1意味着什么?我记得括号里的符

Linux 64 位上下文切换

在32位模式下的switch_to宏中,在调用__switch_to函数之前执行了如下代码:asmvolatile("pushfl\n\t"/*saveflags*/\"pushl%%ebp\n\t"/*saveEBP*/\"movl%%esp,%[prev_sp]\n\t"/*saveESP*/\"movl%[next_sp],%%esp\n\t"/*restoreESP*/\"movl$1f,%[prev_ip]\n\t"/*saveEIP*/\"pushl%[next_ip]\n\t"/*restoreEIP*/\__switch_canary\"jmp__switch_to\n