mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-25 19:21:35 +01:00
userland x86_64: ASSERT_EQ show actual and expected values
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
#ifndef COMMON_ARCH_H
|
||||
#define COMMON_ARCH_H
|
||||
|
||||
#if 0
|
||||
#define ASSERT_EQ(reg, const) \
|
||||
push %rax; \
|
||||
push %rbx; \
|
||||
@@ -13,6 +14,19 @@
|
||||
pop %rax; \
|
||||
ASSERT(je); \
|
||||
;
|
||||
#endif
|
||||
|
||||
#define ASSERT_EQ(reg, const) \
|
||||
mov reg, %rdi; \
|
||||
mov const, %rsi; \
|
||||
ASSERT_EQ_DO(64); \
|
||||
;
|
||||
|
||||
#define ASSERT_EQ_DO(bits) \
|
||||
call assert_eq_ ## bits; \
|
||||
cmp $0, %rax; \
|
||||
ASSERT(je); \
|
||||
;
|
||||
|
||||
# TODO
|
||||
##define ASSERT_MEMCMP(s1, s2, n) \
|
||||
|
||||
Reference in New Issue
Block a user