Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15401

Accessing a pointer stored in memory without loading it into a register

$
0
0

arch i386; syntax GAS

I have a pointer variable called active, to which I have tried to copy a register value in assembly. I have found out pretty quickly that movl %esp, (active) did not set the value pointed by active, but instead it set active itself. After some google searching and head scratching I have come to try this approach: movl active, %eax; movl %esp, (%eax) which worked fine, but not in the way I wanted it. This code executes at a point where I should not change any register nor mess with the stack, so that loading a register straight to a memory location stored in memory (variable) would help a lot.

Why can't I access a pointer variable directly (or can I?) and have to load it into a register first? Is there any workarounds?


Viewing all articles
Browse latest Browse all 15401

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>