why does an int 0x80
change value of rsi
register as integer but not as char?
My code, it should read line and it does, if I want to print the whole line than there is no problem:
lp:
save
mov rax, 3
mov rbx, 2
mov rcx, rsi
mov rdx, 1
int 80h
load
cmp [rsi], byte 0xa
je done
inc rsi
jmp lp
done:
save
and load
are macros which push
and pop
rax
, rbx
, rcx
and rdx
.
First iteration is everything ok, but second one the integer value of [rsi]
changes but cahr value still the same as seen in gdb
:
13: $rdi = 4206592
14: $rsi = 4206593
15: *(int*)($rdi) = 14391
16: *(int*)($rdi+1) = 56
17: *(char*)($rdi) = 55 '7'
18: *(char*)($rdi+1) = 56 '8'
In gdb
I am looking at rdi
because it should be the same values as rsi
.
I tried to create static variable of size db
and fill that variable instead of rsi
. But I am learning how to allocate memory so this is not the purpose why I am doing that.