Category "x86-64"

How Do I Convert This ATT assembly to Intel Syntax? Jump to a non-relative address without using registers

I was reading this article " assembly-challenge-jump-to-a-non-relative-address-without-using-registers ". I need to do exactly what he suggests here (Jump to a

Why is the XOR swap optimized into a normal swap using the MOV instruction?

While testing things around Compiler Explorer, I tried out the following overflow-free function for calculating the average of 2 unsigned 32-bit integers: uint3

Why is Intel Pin not able to instrument open syscall?

I am trying to build a pintool that should be able to instrument an open() syscall that targets a specific file/directory and replace the file path argument wit

Execute system command in x64 bit assembly?

I recently been trying to execute system commands using pure assembly. I managed to achieve it in a x32 bit binary as posted here: execute system command (bash)

Why does GCC include an "empty" XOR

I have following piece of code: typedef struct { int x; int y; int z; int w; } s32x4; s32x4 f() { s32x4 v; v.x

How to divide two unsigned long 64 bit values in x86 assembly and then returning the quotient and remainder to a C program

In a separate C program, I have passed 4 parameters to an x86 ASM program. dividend divisor Quotient pointer Remainder pointer dividend = 0xA divisor = 0x3 Whic

"There is no need to deallocate the stack at the end of the function when the inner-stack frame isn't modified", but it is being modified in this case

Here is a simple function #include <stdio.h> int foo() { int a = 3; int b = 4; int c = 5; return a * b * c; } int main() { int a = f

Documentation on MSI Address/Data register content expectations for AMD cpus?

Where I can find info on AMD Ryzen CPUs and how they expect MSI address/data to be programmed? The Intel manual is crystal clear in its description (pictured be

Are there any instructions (other than those that use RIP-relative addressing) that are position dependent?

(This question refers specifically to x86/x86_64) I'm working on an application that needs to insert a small block of instructions at specific points within ano

Writing a putchar in Assembly for x86_64 with 64 bit Linux?

I am trying to use the write syscall in order to reproduce the putchar function behavior which prints a single character. My code is as follows, asm_putchar:

Array addressing in AT&T GAS assembly. Register offset from RIP doesn't work

I'm trying to work with arrays in GNU assembly. In my opinion the following code must exit with value 3. But it exits with 13. .section __DATA,__data inArr:

Fast floating-point power of 2 on x86_64

Is there a fast way to take 2.0 to some floating-point degree x? I mean something faster than pow(2.0, x) and preferrably what vectorizes well with AVX2. The c

How can I get a string returned from a function executed from a byte array?

I have a working C program that has the simple function that returns a d character encoded in a byte array. char foo() { return 'd'; } char byte_array[] = {0

How can I get a string returned from a function executed from a byte array?

I have a working C program that has the simple function that returns a d character encoded in a byte array. char foo() { return 'd'; } char byte_array[] = {0

MASM SHA256 running from C#

I received a task in college to compare execution time for calculating SHA256 in C# and assembly. It is supposed to be a simple WPF app with file input and 2 bu

MOVZBQ equivalent in NASM

Background: I have been learning x86_64 assembly using NASM on a Linux system and was writing a subroutine for strlen(const char *str) I wanted to copy one byte

The most correct way to refer to 32-bit and 64-bit versions of programs for x86-related CPUs?

This question is about terminology for 32-bit vs. 64-bit x86. If I have 2 directories with source code of the same program - one for 32-bit Windows and another

Why are rbp and rsp called general purpose registers?

According to Intel in x64 the following registers are called general purpose registers (RAX, RBX, RCX, RDX, RBP, RSI, RDI, RSP and R8-R15) https://software.inte

how to run amd64 docker images on arm64 host platform

I have an m1 mac and I am trying to run a amd64 based docker image on my arm64 based host platform. However, when I try to do so (with docker run) I get the fol

Apparent no-op in Rust assembly output?

I was studying the x86_64 assembly for the following function: /// Returns the greatest power of two less than or equal to `self`, or 0 otherwise. pub const fn