linux - How to take a string as a input in Assembly x64 -


i writing program check if string palindrome or not. want take string input user. string can contain character ranging digits special characters. how can take input user. have tried following code.

global _start section .bss     string resb 9  section .text _start:     mov rax,0            ;am doing correct ?     mov rdi,0     mov rsi,string     mov rdx,8     syscall      xor rax,rax     mov rdx,[string]     mov rax,1     mov rdi,1     mov rsi,rdx     mov rdx,8     syscall      mov rax,0     mov rdi,0     syscall 

is above code correct because when output string shows segmentation fault. error is

segmentation fault (core dumped) 

i coding in nasm in linux(ubuntu 14.04)

for printing need pass address mov rdx, [string] wrong, need mov rdx, string or lea rdx, [string]. also, final syscall wrong, because that's read again. want mov rax, 60 make exit.

see, that's why should post minimal, complete, , verifiable example.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -