Questions tagged [machine-code]

Machine code is data that is directly fed into a microprocessor, being the only form that the processor is able to execute. It is the lowest possible level of abstraction, wherein all data is a raw binary stream. Machine code is barely readable by humans, which is why assembly is usually utilized instead.

Every processor or processor family has its own instruction set. This is a set of instructions the processor has been designed to execute. These instructions are binary codes and in general are not human readable, one would have to memorize the bit patterns. Assembly language is a human readable representation of the machine code where the assembly language mnemonics and following syntax attempt a one to one assembly language instruction to machine code instruction relationship. But assembly language has a fair amount of additional syntax that is not directly related to machine code or machine language.

https://en.wikipedia.org/wiki/Machine_code

The tag is used for questions related to machine code. Additional tags like and and others may also be used.

A tag specifying the architecture , , , , (and many others), is needed as the machine code for different architectures is not compatible, and the question will be difficult to answer without knowing the architecture.

766 questions
8
votes
1 answer

How does an instruction decoder tell the difference between a prefix and a primary opcode?

I'm trying to wrap my head around the x86 instruction encoding format. All the sources that I read still make the subject confusing. I'm starting to understand it a little bit but one thing that I'm having trouble with understanding is how the CPU…
8
votes
2 answers

How does an assembler work?

I am looking for a brief description of the use of an assembler in producing machine code. So I know that assembly is a 1:1 translation of machine code. But I am getting confused about object code and linkers and how they place into it. I don't need…
user673906
  • 757
  • 6
  • 15
  • 30
8
votes
1 answer

In ARM64 assembly code, when is register 31 XZR versus SP?

In ARM64 assembly code, when does register number 31 mean XZR and when does it mean SP?
Myria
  • 3,372
  • 1
  • 24
  • 42
8
votes
1 answer

What does 'REX' stand for in an x86-64 REX prefix?

From Intel's SDM, section 2.2.1 specifies that the REX prefix is used to: Specify GPRs and SSE registers. Specify 64-bit operand size. Specify extended control registers But what do the letters REX stand for in the acronym?
Omar Darwish
  • 1,536
  • 2
  • 15
  • 23
8
votes
5 answers

How does the CPU know how many bytes it should read for the next instruction, considering instructions have different lengths?

So i was reading a paper, and in it, they said that statically disassembling the code of a binary is undecidable, because a series of bytes could be represented as many possible ways as shown in picture ( its x86 ) so my question is : how does the…
OneAndOnly
  • 1,048
  • 1
  • 13
  • 33
8
votes
1 answer

MIPS jump and branch instructions range

I just started learning MIPS and I am having troubles understanding the ranges of jump and branch instructions. I know that there are limits on how "far" PC can jump and branch, but I don't get the reason why. And 2 specific questions, if current…
PTN
  • 1,658
  • 5
  • 24
  • 54
8
votes
4 answers

What is the difference between Assembly and binary?

I've trouble with understanding the difference between assembly and binary. Just I need to understand what the relation is between linked binary and assembly.
Bousselham Kh
  • 89
  • 1
  • 1
  • 4
8
votes
3 answers

How are functions encoded/stored in memory?

I understand how things like numbers and letters are encoded in binary, and thus can be stored as 0's and 1's. But how are functions stored in memory? I don't see how they could be stored as 0's and 1's, and I don't see how something could be stored…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
8
votes
4 answers

What converts Assembly language to machine code

I am new to programming and I started with C++ language, as far as I know C++ language is converted to assembly language by the C++ compiler (Ex:Visual Studio), but I tried looking up for what converts the assembly language into machine code to be…
Karim K.
  • 361
  • 2
  • 4
  • 9
8
votes
2 answers

What do we mean by instruction size?

I am really confused and the question may sound dumb but I'm really not sure what it means when we say an instruction size is 32-bit or 16-bit. Is it if operand size is 32-bit then we say it's an 32-bit instruction and if operand size is 16-bit…
Amit Singh Tomar
  • 8,380
  • 27
  • 120
  • 199
8
votes
4 answers

Can a .NET app be compiled to native?

Just wondering if a .NET app can be compiled down to native machine code ahead of time? I'm not planning on doing so even if I could; I'm just curious. Thanks
Nathan W
  • 54,475
  • 27
  • 99
  • 146
8
votes
6 answers

Are goto statements efficient when compared to calling functions?

I have the following code in C++ here: #include int main(int argc, const char * argv[]) { goto line2; line1: std::cout << "line 1"; goto line3; line2: std::cout << "line 2"; goto line1; line3: std::cout << "line…
Phil
  • 46,436
  • 33
  • 110
  • 175
7
votes
3 answers

operand generation of CALL instruction on x86-64 AMD

Following is the output of objdump of a sample program, 080483b4 : 80483b4: 55 push %ebp 80483b5: 89 e5 mov %esp,%ebp 80483b7: 83 ec 18 sub $0x18,%esp …
Samir Baid
  • 1,128
  • 2
  • 11
  • 20
7
votes
1 answer

Why does the machine code depend on the OS type?

Suppose, I have a program written in C and I have two identical computers, the one is running Windows and the other is linux. Since the computers are identical, their processors have the same instruction set, so the machine code after compilation…
dnnagy
  • 3,711
  • 4
  • 24
  • 34
7
votes
1 answer

Are x86 opcodes arbitrary?

Are x86 op codes arbitrary? Is there a reason that hlt is 0xf4 and the nop is 0x90?
Roblox Man225
  • 75
  • 1
  • 8