Strawberry
Strawberry

Reputation: 67968

Various Assembly Questions

I'm looking at some assembly stuff. So, pushl bar is the same as subl $4, %esp movl bar, ($esp).

Few questions:

1) What is special about the %esp register?

2) What does the parenthesis around the register mean?

3) pushl bar would meaning having bar on top of the stack, right? So what is happening when I do subl $4? Does that mean I am creating am empty space on top of the stack for me to move bar into?

Upvotes: 0

Views: 129

Answers (1)

Matt
Matt

Reputation: 579

  1. ESP is the stack pointer - it always points to the "top" of the stack

  2. The brackets mean "the memory pointed at by" ESP rather than the ESP register itself

  3. You are moving the stack pointer down by four bytes (the stack grows downwards in most implementations - pushing something onto the "top" of the stack means storing it at a lower memory address)

Upvotes: 1

Related Questions