fix clobber of edx in i386 vsyscall asm
authorRich Felker <dalias@aerifal.cx>
Sun, 11 Nov 2012 18:56:37 +0000 (13:56 -0500)
committerRich Felker <dalias@aerifal.cx>
Sun, 11 Nov 2012 18:56:37 +0000 (13:56 -0500)
this function does not obey the normal calling convention; like a
syscall instruction, it's expected not to clobber any registers except
the return value. clobbering edx could break callers that were reusing
the value cached in edx after the syscall returns.

src/internal/i386/syscall.s

index 291168c3240b55007132d4d479936b378d22fd78..2914aceeb9f779c1055692c30b550aaf4bc0f228 100644 (file)
@@ -16,7 +16,8 @@ __vsyscall:
        mov 12(%esp),%edi
        push %eax
        call 1f
-2:     pop %ebx
+2:     mov %ebx,%edx
+       pop %ebx
        pop %ebx
        pop %edi
        ret