-
-
Notifications
You must be signed in to change notification settings - Fork 618
Expand file tree
/
Copy patharm.h
More file actions
65 lines (52 loc) · 1.16 KB
/
arm.h
File metadata and controls
65 lines (52 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef LKMC_ARM_H
#define LKMC_ARM_H
#include <lkmc/arm_aarch64.h>
#if defined(__ASSEMBLER__)
.syntax unified
#else
void lkmc_arm_psci_cpu_on(
uint32_t target_cpu,
uint32_t entry_point_address,
uint32_t context_id
);
#endif
#define LKMC_ASSERT_EQ(reg, const) \
mov r0, reg; \
ldr r1, const; \
ldr r2, =__LINE__; \
bl lkmc_assert_eq_32; \
;
#define LKMC_ASSERT_EQ_REG(reg1, reg2) \
str reg2, [sp, -4]!; \
mov r0, reg1; \
ldr r1, [sp], 4; \
ldr r2, =__LINE__; \
bl lkmc_assert_eq_32; \
;
#define LKMC_ASSERT_FAIL \
ldr r0, =__LINE__; \
bl lkmc_assert_fail; \
;
#define LKMC_ASSERT_MEMCMP(label1, label2, size) \
ldr r0, =label1; \
ldr r1, =label2; \
ldr r2, size; \
ldr r3, =__LINE__; \
bl lkmc_assert_memcmp; \
;
/* https://cirosantilli.com/linux-kernel-module-cheat#arm-calling-convention */
#define LKMC_EPILOGUE \
add sp, 16; \
ldmia sp!, {r4-r12, lr}; \
mov r0, 0; \
bx lr; \
;
/* https://cirosantilli.com/linux-kernel-module-cheat#arm-calling-convention */
#define LKMC_PROLOGUE \
.text; \
.global main; \
main: \
stmdb sp!, {r0-r12, lr}; \
main_after_prologue: \
;
#endif