decon_reg: silence literal conversion warning
[GitHub/exynos8895/android_kernel_samsung_universal8895.git] / init / rkp_cfp.S
1 /*
2 *
3 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 */
20
21 #include <linux/linkage.h>
22 #include <asm/assembler.h>
23
24 .section .hyperdrive, "ax"
25 .global _start_hyperdrive
26 _start_hyperdrive:
27 # Need a nop otherwise GCC keeps _start_hyperdrive label but NOT
28 # jopp_springboard_bl label.
29 nop
30
31 #define RRX x16
32 #define RRX_32 w16
33
34 #define RRS x18
35 #define RRS_32 w18
36
37 #ifdef CONFIG_RKP_CFP_JOPP
38
39 /*
40 * Load the word just before the function instructions.
41 * Halt execution if the word doesn't match the magic number placed at function
42 * entries.
43 */
44 .macro springboard_blr, reg
45 jopp_springboard_blr_\reg:
46 push RRX, RRS
47 ldr RRX_32, [\reg, #-4]
48 subs RRX_32, RRX_32, #0xbe7, lsl #12
49 cmp RRX_32, #0xbad
50 b.eq 1f
51 /*
52 //fix for FIMC
53 mov RRX, #0xffffff80ffffffff
54 movk RRX, 0xf9ff, lsl #16
55 cmp \reg, RRX
56 b.ls 2f
57 movk RRX, #0xfa5f, lsl #16
58 cmp \reg, RRX
59 b.hi 2f
60 */
61 .inst 0xdeadc0de //crash for sure
62 1:
63 pop RRX, RRS
64 br \reg
65 2:
66 //.inst 0xdeadc0de //crash for sure
67 .endm
68
69 // Only add springboards for a register rX if there exists a "BLR rX" instruction in vmlinux to instrument
70 springboard_blr x0
71 springboard_blr x1
72 springboard_blr x2
73 springboard_blr x3
74 springboard_blr x4
75 springboard_blr x5
76 springboard_blr x6
77 springboard_blr x7
78 springboard_blr x8
79 springboard_blr x9
80 springboard_blr x10
81 springboard_blr x11
82 springboard_blr x12
83 springboard_blr x13
84 springboard_blr x14
85 springboard_blr x15
86 springboard_blr x16
87 springboard_blr x17
88 springboard_blr x18
89 springboard_blr x19
90 springboard_blr x20
91 springboard_blr x21
92 springboard_blr x22
93 springboard_blr x23
94 springboard_blr x24
95 springboard_blr x25
96 springboard_blr x26
97 springboard_blr x27
98 springboard_blr x28
99 springboard_blr x29
100 springboard_blr x30
101 // Don't need springboards for x31 (not allowed in RET by assembler)
102
103 #endif
104 .global _end_hyperdrive
105 _end_hyperdrive:
106
107 .section .text