summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHenrik Gramner <henrik@gramner.com>2015-08-16 17:58:02 +0200
committerAnton Khirnov <anton@khirnov.net>2015-08-20 19:22:06 +0200
commite13da244f41610ee073b2f72bcf62b60fa402bb5 (patch)
tree96ee2b25ea98994274a3eac9b80c41123bf8ff3f /tests
parentfaa3f17a76333b672ce4a40cf80f678ab68bdbae (diff)
checkasm: x86: properly save rdx/edx in checked_call()
If the return value doesn't fit in a single register rdx/edx can in some cases be used in addition to rax/eax. Doesn't affect any of the existing checkasm tests but might be useful later. Also comment the relevant code a bit better. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/checkasm/x86/checkasm.asm7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/checkasm/x86/checkasm.asm b/tests/checkasm/x86/checkasm.asm
index 0864a4f7f5..20d11bc5c8 100644
--- a/tests/checkasm/x86/checkasm.asm
+++ b/tests/checkasm/x86/checkasm.asm
@@ -145,10 +145,15 @@ cglobal checked_call, 2,15,16,max_args*8+8
or r14, r5
%endif
+ ; Call fail_func() with a descriptive message to mark it as a failure
+ ; if the called function didn't preserve all callee-saved registers.
+ ; Save the return value located in rdx:rax first to prevent clobbering.
jz .ok
mov r9, rax
+ mov r10, rdx
lea r0, [error_message]
call fail_func
+ mov rdx, r10
mov rax, r9
.ok:
RET
@@ -182,9 +187,11 @@ cglobal checked_call, 1,7
or r3, r5
jz .ok
mov r3, eax
+ mov r4, edx
lea r0, [error_message]
mov [esp], r0
call fail_func
+ mov edx, r4
mov eax, r3
.ok:
add esp, max_args*4