Questions tagged [x86-64]

x86-64 is a 64 bit extension to the Intel x86 architecture

6,116 questions
0votes
0answers
26views

GCC inserts unnecessary register-reigster "mov" instructions?

Original C source code: #define BITSET_WORDIDX(idx) (idx >> 6) #define BITSET_WORD_BITIDX(idx) (idx & 0x3F) static inline __attribute__((always_inline, regparm(2))) unsigned int ...
2votes
0answers
69views

Assembly code for C++ virtual function call in perf report?

I'm doing some profiling for virtual function call performance and when read the perf report, I got this: mov (%rbx),%rdi # move "this" pointer to %rdi mov (%rdi),%rax # move vtable ...
0votes
1answer
33views

Reading number and change it into a binary

So I have a practice exam for assemblyx86 language Write a void function, encryptStr(), that will encrypt a string. To encrypted the string, simply add one to each alphabetic (upper and lower case ...
2votes
2answers
39views

Segmentation fault when calling printf from C function called from assembly [duplicate]

I tried to implement the quicksort in x86-64 Assembler, on Linux. Since I'm not fully comfortable with it yet, I wrote the partition algorithm in C. It seems to work but something must be off, because ...
0votes
0answers
25views

How does supervisor mode address translation get done? [duplicate]

Intel System Programming manual vol. 3 clearly documents that 4-level paging uses the first 48 bits of the virtual address to get the actual physical address. When connecting to the Linux Kernel with ...
0votes
1answer
28views

difference between simple ret and _exit function in nasm x8664

I have been in pain for the last couple of days with x8664 assembly (using nasm on macOs). I’d like to show two pieces of code So let’s say that I have an array and I want to print it. This is the ...
2votes
0answers
30views

Memory throughput for strided memory accesses

I am measuring memory throughput and runtimes using _mm256_i32gather_epi32 intrinsic. Here is the loop I use for testing: for (int i = 0; i < len; i+=8) { const __m256i* indexes_2 = ...
  • 1,894
0votes
0answers
37views

The value is weird after using `.int` or `.long` initialize data in data section [duplicate]

I know .int and .long occupy 4 bytes, and I should use movl. But what is the like 0x20, 0x30, 0x40, 0x2c? It's dirty data? .section .data iary: .int 1, 2 lary: .long 3, 4 .section .text ....
0votes
0answers
30views

Why can `%rip + displacement` access data section? [duplicate]

The usage of this is that I saw after used gcc -S. I know ary represents the first address of the sequence, then I also know leaq ary(, %rdi, 4) has the same effect(assume %rdi equals 0). But I don't ...
1vote
0answers
35views

reversing an array and printing it in x8664 (nasm)

I am trying to print an array, reverse it, and then print it again. I manage to print it once. I can make also 2 consecutive calls to _printy and it works. But the code breaks with the reverse ...
2votes
1answer
29views

Why do I get an illegal instruction using __builtin_ia32_wrfsbase64 when skylake has fsgsbase?

I'm running my code on a server with "Intel Xeon Processor (Skylake, IBRS)". I listed the cpu flags at the bottom. I got a core dump, ran it in gdb and saw the illegal instruction was ...
  • 57
2votes
0answers
57views

Implementation of Stackful Coroutine in C++

Now I am trying to implement stackful coroutine in C++17 on Windows x64 OS, but, unfortunately, I have encountered the problem: I can't throw exception in my coroutine, if I do so, the program is ...
0votes
0answers
16views

How to get Protobuf compiling properly for x86_64-apple-darwin21.2.0? [duplicate]

I'm trying to get protobuf (libprotoc 3.21.1) working properly on MacOS Monterey 12.1 (x86_64-apple-darwin21.2.0) with Xcode (Version 13.2.1). My main objective is to use the code generated from a ....
0votes
0answers
26views

usage of $ to address memory in nasm (x8664)

I have tried to get this code to work all day, and finally I managed. I am looping through an array and computing the sum (I know pretty miserable), and everything seems to work, feel free to make ...
0votes
0answers
27views

Why do I have 35% of my cpu stalled-cycles-backend when only using 200MiB of ram?

I'm trying to profile my app and make it faster but I'm unsure if its hardware/memory bound or if I can improve it. I use perf stat to profile my app and saw 35% next to stalled-cycles-backend. The ...
  • 57

153050per page