What do the E and R prefixes stand for in the names of Intel 32-bit and 64-bit registers?

R just stands for “register”. The AMD64 ISA extension added 8 additional general-purpose registers, named R8 through R15. The 64-bit extended versions of the original 8 registers had an R prefix added to them for symmetry. E stands for “extended” or “enhanced”. (Wikipedia says “extended”.) They are the “extended” versions of the 16-bit registers, in … Read more

What causes page faults?

(I’m the author of Process Hacker.) Firstly: A page fault is a trap to the software raised by the hardware when a program accesses a page that is mapped in the virtual address space, but not loaded in physical memory. That’s not entirely correct, as explained later in the same article (Minor page fault). There … Read more

Use 32bit “Program Files” directory in msbuild

In MSBuild 4.0+, there’s a $(MSBuildProgramFiles32) property for it, which you can confidently employ directly (especially if you’re prepared to put a ToolsVersion=”4.0″ at the top of the file to guarantee it’s going to be available and Fail Fast if it’s not). If you’re not and need something that can Do The Right Thing even … Read more

Find which assembly instruction caused an Illegal Instruction error without debugging

Recently I experienced a crash due to a 132 exit status code (128 + 4: program interrupted by a signal + illegal instruction signal). Here’s how I figured out what instruction was causing the crash. First, I enabled core dumps: $ ulimit -c unlimited Interestingly, the folder from where I was running the binary contained … Read more

Does it make any sense to use the LFENCE instruction on x86/x86_64 processors?

Bottom line (TL;DR): LFENCE alone indeed seems useless for memory ordering, however it does not make SFENCE a substitute for MFENCE. The “arithmetic” logic in the question is not applicable. Here is an excerpt from Intel’s Software Developers Manual, volume 3, section 8.2.2 (the edition 325384-052US of September 2014), the same that I used in … Read more

Why is __int128_t faster than long long on x86-64 GCC?

The performance difference comes from the efficiency of 128-bit divisions/modulus with GCC/Clang in this specific case. Indeed, on my system as well as on godbolt, sizeof(long long) = 8 and sizeof(__int128_t) = 16. Thus operation on the former are performed by native instruction while not the latter (since we focus on 64 bit platforms). Additions, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)