assembly - Segmentation Fault on store with nasm and no stdlib -


i'm building benchmark in assembly , compile nasm. wanto reduce instruction overhead as can followed article manage goal. followed until half of tutorial.

the problem can't find way store values: compilation terminates (compiled nasm test.asm -o test && chmod +x ./test), while executing store ( mov dword [count], eax ) obtain segmentation fault. can't find what's wrong code. here is:

bits 32 org     0x08048000 ehdr:                                       ; elf32_ehdr     db      0x7f, "elf", 1, 1, 1, 0         ;   e_ident     times 8 db      0     dw      2                               ;   e_type     dw      3                               ;   e_machine     dd      1                               ;   e_version     dd      _start                          ;   e_entry     dd      phdr - $$                       ;   e_phoff     dd      0                               ;   e_shoff     dd      0                               ;   e_flags     dw      ehdrsize                        ;   e_ehsize     dw      phdrsize                        ;   e_phentsize     dw      1                               ;   e_phnum     dw      0                               ;   e_shentsize     dw      0                               ;   e_shnum     dw      0                               ;   e_shstrndx  ehdrsize      equ     $ - ehdr  phdr:                                       ; elf32_phdr     dd      1                               ;   p_type     dd      0                               ;   p_offset     dd      $$                              ;   p_vaddr     dd      $$                              ;   p_paddr     dd      filesize                        ;   p_filesz     dd      filesize                        ;   p_memsz     dd      5                               ;   p_flags     dd      0x1000                          ;   p_align  phdrsize      equ     $ - phdr  _start:      mov eax, dword [count]                  ;load     inc eax                                 ;increment     mov dword [count], eax                 ;store     mov     eax,1                           ;set exit syscall     int     0x80  count   dd    0 ; want load, increment , store count  filesize      equ     $ - $$ 

how can store values correctly?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -