How to properly create a page/.bss to directly address locations? ATT syntax

I have been trying many ways to do this based on a couple answers I got a couple or a few days ago. I keep getting segmentation faults leading me to believe that I have not properly allocated or mapped the memory.

I am trying to get an idea of how heap type addressing would be handled outside of the stack. To do that, I need access to variables from their location. These are the methods I have been trying but to no avail:

This is very difficult for me to get right without knowing the correct syntax. Can someone please provide a working example so I can get this done?:

.section .data

   array:
   .long 3,67,34,222,45,75,54,34,44,33,22,11,66,0

.globl _start
_start:

   startloop:
   movl 1, %ebx    # Should deposit 3 by location 1 into ebx 
   compl $3, %ebx
  je loopexit
   jmp startloop   # If 3 not in ebx... loop

loopexit:
   movl $1, %eax
   int $0x80

That is what I tried with .data. This is what I tried with .bss, but I still got segmentation faults:

.section .bss

   .lcomm Page, 10

.globl _start
_start:

   startloop:
   movl $3, 1    # Should deposit 3 into location 1 
   movl 1, %ebx
   compl $3, %ebx
  je loopexit
   jmp startloop   # If 3 not in ebx... loop

loopexit:
   movl $1, %eax
   int $0x80


from Recent Questions - Stack Overflow https://ift.tt/3jAYAcc
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation