Question

So guys I got problem . I'm trying just to change one letter in this easy string "Hello World" so I'm trying assign value to memory cell like this

.section    .text
string:
    .ascii "Hello, world!"
length:
    .quad . -string     #Dot = 'here'

.globl _start       #Make entry point visible to linker
_start:
    movl $4, %eax       #4=write
    movl $1, %ebx       #1=stdout
    movl $string, %ecx
    movl length, %edx
    int $0x80       #Call Operating System



    movl $98,4(%ecx)   #Critical moment why cannot I do this?
    movl $98,string(,%ebx,1)  #cannot do this too ;(


    movl $4, %eax       #4=write
    movl $1, %ebx       #1=stdout
    movl $string, %ecx
    movl length, %edx
    int $0x80 





    movl $0, %ebx       #Make program return syscall exit status
    movl $1, %eax       #1=exit
    int $0x80       #Call System Again

and additional info I'm working at x64(linux) and assembling it in emulation mode x32 by linux gas so should be all right , TY for replies

Was it helpful?

Solution

You have put your string into the .text section, which is read-only. You should put it into the .data section (but don't forget to switch back to .text for the program code).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top