Questions tagged [x86-64]

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

x86-64 is a 64 bit instruction set, backwards compatible with the 16 and 32 bit architectures originating from the Intel 8086 processor. It is sometimes known as amd64 (common in GNU/Linux) or x64 (usually only seen in Windows).

The specification was created by AMD, and has been implemented by AMD, Intel, VIA, and others.

See the x86 tag for programming and optimising guides and other resources.

6825 questions
3
votes
2 answers

Can programming languages have their own calling conventions?

Windows and Unix have their own calling-conventions for x86-64. But, if a language requires / benefits from it, can it have its own calling conventions for internal use? For eg, Swift / Python(compiled) may get benefitted from having multiple…
Sourav Kannantha B
  • 2,860
  • 1
  • 11
  • 35
3
votes
1 answer

AVX512 compare to vector not to mask

I miss the compare instructions in avx2 that produce a vector instead of a mask. What is the most efficient way to accomplish the same thing in avx512? Is it _mm512_cmp_ps_mask followed by an expand?
bumpbump
  • 542
  • 4
  • 17
3
votes
0 answers

MSVC C++ compiler giving inconsistent performance on different builds of the same code when using [[unlikely/likely]] attributes

I am simply experimenting with the [[unlikely/likely]] branch hints available when compiling with /std:c++latest. To do this I am using a modified version of the code provided by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0479r0.html…
name
  • 181
  • 1
  • 12
3
votes
1 answer

Why is the compiler dedicating a memory location for storing a redundant variable in this case?

I wrote this simple C++ code, to see how atomic variables are implemented. #include using namespace std; atomic f(0); int main() { f += 1.0; } It is generating this assembly for main in -O3: main: mov eax, DWORD…
Sourav Kannantha B
  • 2,860
  • 1
  • 11
  • 35
3
votes
1 answer

The address of C ++ pointer

#include using namespace std; int main(int argc, char** argv) { unsigned int a =5; unsigned int *pint = NULL; cout << "&a = " << &a << endl; cout << " &pint = " << &pint << endl; } Output: &a = 0x6ffe04 &pint =…
JOya
  • 41
  • 3
3
votes
1 answer

Why I can't access to Tss variable declared in assembly from this C code?

Why I can't access to Tss variable in this C code Qnd How to fix this? and why I get Page Fault exception while I try to write to Tss variable from C code? in protected mode I declare gdt64 and Tss in boot32.S: .align 16 gdt64: .quad…
JustOneMan
  • 231
  • 1
  • 9
  • 34
3
votes
0 answers

Understanding RIP relative relocations

I am trying to understand the relocations for the object file generated by this simple program: int answer = 42; int compute() { return answer; } int main() { return compute(); } I compile it with simply gcc -c main.cpp. Then, examining…
knatten
  • 5,191
  • 3
  • 22
  • 31
3
votes
2 answers

Dump the contents of TLB buffer of x86 CPU

Is it possible to get list of translations (from virtual pages into physical pages) from TLB (Translation lookaside buffer, this is a special cache in the CPU). I mean modern x86 or x86_64; and I want to do it in programmatic way, not by using JTAG…
osgx
  • 90,338
  • 53
  • 357
  • 513
3
votes
2 answers

Linux kernel 5.4 GCC 9.1.0 does not show code coverage

we are using Linux kernel 5.4 with gcc 9.1.0 on different architectures (arm, arm64, x86_64). I am in charge of creating code coverage for kernel modules. I am not selecting the Linux kernel version nor the compiler version. I am able to create code…
3
votes
1 answer

Why doesn't Elf64 use Elf64_Rel for relocations on 64-bit x86?

https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-54839.html#chapter7-2 states: 64–bit SPARC and 64–bit x86 use only Elf64_Rela relocation entries. Thus, the r_addend member serves as the relocation addend. x86 uses only Elf32_Rel…
the4naves
  • 333
  • 2
  • 9
3
votes
1 answer

Strategy for AMD64 cache optimization - stacks, symbols, variables and strings tables

Intro I am going to write my own FORTH "engine" in GNU assembler (GAS) for Linux x86-64 (specifically for AMD Ryzen 9 3900X that is siting on my table). (If it will be success, I may use similar idea for make firmware for retro 6502 and similar…
gilhad
  • 609
  • 1
  • 5
  • 22
3
votes
0 answers

system V (x86_64 ) abi calling conventions: should caller-saved variables be saved in recursive calls (even if they are not changed)?

Say I want to implement a function for summing the numbers in a given range: int sumRange(int start, int end); And this is the implementation I came up with: (AT&T asm syntax) sumRange: cmp %edi, %esi jl return_zero #jump if start > end …
yosef
  • 124
  • 5
3
votes
1 answer

On x64 Linux, what is the difference between syscall, int 0x80 and ret to exit a program?

I decided yesterday to learn assembly (NASM syntax) after years of C++ and Python and I'm already confused about the way to exit a program. It's mostly about ret because it's the suggested instruction on SASM IDE. I'm speaking for main obviously. I…
Etienne Armangau
  • 255
  • 2
  • 10
3
votes
1 answer

Understand IDTR register?

I can't understand this image which explain IDTR in intel X86-64 processor. IDT base adress size is 64 and I totally get that since it can be nearly anywhere in memory. But, why IDT limit is 16 bits? why we need all of these bits? each vector is of…
user15961623
3
votes
0 answers

20x performance difference Interlocked.Read vs Interlocked.CompareExchange though both implemented with lock cmpxchg

Question I wanted to write a small profiler class that allows me to measure the run time of hot paths throughout the application. In doing so, I discovered and interesting performance difference between two possible implementations that I cannot…
grasbueschel
  • 879
  • 2
  • 8
  • 24
1 2 3
99
100