aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Bur <cyrilbur@gmail.com>2016-09-23 02:18:16 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2016-10-04 05:10:12 -0400
commitbabcd9c4b3e8d271144da4b2b412c3b9991b35d2 (patch)
tree9409950a648921f2fcf53aaea07fdc4c8013f815
parent2b4093790abdf0219f8ca192ecc4ecc63cdb5124 (diff)
selftests/powerpc: Introduce GPR asm helper header file
Signed-off-by: Cyril Bur <cyrilbur@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--tools/testing/selftests/powerpc/gpr_asm.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/gpr_asm.h b/tools/testing/selftests/powerpc/gpr_asm.h
new file mode 100644
index 000000000000..f6f38852d3a0
--- /dev/null
+++ b/tools/testing/selftests/powerpc/gpr_asm.h
@@ -0,0 +1,96 @@
1/*
2 * Copyright 2016, Cyril Bur, IBM Corp.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9
10#ifndef _SELFTESTS_POWERPC_GPR_ASM_H
11#define _SELFTESTS_POWERPC_GPR_ASM_H
12
13#include "basic_asm.h"
14
15#define __PUSH_NVREGS(top_pos); \
16 std r31,(top_pos)(%r1); \
17 std r30,(top_pos - 8)(%r1); \
18 std r29,(top_pos - 16)(%r1); \
19 std r28,(top_pos - 24)(%r1); \
20 std r27,(top_pos - 32)(%r1); \
21 std r26,(top_pos - 40)(%r1); \
22 std r25,(top_pos - 48)(%r1); \
23 std r24,(top_pos - 56)(%r1); \
24 std r23,(top_pos - 64)(%r1); \
25 std r22,(top_pos - 72)(%r1); \
26 std r21,(top_pos - 80)(%r1); \
27 std r20,(top_pos - 88)(%r1); \
28 std r19,(top_pos - 96)(%r1); \
29 std r18,(top_pos - 104)(%r1); \
30 std r17,(top_pos - 112)(%r1); \
31 std r16,(top_pos - 120)(%r1); \
32 std r15,(top_pos - 128)(%r1); \
33 std r14,(top_pos - 136)(%r1)
34
35#define __POP_NVREGS(top_pos); \
36 ld r31,(top_pos)(%r1); \
37 ld r30,(top_pos - 8)(%r1); \
38 ld r29,(top_pos - 16)(%r1); \
39 ld r28,(top_pos - 24)(%r1); \
40 ld r27,(top_pos - 32)(%r1); \
41 ld r26,(top_pos - 40)(%r1); \
42 ld r25,(top_pos - 48)(%r1); \
43 ld r24,(top_pos - 56)(%r1); \
44 ld r23,(top_pos - 64)(%r1); \
45 ld r22,(top_pos - 72)(%r1); \
46 ld r21,(top_pos - 80)(%r1); \
47 ld r20,(top_pos - 88)(%r1); \
48 ld r19,(top_pos - 96)(%r1); \
49 ld r18,(top_pos - 104)(%r1); \
50 ld r17,(top_pos - 112)(%r1); \
51 ld r16,(top_pos - 120)(%r1); \
52 ld r15,(top_pos - 128)(%r1); \
53 ld r14,(top_pos - 136)(%r1)
54
55#define PUSH_NVREGS(stack_size) \
56 __PUSH_NVREGS(stack_size + STACK_FRAME_MIN_SIZE)
57
58/* 18 NV FPU REGS */
59#define PUSH_NVREGS_BELOW_FPU(stack_size) \
60 __PUSH_NVREGS(stack_size + STACK_FRAME_MIN_SIZE - (18 * 8))
61
62#define POP_NVREGS(stack_size) \
63 __POP_NVREGS(stack_size + STACK_FRAME_MIN_SIZE)
64
65/* 18 NV FPU REGS */
66#define POP_NVREGS_BELOW_FPU(stack_size) \
67 __POP_NVREGS(stack_size + STACK_FRAME_MIN_SIZE - (18 * 8))
68
69/*
70 * Careful calling this, it will 'clobber' NVGPRs (by design)
71 * Don't call this from C
72 */
73FUNC_START(load_gpr)
74 ld r14,0(r3)
75 ld r15,8(r3)
76 ld r16,16(r3)
77 ld r17,24(r3)
78 ld r18,32(r3)
79 ld r19,40(r3)
80 ld r20,48(r3)
81 ld r21,56(r3)
82 ld r22,64(r3)
83 ld r23,72(r3)
84 ld r24,80(r3)
85 ld r25,88(r3)
86 ld r26,96(r3)
87 ld r27,104(r3)
88 ld r28,112(r3)
89 ld r29,120(r3)
90 ld r30,128(r3)
91 ld r31,136(r3)
92 blr
93FUNC_END(load_gpr)
94
95
96#endif /* _SELFTESTS_POWERPC_GPR_ASM_H */