LOGBOOK

HELP

Quiz Entry - updated: 2026.07.06

What does movl $0x1, (%rsp) vs movl $0x1, %eax do differently?

The first writes 1 to memory at the address in %rsp (the parentheses mean dereference); the second puts 1 straight into the %eax register.

# Write 1 to memory at address rsp
movl $0x1, (%rsp)

# Put 1 in the eax register
movl $0x1, %eax

When you see movl $value, offset(%rsp): It's initializing a local variable on the stack.

# Initialize local vars on stack
movl $0, (%rsp)
movl $1, 4(%rsp)
movl $2, 8(%rsp)

This is like:

int a = 0;
int b = 1;
int c = 2;

The size suffix matters here:

  • movl writes 4 bytes (int)
  • movq writes 8 bytes (long/pointer)
  • movb writes 1 byte (char)
  • movw writes 2 bytes (short)

Go deeper:

From Quiz: REVE1 / Assembly Patterns & GDB | Updated: Jul 06, 2026