summaryrefslogtreecommitdiffstats
path: root/Revert-x86-efi-Fixup-GOT-in-all-boot-code-paths.patch
blob: 842901a6d41cd5ed6e8fc6a4a24aa38b2c2f6e1a (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
From 6b57872f1ef945b97044a7fbbd75dfb526cd6aff Mon Sep 17 00:00:00 2001
From: Josh Boyer <jwboyer@fedoraproject.org>
Date: Mon, 22 Sep 2014 14:45:11 -0400
Subject: [PATCH] Revert "x86/efi: Fixup GOT in all boot code paths"

This reverts commit 9cb0e394234d244fe5a97e743ec9dd7ddff7e64b.
---
 arch/x86/boot/compressed/head_32.S | 54 ++++++++++--------------------------
 arch/x86/boot/compressed/head_64.S | 56 ++++++++++----------------------------
 2 files changed, 29 insertions(+), 81 deletions(-)

diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index d6b8aa4c986c..cbed1407a5cd 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -30,33 +30,6 @@
 #include <asm/boot.h>
 #include <asm/asm-offsets.h>
 
-/*
- * Adjust our own GOT
- *
- * The relocation base must be in %ebx
- *
- * It is safe to call this macro more than once, because in some of the
- * code paths multiple invocations are inevitable, e.g. via the efi*
- * entry points.
- *
- * Relocation is only performed the first time.
- */
-.macro FIXUP_GOT
-	cmpb	$1, got_fixed(%ebx)
-	je	2f
-
-	leal	_got(%ebx), %edx
-	leal	_egot(%ebx), %ecx
-1:
-	cmpl	%ecx, %edx
-	jae	2f
-	addl	%ebx, (%edx)
-	addl	$4, %edx
-	jmp	1b
-2:
-	movb	$1, got_fixed(%ebx)
-.endm
-
 	__HEAD
 ENTRY(startup_32)
 #ifdef CONFIG_EFI_STUB
@@ -83,9 +56,6 @@ ENTRY(efi_pe_entry)
 	add	%esi, 88(%eax)
 	pushl	%eax
 
-	movl	%esi, %ebx
-	FIXUP_GOT
-
 	call	make_boot_params
 	cmpl	$0, %eax
 	je	fail
@@ -111,10 +81,6 @@ ENTRY(efi32_stub_entry)
 	leal	efi32_config(%esi), %eax
 	add	%esi, 88(%eax)
 	pushl	%eax
-
-	movl	%esi, %ebx
-	FIXUP_GOT
-
 2:
 	call	efi_main
 	cmpl	$0, %eax
@@ -224,7 +190,19 @@ relocated:
 	shrl	$2, %ecx
 	rep	stosl
 
-	FIXUP_GOT
+/*
+ * Adjust our own GOT
+ */
+	leal	_got(%ebx), %edx
+	leal	_egot(%ebx), %ecx
+1:
+	cmpl	%ecx, %edx
+	jae	2f
+	addl	%ebx, (%edx)
+	addl	$4, %edx
+	jmp	1b
+2:
+
 /*
  * Do the decompression, and jump to the new kernel..
  */
@@ -247,12 +225,8 @@ relocated:
 	xorl	%ebx, %ebx
 	jmp	*%eax
 
-	.data
-/* Have we relocated the GOT? */
-got_fixed:
-	.byte 0
-
 #ifdef CONFIG_EFI_STUB
+	.data
 efi32_config:
 	.fill 11,8,0
 	.long efi_call_phys
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index 50f69c7eaaf4..2884e0c3e8a5 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -32,33 +32,6 @@
 #include <asm/processor-flags.h>
 #include <asm/asm-offsets.h>
 
-/*
- * Adjust our own GOT
- *
- * The relocation base must be in %rbx
- *
- * It is safe to call this macro more than once, because in some of the
- * code paths multiple invocations are inevitable, e.g. via the efi*
- * entry points.
- *
- * Relocation is only performed the first time.
- */
-.macro FIXUP_GOT
-	cmpb	$1, got_fixed(%rip)
-	je	2f
-
-	leaq	_got(%rip), %rdx
-	leaq	_egot(%rip), %rcx
-1:
-	cmpq	%rcx, %rdx
-	jae	2f
-	addq	%rbx, (%rdx)
-	addq	$8, %rdx
-	jmp	1b
-2:
-	movb	$1, got_fixed(%rip)
-.endm
-
 	__HEAD
 	.code32
 ENTRY(startup_32)
@@ -279,13 +252,10 @@ ENTRY(efi_pe_entry)
 	subq	$1b, %rbp
 
 	/*
-	 * Relocate efi_config->call() and the GOT entries.
+	 * Relocate efi_config->call().
 	 */
 	addq	%rbp, efi64_config+88(%rip)
 
-	movq	%rbp, %rbx
-	FIXUP_GOT
-
 	movq	%rax, %rdi
 	call	make_boot_params
 	cmpq	$0,%rax
@@ -301,13 +271,10 @@ handover_entry:
 	subq	$1b, %rbp
 
 	/*
-	 * Relocate efi_config->call() and the GOT entries.
+	 * Relocate efi_config->call().
 	 */
 	movq	efi_config(%rip), %rax
 	addq	%rbp, 88(%rax)
-
-	movq	%rbp, %rbx
-	FIXUP_GOT
 2:
 	movq	efi_config(%rip), %rdi
 	call	efi_main
@@ -418,8 +385,19 @@ relocated:
 	shrq	$3, %rcx
 	rep	stosq
 
-	FIXUP_GOT
-
+/*
+ * Adjust our own GOT
+ */
+	leaq	_got(%rip), %rdx
+	leaq	_egot(%rip), %rcx
+1:
+	cmpq	%rcx, %rdx
+	jae	2f
+	addq	%rbx, (%rdx)
+	addq	$8, %rdx
+	jmp	1b
+2:
+	
 /*
  * Do the decompression, and jump to the new kernel..
  */
@@ -459,10 +437,6 @@ gdt:
 	.quad   0x0000000000000000	/* TS continued */
 gdt_end:
 
-/* Have we relocated the GOT? */
-got_fixed:
-	.byte	0
-
 #ifdef CONFIG_EFI_STUB
 efi_config:
 	.quad	0
-- 
1.9.3