assembly
How does “mov (%ebx,%eax,4),%eax” work? [duplicate]
The complete memory addressing mode format in AT&T assembly is: offset(base, index, width) So for your case: offset = 0 base = ebx index = eax width = 4 Meaning that the instruction is something like: eax = *(uint32_t *)((uint8_t *)ebx + eax * 4 + 0) In a C-like pseudocode.
Counting 1 bits (population count) on large data using AVX-512 or AVX-2
AVX-2 @HadiBreis’ comment links to an article on fast population-count with SSSE3, by Wojciech Muła; the article links to this GitHub repository; and the repository has the following AVX-2 implementation. It’s based on a vectorized lookup instruction, and using a 16-value lookup table for the bit counts of nibbles. # include <immintrin.h> # include <x86intrin.h> … Read more
Differences between general purpose registers in 8086: [bx] works, [cx] doesn’t?
On the 8086 (and 16-bit addressing in x86), only the following addressing modes are available: [bx] [bx + foo] [foo] [bp + foo] [si] [si + foo] [di] [di + foo] [bx + si] [bx + si + foo] [bx + di] [bx + di + foo] [bp + si] [bp + si + foo] … Read more
Calculating padding length with GAS AT&T directives for a boot sector?
With AT&T syntax you can put a label at the start of your bootloader and then use something like this: .global _start .text .code16 _start: jmp . .space 510-(.-_start) .word 0xaa55 Period . is the current location counter relative to the beginning of the current section. The difference between period . and _start is an … Read more