0

Is there a difference between

%ecx and (%ecx)

I don't really care at this point about specific register uses, just consider %ecx a general purpose register for my question.

I know that if you have a base pointer (%ebp) and you want to reference a location based on that, you can write something like

8(%ebp) (for the first argument given in a function)

but when dealing with registers like %edx, what would one use parenthesis for?

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by gerard4143
0

Is there a difference between

%ecx and (%ecx)

I don't really care at this point about specific register uses, just consider %ecx a general purpose register for my question.

I know that if you have a base pointer (%ebp) and you want to reference a location based on that, you can write something like

8(%ebp) (for the first argument given in a function)

but when dealing with registers like %edx, what would one use parenthesis for?

Yes...The first is the value in the register - %eax
and the second is dereferencing the value in the register - (%eax)

Example of the second use
If %eax contains a memory address then (%eax) will retrieve the value located at that memory address and 8(%eax) will retrieve the value at memory address + 8.

Edited by gerard4143: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.