From e42d770e74d4a7e6cc166e3bc1552f04c20d4e20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Tue, 18 Jun 2019 00:00:02 +0000 Subject: [PATCH] x86 asm: fix LKMC_ASSERT_EQ which failed to fail for RDI! --- lkmc/x86_64.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lkmc/x86_64.h b/lkmc/x86_64.h index 96067a0..0601d41 100644 --- a/lkmc/x86_64.h +++ b/lkmc/x86_64.h @@ -4,19 +4,25 @@ /* This and other macros may make C function calls, and therefore can destroy * non-callee saved registers. */ #define LKMC_ASSERT_EQ(general1, general2) \ + push %rdi; \ mov general2, %rdi; \ push %rdi; \ + mov 8(%rsp), %rdi; \ mov general1, %rdi; \ pop %rsi; \ + add $8, %rsp; \ mov $__LINE__, %edx; \ call lkmc_assert_eq_64; \ ; #define LKMC_ASSERT_EQ_32(general1, general2) \ + push %rdi; \ mov general2, %edi; \ push %rdi; \ + mov 8(%rsp), %rdi; \ mov general1, %edi; \ pop %rsi; \ + add $8, %rsp; \ mov $__LINE__, %edx; \ call lkmc_assert_eq_32; \ ;