This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-05-05 00:00:00 +00:00
parent 0ef494b681
commit aea97698c3
48 changed files with 840 additions and 798 deletions

View File

@@ -5,13 +5,13 @@
#define ASSERT_EQ(reg, const) \
ldr x11, =const; \
cmp reg, x11; \
ASSERT(beq); \
cmp reg, x11; \
ASSERT(beq); \
;
#define ASSERT_MEMCMP(s1, s2, n) \
MEMCMP(s1, s2, n); \
ASSERT_EQ(x0, 0); \
MEMCMP(s1, s2, n); \
ASSERT_EQ(x0, 0); \
;
#define ENTRY \

View File

@@ -12,14 +12,14 @@
*/
#define ASSERT_EQ(reg, const) \
ldr r11, =const; \
cmp reg, r11; \
ASSERT(beq); \
cmp reg, r11; \
ASSERT(beq); \
;
/* Assert that two arrays are the same. */
#define ASSERT_MEMCMP(s1, s2, n) \
MEMCMP(s1, s2, n); \
ASSERT_EQ(r0, 0); \
MEMCMP(s1, s2, n); \
ASSERT_EQ(r0, 0); \
;
/* Store all callee saved registers, and LR in case we make further BL calls.

View File

@@ -23,8 +23,8 @@
/* Assert that a register equals another register. */
#define ASSERT_EQ_REG(reg1, reg2) \
cmp reg1, reg2; \
ASSERT(beq); \
cmp reg1, reg2; \
ASSERT(beq); \
;
#endif

View File

@@ -5,16 +5,16 @@
int main(void) {
#if 0
uint64_t in = 0xFFFFFFFF;
uint64_t out = 0;
__asm__ (
"mov %[in], %%rax;"
"myinc %%rax;"
"movq %%rax, %[out]"
: [out] "=g" (out)
: [in] "g" (in)
: "rax"
);
assert(out == in + 1);
uint64_t in = 0xFFFFFFFF;
uint64_t out = 0;
__asm__ (
"mov %[in], %%rax;"
"myinc %%rax;"
"movq %%rax, %[out]"
: [out] "=g" (out)
: [in] "g" (in)
: "rax"
);
assert(out == in + 1);
#endif
}

View File

@@ -4,15 +4,15 @@
#include <inttypes.h>
int main(void) {
uint64_t in = 0xFFFFFFFF;
uint64_t out = 0;
__asm__ (
"mov %[in], %%rax;"
"inc %%rax;"
"movq %%rax, %[out]"
: [out] "=g" (out)
: [in] "g" (in)
: "rax"
);
assert(out == in + 1);
uint64_t in = 0xFFFFFFFF;
uint64_t out = 0;
__asm__ (
"mov %[in], %%rax;"
"inc %%rax;"
"movq %%rax, %[out]"
: [out] "=g" (out)
: [in] "g" (in)
: "rax"
);
assert(out == in + 1);
}