On 2015-12-09 at 18:53 'Davide Libenzi' via Akaros wrote:
> Ouch, nasty 😑
> Somehow GCC split the loop in 1+N, but look at the +N part (from
> +0x30 to +0x4f).
> Unless I am blind, %ecx never gets reloaded with 16 😱
> So, it being zero, we keep copying nothing.
Oh man, it's definitely not getting set there again (at least in that
ASM chunk). And it's because GCC doesn't know that ECX is getting
clobbered:
#define __user_memcpy(dst, src, count, err, errret) \
asm volatile(ASM_STAC "\n" \
"1: rep movsb\n" \
"2: " ASM_CLAC "\n" \
".section .fixup,\"ax\"\n" \
"3: mov %4,%0\n" \
" jmp 2b\n" \
".previous\n" \
_ASM_EXTABLE(1b, 3b) \
: "=r"(err) \
: "D" (dst), "S" (src), "c" (count), "i" (errret), "0" (err) \
: "memory")
all it knows is that ecx is the input, so they think that its value is
16 and it never changes. Doh! That also explains why a one-off test
didn't work: it needs to be in a loop.
I'll play with this tomorrow morning a bit.
Thanks for spotting the issue!
Barret
--
You received this message because you are subscribed to the Google Groups
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.