Thanks for your answer!
iansjack wrote:
Now this is in AT&T syntax and I see that you are using Intel syntax, which I am not totally au fait with. But I believe that instead of the labels
Code:
stack_bottom:
stack_top:
you should have
Code:
stack_bottom
stack_top
(i.e. no colons). It's possible that you have similar errors elsewhere in your code.
No, because if I remove the colons the
Code:
stack_top
and
Code:
stack_bottom
are compiled as instructions, which results in an error on compile time.
About the setup of the stack, this is the correct way, because in intel syntax you don't have any prefixes like
$, which means the conversion from AT&T to Intel completely gets rid of all prefixes like
$ for constants and
% for registers. For moving the contents of a memory location, you explicitily have to use brackets, e. g.:
Code:
mov eax, [ecx]
or in this case if I would have moved the contents of stack_top,
Code:
mov esp, [stack_top]
But since in Intel the prefixed are obsolete, moving
stack_top as a value is the same as moving
$stack_top in AT&T.
So unfortunately, this is not the reason for the problem.