Maybe I'm not understanding how scas works, but isn't the result of scasb stored in rbx in 64-bit assembly?
Nope!
scasb tests AL against ES:[RDI], setting the flags.
repnz scasb does the same, RCX times while ZF=0.
Wouldn't the assembler get confused if I used 64-bit syscalls on 32-bit registers? Or if I put some arguments of a syscall in R?? registers and others in E?? registers?
Nope! E?? registers are the lower 32 bits of R?? registers. When you use a R?? register the instrunction is prefixed with a REX prefix (and, an immediate can be bigger), like, for example:
mov eax,-1 ; B8 FF FF FF FF
mov rax,-1 ; 48 B8 FF FF FF FF FF FF FF FF
When using EAX the upper 32 bits are automagically (hehe) zeroed.
Yeah, I put it into my procedure as well after you showed your example. Wouldn't this event be highly unlikely though? I think 2^32-1 is like 4294967295 bytes so every single byte after the starting address of the string would have to be non-zero, right?
That's why it doesn't make sense using R?? registers to hold string lengths...
[]s
Fred