assembly

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

坚强是说给别人听的谎言 提交于 2020-11-27 04:58:29
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

我们两清 提交于 2020-11-27 04:57:52
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

核能气质少年 提交于 2020-11-27 04:57:49
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

孤人 提交于 2020-11-27 04:57:13
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

x86 assembly programming loops with ecx and loop instruction versus jmp + j<condition>

心不动则不痛 提交于 2020-11-27 04:57:10
问题 i'm currently learning x86 assembly language and wondered what is the better way for implementing loops. One way would be to mov a value to ecx register and use the loop instruction and the other way would be using a jmp instruction and then comes the loop body and then a conditional jumping eventually to the beginning of the loop body. I guess the first one will has a better readability but other then that i don't know why to use it. 回答1: When you mention jmp+body+test, I believe you are

Are instruction set and assembly language the same thing?

房东的猫 提交于 2020-11-25 06:06:59
问题 I was wondering if instruction set and assembly language are the same thing? If not, how do they differ and what are their relations? Thanks and regards! 回答1: I think everyone is giving you the same answer. Instruction set is is the set (as in math) of all instructions the processor can execute or understand. Assembly language is a programming language. Let me try some examples based on some of the questions you are asking. And I am going to be jumping around from processor to processor with

Are instruction set and assembly language the same thing?

岁酱吖の 提交于 2020-11-25 06:05:46
问题 I was wondering if instruction set and assembly language are the same thing? If not, how do they differ and what are their relations? Thanks and regards! 回答1: I think everyone is giving you the same answer. Instruction set is is the set (as in math) of all instructions the processor can execute or understand. Assembly language is a programming language. Let me try some examples based on some of the questions you are asking. And I am going to be jumping around from processor to processor with

What's the best way to remember the x86-64 System V arg register order?

一世执手 提交于 2020-11-25 03:41:39
问题 I often forget the registers that I need to use for each argument in a syscall, and everytime I forget I just visit this question. The right order for integer/pointer args to x86_64 user-space function calls is: %rdi , %rsi , %rdx , %rcx , %r8 and %r9 . (with variadic functions taking AL = the number of FP args, up to 8) Or for system calls, %rax (syscall call number), and same args except %r10 instead of %rcx . What's the best way to remember these registers instead of google this question

Subtracting registers with an LEA instruction?

岁酱吖の 提交于 2020-11-25 02:22:44
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm

Subtracting registers with an LEA instruction?

老子叫甜甜 提交于 2020-11-25 02:22:26
问题 Does the LEA instruction support negative displacement? mov rax, 1 lea rsi, [rsp - rax] When I use the above code in my asm file I got the error: $ nasm -f macho64 test.asm $ error: invalid effective address I Know that we can do pointer arithmetic like this in C: void foo(char *a, size_t b) { *(a - b) = 1; } then I assume that: lea rsi, [rsp - rax] will work. And I also try to see what the GCC compiler do by using: $ gcc -S foo.c // foo.c has the function foo(above) in it but my asm