Reuse 32 bit C code more safely
v7 cover Reuse 32 bit C code more safely
This series attempt to:
- use more C code, that is replace some assembly code with C;
- avoid some code duplication between C and assembly;
- prevent some issues having relocations in C code.
The idea is extending the current C to binary code conversion done for 32 bit C code called from head.S making sure relocations are safe and allowing external symbols usage from C code.
More details of the implementation are in commit message 1/5, which is the largest patch.
Patch 2/5 reuses code to relocate the trampoline between 32 and 64 bit. Patches 3/5 and 4/5 move some code from assembly to C.
Other RFC commits were excluded, I didn't manage to entangle the issues sharing headers between 32 and 64 bits.
Since RFC code was more tested, also with CI and some incompatibility were fixed. On that it's weird that we need Python 3.8 for Qemu but we still use Python 2 for Xen. Shouldn't we bump requirement to Python 3 even for Xen?
Code boots successfully using:
- BIOS boot;
- EFI boot with Grub2 and ELF file;
- direct EFI boot without Grub.
Code is currently based on "master" branch, currently commit fa1463cecf59d7419e4c83ed30360c4eb83bde41.
Changes since v1:
- 2 preliminary commits for adjust .gitignore;
- last commit split (one variable at a time);
- lot of style and names changes;
- first commit, now 3/6 had some build changes, more details on commit message.
Changes since v2:
- removed merged commits;
- reverted order of 2 commits;
- remove some useless casts;
- added change to comment.
Changes since v3:
- added a preparation commit for Makefiles (mainly written by Andrew Cooper);
- added a comment improvement commit;
- allows also data;
- other minor style changes;
- added some Reviewed-by.
Changes since v4:
- add build32.final.lds build32.other.lds to targets macro;
- place some comments over a rule, not inside;
- simplified linking and producing binary rule;
- renamed built_in_32 to built-in-32, coding style;
- fix minor indentation;
- put magic numbers in Makefile and propagate them;
- minor variable clanups in Python script;
- add dependency to Python script.
Changes since v5:
- all Makefile changes;
- renamed "other" and "final" phases to "base" and "offset";
- use if_changed macro to generate built-in-32.S;
- do not add obj64 to targets, already done adding it to obj-bin-y.
Changes since v6:
- lot of style and comments, see details on 1/5.
Frediano Ziglio (5):
x86/boot: Rework how 32bit C is linked/included for early boot x86/boot: Reuse code to relocate trampoline x86/boot: Use boot_vid_info variable directly from C code x86/boot: Use trampoline_phys variable directly from C code x86/boot: Clarify comment
xen/arch/x86/boot/.gitignore | 6 +-
xen/arch/x86/boot/Makefile | 74 +++++-
.../x86/boot/{build32.lds => build32.lds.S} | 41 +++-
xen/arch/x86/boot/cmdline.c | 12 -
xen/arch/x86/boot/head.S | 49 +---
xen/arch/x86/boot/reloc-trampoline.c | 36 +++
xen/arch/x86/boot/reloc.c | 35 +--
xen/arch/x86/efi/efi-boot.h | 15 +-
xen/tools/combine_two_binaries.py | 220 ++++++++++++++++++
9 files changed, 377 insertions(+), 111 deletions(-)
rename xen/arch/x86/boot/{build32.lds => build32.lds.S} (60%)
create mode 100644 xen/arch/x86/boot/reloc-trampoline.c
create mode 100755 xen/tools/combine_two_binaries.pySignature · 1 line
2.34.1
PATCH v7 1/5 x86/boot: Rework how 32bit C is linked/included for early boot
Right now, the two functions which were really too complicated to write in asm are compiled as 32bit PIC, linked to a blob and included directly, using global asm() to arrange for them to have function semantics.
This is limiting and fragile; the use of data relocations will compile fine but malfunction when used, creating hard-to-debug bugs.
Furthermore, we would like to increase the amount of C, to deduplicate/unify Xen's boot logic, as well as making it easier to follow. Therefore, rework how the 32bit objects are included.
Link all 32bit objects together first. This allows for sharing of logic between translation units. Use differential linking and explicit imports/exports to confirm that we only have the expected relocations, and write the object back out as an assembly file so it can be linked again as if it were 64bit, to integrate with the rest of Xen.
This allows for the use of external references (e.g. access to global variables) with reasonable assurance of doing so safely.
No functional change.
---
Changes since v2:
- removed W^X limitation, allowing data;
- added some comments to python script;
- added extension to python script;
- added header to generated assembly code from python script;
- added starting symbol to generated assembly code from python script to make disassembly more clear;
- other minor style changes to python script.
Changes since v4:
- add build32.final.lds build32.other.lds to targets macro;
- place some comments over a rule, not inside;
- simplified linking and producing binary rule;
- renamed built_in_32 to built-in-32, coding style;
- fix minor indentation;
- put magic numbers in Makefile and propagate them;
- minor variable cleanups in Python script;
- add dependency to Python script.
Changes since v5:
- renamed "other" and "final" phases to "base" and "offset";
- use if_changed macro to generate built-in-32.S.
Changes since v6:
- update some indentation to make code more coherent;
- move some comments from commit message to code;
- rewrote commit message (Andrew Cooper);
- add missing file to .gitignore;
- rollback a change in section order.
---
xen/arch/x86/boot/.gitignore | 6 +-
xen/arch/x86/boot/Makefile | 66 +++++-
.../x86/boot/{build32.lds => build32.lds.S} | 35 ++-
xen/arch/x86/boot/cmdline.c | 12 -
xen/arch/x86/boot/head.S | 12 -
xen/arch/x86/boot/reloc.c | 14 --
xen/tools/combine_two_binaries.py | 220 ++++++++++++++++++
7 files changed, 314 insertions(+), 51 deletions(-)
rename xen/arch/x86/boot/{build32.lds => build32.lds.S} (66%)
create mode 100755 xen/tools/combine_two_binaries.pyxen/arch/x86/boot/.gitignore +4 -2
@@ -1,3 +1,5 @@ /mkelf32 -/*.bin -/*.lnk +/build32.*.lds +/built-in-32.*.bin +/built-in-32.*.map +/built-in-32.S
xen/arch/x86/boot/Makefile +58 -8
85 lines not on this page · raw message
xen/arch/x86/boot/build32.lds.S renamed from xen/arch/x86/boot/build32.lds +32 -3
@@ -15,12 +15,37 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -ENTRY(_start) +#ifdef FINAL +# undef GAP +# define GAP 0 +# define MULT 0 +# define TEXT_START +#else +# define MULT 1 +# define TEXT_START TEXT_DIFF +#endif +#define DECLARE_IMPORT(name) name = . + (__LINE__ * MULT) + +ENTRY(dummy_start) SECTIONS { /* Merge code and data into one section. */ - .text : { + .text TEXT_START : { + /* Silence linker warning, we are not going to use it */ + dummy_start = .; + + /* + * Any symbols used should be declared below, this ensures which + * symbols are visible to the 32bit C boot code. + * With the exception of using external 32 bit function (maybe + * exported by head.S) they should point all to variables. + * Attention should be paid to pointers taking care of possible later + * relocation. + */ + DECLARE_IMPORT(__base_relocs_start); + DECLARE_IMPORT(__base_relocs_end); + . = . + GAP; *(.text) *(.text.*) *(.data)
@@ -30,7 +55,11 @@ SECTIONS *(.bss) *(.bss.*) } - + /DISCARD/ : { + *(.comment) + *(.comment.*) + *(.note.*) + } /* Dynamic linkage sections. Collected simply so we can check they're empty. */ .got : { *(.got)
xen/arch/x86/boot/cmdline.c +0 -12
@@ -18,18 +18,6 @@* Linux kernel source (linux/lib/string.c). */ -/* -* This entry point is entered from xen/arch/x86/boot/head.S with: -* - %eax = &cmdline, -* - %edx = &early_boot_opts. -*/ -asm ( -" .text \n" -" .globl _start \n" -"_start: \n" -" jmp cmdline_parse_early \n" - ); -#include <xen/compiler.h> #include <xen/kconfig.h> #include <xen/macros.h>
xen/arch/x86/boot/head.S +0 -12
@@ -759,18 +759,6 @@ trampoline_setup: /* Jump into the relocated trampoline. */ lret - /* - * cmdline and reloc are written in C, and linked to be 32bit PIC with - * entrypoints at 0 and using the fastcall convention. - */ -FUNC_LOCAL(cmdline_parse_early) - .incbin "cmdline.bin" -END(cmdline_parse_early) - -FUNC_LOCAL(reloc) - .incbin "reloc.bin" -END(reloc) - ENTRY(trampoline_start) #include "trampoline.S" ENTRY(trampoline_end)
xen/arch/x86/boot/reloc.c +0 -14
@@ -12,20 +12,6 @@* Daniel Kiper <[email protected]> */ -/* -* This entry point is entered from xen/arch/x86/boot/head.S with: -* - %eax = MAGIC, -* - %edx = INFORMATION_ADDRESS, -* - %ecx = TOPMOST_LOW_MEMORY_STACK_ADDRESS. -* - 0x04(%esp) = BOOT_VIDEO_INFO_ADDRESS. -*/ -asm ( -" .text \n" -" .globl _start \n" -"_start: \n" -" jmp reloc \n" - ); -#include <xen/compiler.h> #include <xen/macros.h> #include <xen/types.h>
xen/tools/combine_two_binaries.py new file +220 -0
220 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v7 1/5] x86/boot: Rework how 32bit C is linked/included for early boot
Quoted 17 lines · Frediano Ziglio
Right now, the two functions which were really too complicated to write in asm are compiled as 32bit PIC, linked to a blob and included directly, using global
asm()to arrange for them to have function semantics.This is limiting and fragile; the use of data relocations will compile fine but malfunction when used, creating hard-to-debug bugs.
Furthermore, we would like to increase the amount of C, to deduplicate/unify Xen's boot logic, as well as making it easier to follow. Therefore, rework how the 32bit objects are included.
Link all 32bit objects together first. This allows for sharing of logic between translation units. Use differential linking and explicit imports/exports to confirm that we only have the expected relocations, and write the object back out as an assembly file so it can be linked again as if it were 64bit, to integrate with the rest of Xen.
Quoted 7 lines
This allows for the use of external references (e.g. access to global variables) with reasonable assurance of doing so safely.
No functional change.
Signed-off-by Frediano Ziglio <[email protected]>Reviewed-by Anthony PERARD <[email protected]>
PATCH v7 2/5 x86/boot: Reuse code to relocate trampoline
In reply to Frediano ZiglioMove code from efi-boot.h to a separate, new, reloc-trampoline.c file. Reuse this new code, compiling it for 32bit as well, to replace assembly code in head.S doing the same thing.
---
Changes since v3:
- fixed a typo in comment;
- added Reviewed-by.
Changes since v5:
- do not add obj64 to targets, already done adding it to obj-bin-y.
Changes since v6:
- added Acked-by.
--- xen/arch/x86/boot/Makefile | 10 +++++--- xen/arch/x86/boot/build32.lds.S | 5 ++++ xen/arch/x86/boot/head.S | 23 +----------------- xen/arch/x86/boot/reloc-trampoline.c | 36 ++++++++++++++++++++++++++++ xen/arch/x86/efi/efi-boot.h | 15 ++---------- 5 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 xen/arch/x86/boot/reloc-trampoline.c
xen/arch/x86/boot/Makefile +7 -3
@@ -1,11 +1,15 @@ obj-bin-y += head.o obj-bin-y += built-in-32.o +obj-bin-y += $(obj64) obj32 := cmdline.32.o obj32 += reloc.32.o +obj32 += reloc-trampoline.32.o -nocov-y += $(obj32) -noubsan-y += $(obj32) +obj64 := reloc-trampoline.o + +nocov-y += $(obj32) $(obj64) +noubsan-y += $(obj32) $(obj64) targets += $(obj32) obj32 := $(addprefix $(obj)/,$(obj32))
@@ -75,7 +79,7 @@ cmd_combine = \ --bin1 $(obj)/built-in-32.base.bin \ --bin2 $(obj)/built-in-32.offset.bin \ --map $(obj)/built-in-32.offset.map \ - --exports cmdline_parse_early,reloc \ + --exports cmdline_parse_early,reloc,reloc_trampoline32 \ --output $@ targets += built-in-32.S
xen/arch/x86/boot/build32.lds.S +5 -0
@@ -45,6 +45,11 @@ SECTIONS */ DECLARE_IMPORT(__base_relocs_start); DECLARE_IMPORT(__base_relocs_end); + DECLARE_IMPORT(__trampoline_rel_start); + DECLARE_IMPORT(__trampoline_rel_stop); + DECLARE_IMPORT(__trampoline_seg_start); + DECLARE_IMPORT(__trampoline_seg_stop); + DECLARE_IMPORT(trampoline_phys); . = . + GAP; *(.text) *(.text.*)
xen/arch/x86/boot/head.S +1 -22
@@ -706,28 +706,7 @@ trampoline_setup: mov %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8) /* Apply relocations to bootstrap trampoline. */ - mov sym_esi(trampoline_phys), %edx - lea sym_esi(__trampoline_rel_start), %edi - lea sym_esi(__trampoline_rel_stop), %ecx -1: - mov (%edi), %eax - add %edx, (%edi, %eax) - add $4,%edi - - cmp %ecx, %edi - jb 1b - - /* Patch in the trampoline segment. */ - shr $4,%edx - lea sym_esi(__trampoline_seg_start), %edi - lea sym_esi(__trampoline_seg_stop), %ecx -1: - mov (%edi), %eax - mov %dx, (%edi, %eax) - add $4,%edi - - cmp %ecx, %edi - jb 1b + call reloc_trampoline32 /* Do not parse command line on EFI platform here. */ cmpb $0, sym_esi(efi_platform)
xen/arch/x86/boot/reloc-trampoline.c new file +36 -0
@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <xen/compiler.h> +#include <xen/stdint.h> +#include <asm/trampoline.h> + +extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[]; +extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[]; + +#if defined(__i386__) +void reloc_trampoline32(void) +#elif defined (__x86_64__) +void reloc_trampoline64(void) +#else +#error Unknown architecture +#endif +{ +unsigned long phys = trampoline_phys; +const int32_t *trampoline_ptr; + +/* +* Apply relocations to trampoline. +* +* This modifies the trampoline in place within Xen, so that it will +* operate correctly when copied into place. +*/ +for ( trampoline_ptr = __trampoline_rel_start; + trampoline_ptr < __trampoline_rel_stop; + ++trampoline_ptr ) + *(uint32_t *)(*trampoline_ptr + (long )trampoline_ptr) += phys; + +for ( trampoline_ptr = __trampoline_seg_start; + trampoline_ptr < __trampoline_seg_stop; + ++trampoline_ptr ) + *(uint16_t *)(*trampoline_ptr + (long )trampoline_ptr) = phys >>4 ; +}
xen/arch/x86/efi/efi-boot.h +2 -13
@@ -103,27 +103,16 @@ static void __init efi_arch_relocate_image(unsigned long delta) } } -extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[]; -extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[]; +void reloc_trampoline64 (void );static void __init relocate_trampoline (unsigned long phys) { -const int32_t *trampoline_ptr; - trampoline_phys = phys;if ( !efi_enabled (EFI_LOADER ) )return ; -/* Apply relocations to trampoline. */ -for ( trampoline_ptr = __trampoline_rel_start; - trampoline_ptr < __trampoline_rel_stop; - ++trampoline_ptr ) - *(u32 *)(*trampoline_ptr + (long )trampoline_ptr) += phys; -for ( trampoline_ptr = __trampoline_seg_start; - trampoline_ptr < __trampoline_seg_stop; - ++trampoline_ptr ) - *(u16 *)(*trampoline_ptr + (long )trampoline_ptr) = phys >>4 ; +reloc_trampoline64 (); }static void __init place_string (u32 *addr,const char *s)
Signature · 1 line
2.34.1
PATCH v7 3/5 x86/boot: Use boot_vid_info variable directly from C code
In reply to Frediano ZiglioNo more need to pass from assembly code.
---
Changes since v1:
- split the 2 variable changes into 2 commits.
Changes since v2:
- revert commit order.
--- xen/arch/x86/boot/build32.lds.S | 1 + xen/arch/x86/boot/head.S | 10 +--------- xen/arch/x86/boot/reloc.c | 13 +++++-------- 3 files changed, 7 insertions(+), 17 deletions(-)
xen/arch/x86/boot/build32.lds.S +1 -0
@@ -50,6 +50,7 @@ SECTIONS DECLARE_IMPORT(__trampoline_seg_start); DECLARE_IMPORT(__trampoline_seg_stop); DECLARE_IMPORT(trampoline_phys); + DECLARE_IMPORT(boot_vid_info); . = . + GAP; *(.text) *(.text.*)
xen/arch/x86/boot/head.S +1 -9
@@ -514,18 +514,10 @@ trampoline_setup: mov sym_esi(trampoline_phys), %ecx add $TRAMPOLINE_SPACE,%ecx -#ifdef CONFIG_VIDEO - lea sym_esi(boot_vid_info), %edx -#else - xor %edx, %edx -#endif - /* Save Multiboot / PVH info struct (after relocation) for later use. */ - push %edx /* Boot video info to be filled from MB2. */ mov %ebx, %edx /* Multiboot / PVH information address. */ - /* reloc(magic/eax, info/edx, trampoline/ecx, video/stk) using fastcall. */ + /* reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */ call reloc - add $4, %esp #ifdef CONFIG_PVH_GUEST cmpb $0, sym_esi(pvh_boot)
xen/arch/x86/boot/reloc.c +5 -8
@@ -176,7 +176,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in, memctx *ctx)return mbi_out; } -static multiboot_info_t *mbi2_reloc (uint32_t mbi_in,uint32_t video_out,memctx *ctx) +static multiboot_info_t *mbi2_reloc (uint32_t mbi_in,memctx *ctx) {const multiboot2_fixed_t *mbi_fix =_p (mbi_in);const multiboot2_memory_map_t *mmap_src;
@@ -185,7 +185,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctxmemory_map_t *mmap_dst;multiboot_info_t *mbi_out;#ifdef CONFIG_VIDEO -struct boot_video_info *video =NULL ; +struct boot_video_info *video = &boot_vid_info;#endif uint32_t ptr;unsigned int i, mod_idx =0 ;
@@ -290,12 +290,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx#ifdef CONFIG_VIDEO case MULTIBOOT2_TAG_TYPE_VBE : -if ( video_out ) +if ( video ) {const struct vesa_ctrl_info *ci;const struct vesa_mode_info *mi; - video =_p (video_out); ci = (const void *)get_mb2_data (tag, vbe, vbe_control_info); mi = (const void *)get_mb2_data (tag, vbe, vbe_mode_info);
@@ -321,7 +320,6 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctxif ( (get_mb2_data (tag, framebuffer, framebuffer_type) !=MULTIBOOT2_FRAMEBUFFER_TYPE_RGB ) ) { - video_out =0 ; video =NULL ; }break ;
@@ -346,8 +344,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx }/* SAF-1-safe */ -void *reloc (uint32_t magic,uint32_t in,uint32_t trampoline, -uint32_t video_info) +void *reloc (uint32_t magic,uint32_t in,uint32_t trampoline) {memctx ctx = { trampoline };
@@ -357,7 +354,7 @@ void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,return mbi_reloc (in, &ctx);case MULTIBOOT2_BOOTLOADER_MAGIC : -return mbi2_reloc (in, video_info, &ctx); +return mbi2_reloc (in, &ctx);case XEN_HVM_START_MAGIC_VALUE :if (IS_ENABLED (CONFIG_PVH_GUEST ) )
Signature · 1 line
2.34.1
PATCH v7 4/5 x86/boot: Use trampoline_phys variable directly from C code
In reply to Frediano ZiglioNo more need to pass from assembly code.
---
Changes since v1:
- split the 2 variable changes into 2 commits.
Changes since v2:
- revert commit order;
- avoid useless casts.
--- xen/arch/x86/boot/head.S | 6 +----- xen/arch/x86/boot/reloc.c | 8 ++++++-- 2 files changed, 7 insertions(+), 7 deletions(-)
xen/arch/x86/boot/head.S +1 -5
@@ -510,13 +510,9 @@ trampoline_setup: mov %esi, sym_esi(xen_phys_start) mov %esi, sym_esi(trampoline_xen_phys_start) - /* Get bottom-most low-memory stack address. */ - mov sym_esi(trampoline_phys), %ecx - add $TRAMPOLINE_SPACE,%ecx - /* Save Multiboot / PVH info struct (after relocation) for later use. */ mov %ebx, %edx /* Multiboot / PVH information address. */ - /* reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */ + /* reloc(magic/eax, info/edx) using fastcall. */ call reloc #ifdef CONFIG_PVH_GUEST
xen/arch/x86/boot/reloc.c +6 -2
@@ -19,6 +19,9 @@#include <xen/kconfig.h> #include <xen/multiboot.h> #include <xen/multiboot2.h> +#include <xen/page-size.h> + +#include <asm/trampoline.h> #include <public/arch-x86/hvm/start_info.h>
@@ -344,9 +347,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx) }/* SAF-1-safe */ -void *reloc (uint32_t magic,uint32_t in,uint32_t trampoline) +void *reloc (uint32_t magic,uint32_t in) { -memctx ctx = { trampoline }; +/* Get bottom-most low-memory stack address. */ +memctx ctx = { trampoline_phys +TRAMPOLINE_SPACE };switch ( magic ) {
Signature · 1 line
2.34.1
PATCH v7 5/5 x86/boot: Clarify comment
In reply to Frediano Ziglio--- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/boot/reloc.c +1 -1
@@ -65,7 +65,7 @@ typedef struct memctx {/* * Simple bump allocator. * -* It starts from the base of the trampoline and allocates downwards. +* It starts on top of space reserved for the trampoline and allocates downwards. */ uint32_t ptr; } memctx;
Signature · 1 line
2.34.1
Re: [PATCH v7 5/5] x86/boot: Clarify comment
Quoted 10 lines · Frediano Ziglio
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/boot/reloc.c +0
-0
xen/arch/x86/boot/reloc.c typedef struct memctx { · line 68
Quoted 5 lines
xen/arch/x86/boot/reloc.c +1
-1@@ -65,7 +65,7 @@ typedef struct memctx {/* * Simple bump allocator. * -* It starts from the base of the trampoline and allocates downwards. +* It starts on top of space reserved for the trampoline and allocates downwards.
I'm afraid this line is over 80 characters long, will need to be adjusted. Maybe:
* Starts at top of the relocated trampoline space and allocates downwards.
Thanks.
Re: [PATCH v7 5/5] x86/boot: Clarify comment
Quoted 19 lines · Roger Pau Monné
Quoted 10 lines · Frediano Ziglio
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/boot/reloc.c +0
-0xen/arch/x86/boot/reloc.c typedef struct memctx { · line 68
Quoted 5 lines
xen/arch/x86/boot/reloc.c +1
-1@@ -65,7 +65,7 @@ typedef struct memctx {/* * Simple bump allocator. * -* It starts from the base of the trampoline and allocates downwards. +* It starts on top of space reserved for the trampoline and allocates downwards. I'm afraid this line is over 80 characters long, will need to be adjusted. Maybe:
Quoted 1 line
* Starts at top of the relocated trampoline space and allocates downwards.
This patch miss misses 2 of the 3 incorrect statements about how the trampoline works, and Alejandro had some better suggestions in the thread on the matter.
~Andrew
Re: [PATCH v7 5/5] x86/boot: Clarify comment
Quoted 21 lines · Andrew Cooper
Quoted 19 lines · Roger Pau Monné
Quoted 10 lines · Frediano Ziglio
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/boot/reloc.c +0
-0xen/arch/x86/boot/reloc.c typedef struct memctx { · line 68
Quoted 5 lines
xen/arch/x86/boot/reloc.c +1
-1@@ -65,7 +65,7 @@ typedef struct memctx {/* * Simple bump allocator. * -* It starts from the base of the trampoline and allocates downwards. +* It starts on top of space reserved for the trampoline and allocates downwards. I'm afraid this line is over 80 characters long, will need to be adjusted. Maybe:
Quoted 7 lines
Quoted 1 line
* Starts at top of the relocated trampoline space and allocates downwards.
This patch miss misses 2 of the 3 incorrect statements about how the trampoline works, and Alejandro had some better suggestions in the thread on the matter.
~Andrew
Hi,
changed to "Starts at the end of the relocated trampoline space and
allocates backwards".
See https://gitlab.com/xen-project/people/fziglio/xen/-/commit/21be0b9d2813db9c578e8a6ace76eee2445908f5.
Frediano
Alejandro Vallejo
Reviewed-byRe: [PATCH v7 5/5] x86/boot: Clarify comment
Quoted 30 lines · Frediano Ziglio
Quoted 21 lines · Andrew Cooper
Quoted 19 lines · Roger Pau Monné
Quoted 10 lines · Frediano Ziglio
Signed-off-by Frediano Ziglio <[email protected]>--- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/x86/boot/reloc.c +0
-0xen/arch/x86/boot/reloc.c typedef struct memctx { · line 68
Quoted 5 lines
xen/arch/x86/boot/reloc.c +1
-1@@ -65,7 +65,7 @@ typedef struct memctx {/* * Simple bump allocator. * -* It starts from the base of the trampoline and allocates downwards. +* It starts on top of space reserved for the trampoline and allocates downwards. I'm afraid this line is over 80 characters long, will need to be adjusted. Maybe:
Quoted 7 lines
Quoted 1 line
* Starts at top of the relocated trampoline space and allocates downwards.
This patch miss misses 2 of the 3 incorrect statements about how the trampoline works, and Alejandro had some better suggestions in the thread on the matter.
~Andrew
Quoted 7 lines
Hi,
changed to "Starts at the end of the relocated trampoline space and
allocates backwards".See https://gitlab.com/xen-project/people/fziglio/xen/-/commit/21be0b9d2813db9c578e8a6ace76eee2445908f5.
Frediano
with that:
Cheers,
Alejandro