• Uncategorized

About assembly : Segfault-when-storing-reg-to-var-in-section-DATA

Question Detail

So I am trying to write some code using x86 and I can’t seem to get it to move contents of a register to a spot in memory.

The code is just this

global  main

  var_i: DD  0

      push  DWORD 4
      pop   EAX
      mov   [var_i], EAX

    mov   EAX,  0

I am using nasm and gcc on the code.
The problem I am having is that whenever I try to move to the spot in memory it segfaults

Question Answer

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.