Skip to content

Instantly share code, notes, and snippets.

@3outeille
Last active September 3, 2022 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 3outeille/ab274bfdbb65b0946ff33fde39e7c8ae to your computer and use it in GitHub Desktop.
Save 3outeille/ab274bfdbb65b0946ff33fde39e7c8ae to your computer and use it in GitHub Desktop.
register sum weird results
extern exit
global _start
section .data
a: dd -76, -84, -84, -132
b: dw 406, 406, 406, 406
section .text
_start:
movdqa xmm0, [a]
pmovsxwd xmm2, [b]
paddq xmm0, xmm2
;Expected: 330, 322, 322, 274
;Results: 330, 323, 322, 275
call exit
all:
nasm -f elf64 main.asm
gcc -g -nostartfiles -no-pie -o main main.o
debug:
echo "dashboard -output /dev/pts/0\nb _start\nrun >> gdb-log.txt 2>&1\nlayout asm\ndashboard assembly\ndashboard source\ndashboard threads\nset logging file gdb-log.txt\nset logging on\nset trace-commands on\nrecord\n" > gdb-commands.txt
gdb -x gdb-commands.txt main
clean:
rm *.o main gdb-commands.txt gdb-log.txt .gdb_history
.PHONY:
clean asm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment