gnu: Add goxel.
[jackhill/guix/guix.git] / gnu / packages / patches / grub-cross-system-i686.patch
CommitLineData
d613991a
JN
1Not upstreamed.
2Fixes cross-build for the Hurd, from i686-linux,
3see <https://bugs.gnu.org/41982>.
4
54e70a70 5From 17b242e7b80108f1467037e15b605595e4823b2e Mon Sep 17 00:00:00 2001
d613991a
JN
6From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
7Date: Sun, 21 Jun 2020 15:10:40 +0200
54e70a70
JN
8Subject: [PATCH v2] grub-core: Build fixes for i386
9Content-Transfer-Encoding: 8bit
10Content-Type: text/plain; charset=UTF-8
d613991a
JN
11
12* grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386.
13---
54e70a70
JN
14 grub-core/lib/i386/relocator64.S | 33 +++++++++++++++++++++++++++++++-
15 1 file changed, 32 insertions(+), 1 deletion(-)
d613991a
JN
16
17diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocator64.S
54e70a70 18index 148f38adb..ea39908c1 100644
d613991a
JN
19--- a/grub-core/lib/i386/relocator64.S
20+++ b/grub-core/lib/i386/relocator64.S
21@@ -63,7 +63,9 @@ VARIABLE(grub_relocator64_cr3)
22 movq %rax, %cr3
23 #endif
24
25+#ifdef __x86_64__
26 .code64
27+#endif
28
29 /* mov imm64, %rax */
30 .byte 0x48
31@@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3)
32 VARIABLE(grub_relocator64_rsp)
33 .quad 0
34
35+#ifndef __x86_64__
36+ /* movq %rax, %rsp */
37+ .byte 0x48
38+ .byte 0x89
39+ .byte 0xc4
40+#else
41 movq %rax, %rsp
42+#endif
43
44 #ifdef GRUB_MACHINE_EFI
45 jmp LOCAL(skip_efi_stack_align)
54e70a70
JN
46@@ -85,7 +94,14 @@ VARIABLE(grub_relocator64_rsp)
47 */
48 VARIABLE(grub_relocator64_efi_start)
49 /* Align the stack as UEFI spec requires. */
50+#ifndef __x86_64__
51+ .byte 0x48
52+ .byte 0x83
53+ .byte 0xe4
54+ .byte 0xf0
55+#else
56 andq $~15, %rsp
57+#endif
58
59 LOCAL(skip_efi_stack_align):
60 #endif
61@@ -95,8 +111,15 @@ LOCAL(skip_efi_stack_align):
d613991a
JN
62 VARIABLE(grub_relocator64_rsi)
63 .quad 0
64
65+#ifndef __x86_64__
66+ /* movq %rax, %rsi */
67+ .byte 0x48
68+ .byte 0x89
69+ .byte 0xc6
70+#else
71 movq %rax, %rsi
72-
73+#endif
74+
75 /* mov imm64, %rax */
76 .byte 0x48
77 .byte 0xb8
54e70a70 78@@ -128,6 +151,14 @@ VARIABLE(grub_relocator64_rdx)
d613991a
JN
79 #ifdef __APPLE__
80 .byte 0xff, 0x25
81 .quad 0
82+#elif !defined (__x86_64__)
83+ /* jmp *LOCAL(jump_addr) (%rip) */
84+ .byte 0xff
85+ .byte 0x25
86+ .byte 0
87+ .byte 0
88+ .byte 0
89+ .byte 0
90 #else
91 jmp *LOCAL(jump_addr) (%rip)
92 #endif
93--
94Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
95Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com
96