title: Pushing a linked list onto stack
body: <p>This is in y86(assembly architecture which resembles x86, but is missing a lot of instructions), but this should make sense. I'm trying to push a whole linked list onto the stack, the linked list looks like this..</p>
  
  <pre><code>        .align 4
  ele1:
          .long 0x00a
          .long ele2
  ele2:
          .long 0x0b0
          .long ele3
  ele3:
          .long 0xc00
          .long 0
  </code></pre>
  
  <p>I'm wondering how I would push this onto the stack, I'm pretty sure this would do it..</p>
  
  <pre><code>.pos 0
  init:   
          irmovl Stack,%esp
          rrmovl %esp,%ebp
          irmovl ele1,%edx
          pushl %edx
          call Main
          halt
  
  
          .align 4
  ele1:
          .long 0x00a
          .long ele2
  ele2:
          .long 0x0b0
          .long ele3
  ele3:
          .long 0xc00
          .long 0
  
  Main:   
          pushl %ebp
          rrmovl %esp,%ebp
          irmovl ele1, %eax
          pushl %eax
          irmovl ele2, %eax
          pushl %eax
          irmovl ele3, %eax
          pushl %eax
  
  .pos 0x200
  Stack:
          #end of code
  </code></pre>
  
  <p>What I'm wondering is how would I push a linked list of any size. I know that the second long in each element is the memory location for the next element right? How do I get that value, I mean doesn't irmovl ele1, %eax just move the long 0x00a value, or does it move the entire list? I'm very confused.</p>