]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - src/patches/ipxe-use-the-right-sized-register-for-push.patch
Merge branch 'next'
[people/pmueller/ipfire-2.x.git] / src / patches / ipxe-use-the-right-sized-register-for-push.patch
1 From 08caa8be3a143d6f33782f398b7937efb39ff283 Mon Sep 17 00:00:00 2001
2 From: Justin Cano <5184128+jstncno@users.noreply.github.com>
3 Date: Thu, 3 Aug 2023 09:58:11 -0700
4 Subject: [PATCH] Use the right sized register for the push operand based on
5 the size of the value being pushed
6
7 Fixes https://github.com/ipxe/ipxe/issues/997
8 ---
9 src/arch/x86/include/librm.h | 6 ++++--
10 1 file changed, 4 insertions(+), 2 deletions(-)
11
12 diff --git a/src/arch/x86/include/librm.h b/src/arch/x86/include/librm.h
13 index 5196d390fa..d9e748adfc 100644
14 --- a/src/arch/x86/include/librm.h
15 +++ b/src/arch/x86/include/librm.h
16 @@ -250,8 +250,10 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
17 /* CODE_DEFAULT: restore default .code32/.code64 directive */
18 #ifdef __x86_64__
19 #define CODE_DEFAULT ".code64"
20 +#define PUSH "pushq"
21 #else
22 #define CODE_DEFAULT ".code32"
23 +#define PUSH "pushl"
24 #endif
25
26 /* LINE_SYMBOL: declare a symbol for the current source code line */
27 @@ -268,7 +270,7 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
28
29 /* REAL_CODE: declare a fragment of code that executes in real mode */
30 #define REAL_CODE( asm_code_str ) \
31 - "push $1f\n\t" \
32 + PUSH " $1f\n\t" \
33 "call real_call\n\t" \
34 TEXT16_CODE ( "\n1:\n\t" \
35 asm_code_str \
36 @@ -277,7 +279,7 @@ extern void remove_user_from_rm_stack ( userptr_t data, size_t size );
37
38 /* PHYS_CODE: declare a fragment of code that executes in flat physical mode */
39 #define PHYS_CODE( asm_code_str ) \
40 - "push $1f\n\t" \
41 + PUSH " $1f\n\t" \
42 "call phys_call\n\t" \
43 ".section \".text.phys\", \"ax\", @progbits\n\t"\
44 "\n" LINE_SYMBOL "\n\t" \