machine-code

How to generate the machine code of Thumb instructions?

空扰寡人 提交于 2019-12-22 18:27:25
问题 I searched Google for generating machine code of ARM instructions, such as this one Converting very simple ARM instructions to binary/hex The answer referenced ARM7TDMI-S Data Sheet (ARM DDI 0084D). The diagram of data processing instructions is good enough. Unfortunately, it's for ARM instructions, not for Thumb/Thumb-2 instructions. Take the B instruction as an example. ARM Architecture Reference Manual - ARMv7-A and ARMv7-R edition section A8.8.18, Encoding T4: For the assembly code: B

Is tooling available to 'assemble' WebAssembly to x86-64 native code?

廉价感情. 提交于 2019-12-21 17:15:36
问题 I am guessing that a Wasm binary is usually JIT-compiled to native code, but given a Wasm source, is there a tool to see the actual generated x86-64 machine code? Or asked in a different way, is there a tool that consumes Wasm and outputs native code? 回答1: The online WasmExplorer compiles C code to both WebAssembly and FireFox x86, using the SpiderMonkey compiler. Given the following simple function: int testFunction(int* input, int length) { int sum = 0; for (int i = 0; i < length; ++i) {

What does actual machine code look like at various points? [closed]

不打扰是莪最后的温柔 提交于 2019-12-21 04:02:54
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . There seems to be many opinions on what machine code actually is. I've heard some say it's assembly, or binary, or hex. Is it correct to say that machine code is essentially a set of instructions for a particular

What does “extend immediate to 32 bits” mean in MIPS?

此生再无相见时 提交于 2019-12-20 06:28:59
问题 I'm reading about the Instruction Decode (ID) phase in the MIPS datapath, and I've got the following quote: "Once operands are known, read the actual data (from registers) or extend the data to 32 bits (immediates)." Can someone explain what the "extend the data to 32 bits (immediates)" part means? I know that registers all contain 32 bits, and I know what an immediate is. I just don't understand why you need to extend the immediate from 26 to 32 bits. Thanks! 回答1: On a 32-bit CPU, most of

Why aren't EXE's in binary?

让人想犯罪 __ 提交于 2019-12-19 05:46:54
问题 Why is it that if you open up an EXE in a hex editor, you will see all sorts of things. If computers only understand binary then shouldn't there only be 2 possible symbols seen in the file? Thanks 回答1: The hexadecimal values are interpreted binary values in memory. The software only make it a bit more readable to human beings. 0000 = 0 0001 = 1 0010 = 2 0011 = 3 0100 = 4 0101 = 5 0110 = 6 0111 = 7 1000 = 8 1001 = 9 1010 = 10 A 1011 = 11 B 1100 = 12 C 1101 = 13 D 1110 = 14 E 1111 = 15 F 回答2:

How might I convert Intel 80386 Machine Code to Assembly Language?

萝らか妹 提交于 2019-12-19 04:08:12
问题 I've been given the following task: Consider the following sequence of hexadecimal values: 55 89 E5 83 EC 08 83 E4 F0 31 C9 BA 01 00 00 00 B8 0D 00 00 00 01 D1 01 CA 48 79 F9 31 C0 C9 C3 This sequence of bytes represents a subroutine in Intel 80386 machine language in 32-bit mode. When the instructions in this subroutine are executed, they leave values in the registers %ecx and %edx. What are the values? What is the program in C that carries out the computation done by this subroutine, then

Instruction Lengths

五迷三道 提交于 2019-12-18 08:30:40
问题 I was looking at the different instructions in assembly and I am confused on how the lengths of different operands and opcodes are decided upon. Is it something you ought to know from experience, or is there a way to find out which operand/operator combination takes up how many bytes? For eg: push %ebp ; takes up one byte mov %esp, %ebp ; takes up two bytes So the question is: Upon seeing a given instruction, how can I deduce how many bytes its opcode will require? 回答1: There's no hard and

AMD64 — nopw assembly instruction?

限于喜欢 提交于 2019-12-18 02:02:06
问题 In this compiler output, I'm trying to understand how machine-code encoding of the nopw instruction works: 00000000004004d0 <main>: 4004d0: eb fe jmp 4004d0 <main> 4004d2: 66 66 66 66 66 2e 0f nopw %cs:0x0(%rax,%rax,1) 4004d9: 1f 84 00 00 00 00 00 There is some discussion about "nopw" at http://john.freml.in/amd64-nopl. Can anybody explain the meaning of 4004d2-4004e0? From looking at the opcode list, it seems that 66 .. codes are multi-byte expansions. I feel I could probably get a better

16 bit animation - getting started

倖福魔咒の 提交于 2019-12-17 14:56:34
问题 Took a while but finally got to square 1 in 16 bit graphics. Here I clear the screen and draw a single pixel: mov ax, 0a000h mov es, ax ; es - Extra Segment now points to the VGA location mov ax, 0013h int 10h xor al, al mov dx, 3c8h out dx, al inc dx mov al, 63 out dx, al out dx, al out dx, al mov ax, 0100h int 21h mov ax, 4c00h int 21h ; draw single pixel :) mov ah, 0ch; mov al, 03h ; color mov cx, 70 ; x co-ordinate mov dx, 70 ; y co-ordinate ; mov bh,1 ; page # int 10h times 510-($-$$) db

How does the modulus operator in java function?

旧巷老猫 提交于 2019-12-14 04:14:11
问题 I'm about to start optimizations on an enormous piece of code and I need to know exactly which operations are performed when the modulus operator is used. I have been searching for quite a while, but I can't find anything about the machine code behind it. Any ideas? 回答1: If you need to know exactly which operations are performed when the modulus operator is used then I would suggest you are "doing it wrong". Modulus may be different depending on OS and underlying architecture. It may vary or