Commit | Line | Data |
---|---|---|
d613991a JN |
1 | Not upstreamed. |
2 | Fixes cross-build for the Hurd, from i686-linux, | |
3 | see <https://bugs.gnu.org/41982>. | |
4 | ||
5 | From 270667540146f8ef9ea7a44258a71b3837a7af4a Mon Sep 17 00:00:00 2001 | |
6 | From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org> | |
7 | Date: Sun, 21 Jun 2020 15:10:40 +0200 | |
8 | Subject: [PATCH] grub-core: Build fixes for i386 | |
9 | ||
10 | * grub-core/lib/i386/relocator64.S: Avoid x86_64 instructions on i386. | |
11 | --- | |
12 | grub-core/lib/i386/relocator64.S | 26 +++++++++++++++++++++++++- | |
13 | 1 file changed, 25 insertions(+), 1 deletion(-) | |
14 | ||
15 | diff --git a/grub-core/lib/i386/relocator64.S b/grub-core/lib/i386/relocator64.S | |
16 | index 148f38adb..45fed9444 100644 | |
17 | --- a/grub-core/lib/i386/relocator64.S | |
18 | +++ b/grub-core/lib/i386/relocator64.S | |
19 | @@ -63,7 +63,9 @@ VARIABLE(grub_relocator64_cr3) | |
20 | movq %rax, %cr3 | |
21 | #endif | |
22 | ||
23 | +#ifdef __x86_64__ | |
24 | .code64 | |
25 | +#endif | |
26 | ||
27 | /* mov imm64, %rax */ | |
28 | .byte 0x48 | |
29 | @@ -71,7 +73,14 @@ VARIABLE(grub_relocator64_cr3) | |
30 | VARIABLE(grub_relocator64_rsp) | |
31 | .quad 0 | |
32 | ||
33 | +#ifndef __x86_64__ | |
34 | + /* movq %rax, %rsp */ | |
35 | + .byte 0x48 | |
36 | + .byte 0x89 | |
37 | + .byte 0xc4 | |
38 | +#else | |
39 | movq %rax, %rsp | |
40 | +#endif | |
41 | ||
42 | #ifdef GRUB_MACHINE_EFI | |
43 | jmp LOCAL(skip_efi_stack_align) | |
44 | @@ -95,8 +104,15 @@ LOCAL(skip_efi_stack_align): | |
45 | VARIABLE(grub_relocator64_rsi) | |
46 | .quad 0 | |
47 | ||
48 | +#ifndef __x86_64__ | |
49 | + /* movq %rax, %rsi */ | |
50 | + .byte 0x48 | |
51 | + .byte 0x89 | |
52 | + .byte 0xc6 | |
53 | +#else | |
54 | movq %rax, %rsi | |
55 | - | |
56 | +#endif | |
57 | + | |
58 | /* mov imm64, %rax */ | |
59 | .byte 0x48 | |
60 | .byte 0xb8 | |
61 | @@ -128,6 +144,14 @@ VARIABLE(grub_relocator64_rdx) | |
62 | #ifdef __APPLE__ | |
63 | .byte 0xff, 0x25 | |
64 | .quad 0 | |
65 | +#elif !defined (__x86_64__) | |
66 | + /* jmp *LOCAL(jump_addr) (%rip) */ | |
67 | + .byte 0xff | |
68 | + .byte 0x25 | |
69 | + .byte 0 | |
70 | + .byte 0 | |
71 | + .byte 0 | |
72 | + .byte 0 | |
73 | #else | |
74 | jmp *LOCAL(jump_addr) (%rip) | |
75 | #endif | |
76 | -- | |
77 | Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org | |
78 | Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com | |
79 |