Assembly

Assembly language (asm) programming questions. BE SURE TO ALSO TAG with the processor and/or instruction set you're using, as well as the assembler. WARNING: For .NET assemblies, use the tag [.net-assembly] instead. For Java ASM, use the tag [java-bytecode-asm] instead.

53 votes
4 answers
1.3K views
What is the difference between native code, machine code and assembly code?

I'm confused about machine code and native code in the context of .NET languages. What is the difference

avatar
Deedee
0 1 0 9
asked 07 September, 2021
65 votes
4 answers
1.7K views
Why does Windows64 use a different calling convention from all other OSes on x86-64?

AMD has an ABI specification that describes the calling convention to use on x86-64. All OSes follow it, excep

avatar
Rufus
0 1 0 9
asked 07 September, 2021
55 votes
5 answers
2.9K views
What is the function of the push / pop instructions used on registers in x86 assembly?

When reading about assembler I often come across people writing that they push a certain register of the proce

avatar
Kisha
0 1 0 9
asked 07 September, 2021
61 votes
8 answers
2.3K views
`testl` eax against eax?

I am trying to understand some assembly. The assembly as follows, I am interested in the testl line: 000319d

avatar
Winford
0 1 0 9
asked 07 September, 2021
50 votes
4 answers
829 views
What are CFI directives in Gnu Assembler (GAS) used for?

There seem to be a .CFI directive after every line and also there are wide varities of these ex.,.cfi_startpro

avatar
Royal
0 1 0 9
asked 07 September, 2021
61 votes
10 answers
681 views
How to view the assembly behind the code using Visual C++?

I was reading another question pertaining the efficiency of two lines of code, and the OP said that he looked

avatar
Cortez
0 1 0 9
asked 07 September, 2021
62 votes
5 answers
1.4K views
Purpose of ESI & EDI registers?

What is the actual purpose and use of the EDI & ESI registers in assembler? I know they are used for stri

avatar
Margo
0 1 0 9
asked 07 September, 2021
51 votes
8 answers
2.3K views
What is the purpose of XORing a register with itself?

xor eax, eax will always set eax to zero, right? So, why does MSVC++ sometimes put it in my executable

avatar
Omar
0 1 0 9
asked 07 September, 2021
62 votes
3 answers
1.7K views
What is the meaning of "non temporal" memory accesses in x86

This is a somewhat low-level question. In x86 assembly there are two SSE instructions: MOVDQA xmmi, m128

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
56 votes
3 answers
2.2K views
What does `dword ptr` mean?

Could someone explain what this means? (Intel Syntax, x86, Windows) and dword ptr [ebp-4], 0

avatar
Kisha
0 1 0 9
asked 07 September, 2021
53 votes
1 answers
1K views
What is the best way to set a register to zero in x86 assembly: xor, mov or and?

All the following instructions do the same thing: set %eax to zero. Which way is optimal (requiring fewest mac

avatar
User demo
0 1 0 9
asked 07 September, 2021
63 votes
4 answers
975 views
Why do x86-64 instructions on 32-bit registers zero the upper part of the full 64-bit register?

In the x86-64 Tour of Intel Manuals, I read Perhaps the most surprising fact is that an instruction such a

avatar
Frederick
0 1 0 9
asked 07 September, 2021
63 votes
12 answers
3K views
What is the difference between MOV and LEA?

I would like to know what the difference between these instructions is: MOV AX, [TABLE-ADDR] and LEA AX,

avatar
Juliane
0 1 0 9
asked 07 September, 2021
65 votes
3 answers
3K views
How do you use gcc to generate assembly code in Intel syntax?

The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel sy

avatar
Brianne
0 1 0 9
asked 07 September, 2021
58 votes
8 answers
1.5K views
Show current assembly instruction in GDB

I'm doing some assembly-level debugging in GDB. Is there a way to get GDB to show me the current assembly

avatar
Juliane
0 1 0 9
asked 07 September, 2021
56 votes
4 answers
3K views
Why would introducing useless MOV instructions speed up a tight loop in x86_64 assembly?

Background: While optimizing some Pascal code with embedded assembly language, I noticed an unnecessary MOV i

avatar
Jesenia
0 1 0 9
asked 07 September, 2021
62 votes
10 answers
2.4K views
Assembly code vs Machine code vs Object code?

What is the difference between object code, machine code and assembly code? Can you give a visual example of

avatar
Xavier
0 1 0 9
asked 07 September, 2021
50 votes
3 answers
1.7K views
What is a retpoline and how does it work?

In order to mitigate against kernel or cross-process memory disclosure (the Spectre attack), the Linux kernel1

avatar
Gigi
0 1 0 9
asked 07 September, 2021
54 votes
10 answers
1.6K views
What does multicore assembly language look like?

Once upon a time, to write x86 assembler, for example, you would have instructions stating "load the EDX regis

avatar
Trudy
0 1 0 9
asked 07 September, 2021
65 votes
4 answers
2.3K views
How to run a program without an operating system?

How do you run a program all by itself without an operating system running? Can you create assembly programs t

avatar
Georgie
0 1 0 9
asked 07 September, 2021