Okay, so I am learning Assembly and I started with 32bit and bswap
seemed to work fine.
Now I have this code
main.c
#include <stdio.h>
#include <stdlib.h>
extern int asm_proc(void);
void print_bits(unsigned long long bits) {
for (int i = 0; i < sizeof(unsigned long long) * 8; i += 1) {
printf("%i", (bits & 0x0000000000000001 ? 1 : 0));
bits >>= 1;
if((i+1) % 8 == 0) printf("\n");
}
printf("\n");
}
int main() {
print_bits(asm_proc());
return 0;
}
main.asm
BITS 64
section .text
global asm_proc
asm_proc:
mov rax, 01h
cpuid
mov rax, 0ffffffffffffffffh
bswap rax
ret
but the bswap
just sets rax
to 0x0000000000000000.
Any help would be much appriciated. Thanks :)