In AT&T syntax, a literal needs to be prefixed with $
. Then, also the operands need to be switched:
test $0xfffffff, %esp
Without the $
prefix, the assembler assumes a memory address, and accessing address 0xfffffff
is most likely out of your mapped memory, which causes the segmentation fault.