From nobody Sat Nov 23 20:15:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1730197835; cv=none; d=zohomail.com; s=zohoarc; b=UUhyBXCxXAUHtk2g5+eknnknv+0DkGQZEw5y0g3A+R18UKIEW+6Y+4no9aDDNFZpbY5fL45u+h0kxcmla6Xtn0An/7qaR9SzNGWYVwTfChwALmgSgDUfJMZxIHPI9bNjA1TOhjq3sEz/UQT6GfXU3jUS5StLkuCrpDayN/N3k6U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730197835; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=W2530RwEhxR4OVHfLP111aspcHFheFeR8Wqbyi70InQ=; b=VrvnnUjrRnVVUsvrEo4hE6sR/3Xaz+UMMK4dLTBcQlpfT1UNjiAuKpcIE7B7ThoDPP4SN1EC1oVUzl89dze+Dd5khxiLlW00L6Qmb2oht5Vx4B+gRvg20cnaSUUONhA63hO7GBnGXTUbTtmd43PdJ+Wu5/rCTthrN+17DUMgCNM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730197835893623.6593147379965; Tue, 29 Oct 2024 03:30:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.827208.1241755 (Exim 4.92) (envelope-from ) id 1t5jU9-0006wi-4e; Tue, 29 Oct 2024 10:30:01 +0000 Received: by outflank-mailman (output) from mailman id 827208.1241755; Tue, 29 Oct 2024 10:30:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jU8-0006vd-VJ; Tue, 29 Oct 2024 10:30:00 +0000 Received: by outflank-mailman (input) for mailman id 827208; Tue, 29 Oct 2024 10:30:00 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jU7-0006t1-Ql for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 10:29:59 +0000 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [2a00:1450:4864:20::62c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bc7cbeb6-95e0-11ef-a0c3-8be0dac302b0; Tue, 29 Oct 2024 11:29:54 +0100 (CET) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a9acafdb745so932032266b.0 for ; Tue, 29 Oct 2024 03:29:54 -0700 (PDT) Received: from fziglio-desktop.. ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbc7e8sm458495466b.31.2024.10.29.03.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:29:52 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bc7cbeb6-95e0-11ef-a0c3-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MmMiLCJoZWxvIjoibWFpbC1lajEteDYyYy5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImJjN2NiZWI2LTk1ZTAtMTFlZi1hMGMzLThiZTBkYWMzMDJiMCIsInRzIjoxNzMwMTk3Nzk0LjEwNzkzMywic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730197793; x=1730802593; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W2530RwEhxR4OVHfLP111aspcHFheFeR8Wqbyi70InQ=; b=e/ardDZJzePMEAWNvyodsJw0GkoC10gVy5bZ+tF6+Svrf4BzPlbNmkRTHWSzxZWru5 9bvMW4u7b0Kjoksi84ty062uq89hM43OYy1FUezquwYXpnx85bjRV2HKe6g+DsfcBjo/ DOzlgvoLG9/x8Wl2VmxCi0KxyZ/93DiaZWSLA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730197793; x=1730802593; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W2530RwEhxR4OVHfLP111aspcHFheFeR8Wqbyi70InQ=; b=tK5Q9FA9m+kvSQrDWKFU0pzcGbX4hHYRUuXXQJpDhPEIncF4+iLhdjMGdepIdrAUpv rMqN1teRtj5Qir5aJJUGkFxDS1YpMKUm6QtLcSGtMvEBxMbPhbwS0Qvh4hHDGQ09kwFK U8DKNpzn4R5ETc8taPQUekZomL+rWIWXzTcV4lxHXepGZs+EBQlAxFGvst+jwNbNfECb 1RBF1LrHE1eh7vT0vqVRl0cYeXPSfc6EKyWIypdISdPVA6/ZbgK7HNa/5qUvryAn4giC gPHK2EXYRDGOnSQcFO1iAEifU7r4cPGI9R5mmAhWojbnXDhVFRDsM5Irf51X3jQZyX8y t95Q== X-Gm-Message-State: AOJu0YxIyIlV05AXwsZFHTKvv1KomP+uv10HY1gFd7G6YmViBXhICzfq VeLpi2tq+2Jg7e684jIegK8LRnEZC2I2ZF1I6r7nR2z6rGmkWpAM9hQzTK13Puq2gyrQ2X0Csw6 B X-Google-Smtp-Source: AGHT+IGqi4IiyqKCrZfPAJf3ixUkVe0yePsJSJcdMsqaMwbT8Et/CClHACELk+CHHDyFz04og9VjIA== X-Received: by 2002:a17:907:3182:b0:a9a:bbd1:aa5 with SMTP id a640c23a62f3a-a9e2b0167d0mr116366966b.31.1730197793050; Tue, 29 Oct 2024 03:29:53 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Julien Grall , Stefano Stabellini , Anthony PERARD Subject: [PATCH v7 1/5] x86/boot: Rework how 32bit C is linked/included for early boot Date: Tue, 29 Oct 2024 10:29:38 +0000 Message-Id: <20241029102942.162912-2-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029102942.162912-1-frediano.ziglio@cloud.com> References: <20241029102942.162912-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1730197836400116600 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Frediano Ziglio Reviewed-by: Anthony PERARD Acked-by: Andrew Cooper --- 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 =3D> 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 =3D> build32.lds.S} (66%) create mode 100755 xen/tools/combine_two_binaries.py diff --git a/xen/arch/x86/boot/.gitignore b/xen/arch/x86/boot/.gitignore index a379db7988..595cef6a2c 100644 --- a/xen/arch/x86/boot/.gitignore +++ b/xen/arch/x86/boot/.gitignore @@ -1,3 +1,5 @@ /mkelf32 -/*.bin -/*.lnk +/build32.*.lds +/built-in-32.*.bin +/built-in-32.*.map +/built-in-32.S diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index 1199291d2b..230a99a1e5 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -1,4 +1,5 @@ obj-bin-y +=3D head.o +obj-bin-y +=3D built-in-32.o =20 obj32 :=3D cmdline.32.o obj32 +=3D reloc.32.o @@ -9,9 +10,6 @@ targets +=3D $(obj32) =20 obj32 :=3D $(addprefix $(obj)/,$(obj32)) =20 -$(obj)/head.o: AFLAGS-y +=3D -Wa$(comma)-I$(obj) -$(obj)/head.o: $(obj32:.32.o=3D.bin) - CFLAGS_x86_32 :=3D $(subst -m64,-m32 -march=3Di686,$(XEN_TREEWIDE_CFLAGS)) $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS)) CFLAGS_x86_32 +=3D -Werror -fno-builtin -g0 -msoft-float -mregparm=3D3 @@ -25,14 +23,66 @@ $(obj32): XEN_CFLAGS :=3D $(CFLAGS_x86_32) -fpic $(obj)/%.32.o: $(src)/%.c FORCE $(call if_changed_rule,cc_o_c) =20 +orphan-handling-$(call ld-option,--orphan-handling=3Derror) :=3D --orphan-= handling=3Derror LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) :=3D --no-warn-rwx-se= gments LDFLAGS_DIRECT +=3D $(LDFLAGS_DIRECT-y) LD32 :=3D $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) =20 -%.bin: %.lnk - $(OBJCOPY) -j .text -O binary $< $@ +# The parameters below tweak the generated linker scripts: +# - text_gap: padding between .text section external symbols and code. +# - text_diff: address of the .text section. +# +# Note external symbols are only affected by text_diff, while internal sym= bols +# are affected by both text_diff and text_gap. Ensure the sum of gap and = diff +# is greater than 2^16 so that any 16bit relocations if present in the obj= ect +# file turns into a build-time error. +text_gap :=3D 0x010200 +text_diff :=3D 0x408020 + +$(obj)/build32.base.lds: AFLAGS-y +=3D -DGAP=3D$(text_gap) -DTEXT_DIFF=3D$= (text_diff) +$(obj)/build32.offset.lds: AFLAGS-y +=3D -DGAP=3D$(text_gap) -DTEXT_DIFF= =3D$(text_diff) -DFINAL +$(obj)/build32.base.lds $(obj)/build32.offset.lds: $(src)/build32.lds.S FO= RCE + $(call if_changed_dep,cpp_lds_S) + +targets +=3D build32.offset.lds build32.base.lds + +# Generate a single 32bit object. +# +# Resolve any relocations resulting from references between the translation +# units. This ensures the same combined object file can be used to genera= te +# multiple images with slightly different linker scripts. +$(obj)/built-in-32.tmp.o: $(obj32) + $(LD32) -r -o $@ $^ + +# Link bundle with a given layout and extract a binary from it. +# The linker will allocate GOP and resolve symbols specified in the linker +# script. +# The conversion to binary avoids polluting global symbols not used extern= ally; +# also removes conflict with needed 64 bit GOP. +# If possible we use --orphan-handling=3Derror option to make sure we acco= unt +# for all possible sections from C code. +$(obj)/built-in-32.%.bin: $(obj)/build32.%.lds $(obj)/built-in-32.tmp.o + $(LD32) $(orphan-handling-y) -N -T $< -Map $(@:bin=3Dmap) -o $(@:bin=3Do)= $(filter %.o,$^) + $(OBJCOPY) -j .text -O binary $(@:bin=3Do) $@ + rm -f $(@:bin=3Do) + +quiet_cmd_combine =3D GEN $@ +cmd_combine =3D \ + $(PYTHON) $(srctree)/tools/combine_two_binaries.py \ + --gap $(text_gap) \ + --text-diff $(text_diff) \ + --script $(obj)/build32.offset.lds \ + --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 \ + --output $@ + +targets +=3D built-in-32.S =20 -%.lnk: %.32.o $(src)/build32.lds - $(LD32) -N -T $(filter %.lds,$^) -o $@ $< +# generate final object file combining and checking above binaries +$(obj)/built-in-32.S: $(obj)/built-in-32.base.bin $(obj)/built-in-32.offse= t.bin \ + $(srctree)/tools/combine_two_binaries.py FORCE + $(call if_changed,combine) =20 -clean-files :=3D *.lnk *.bin +clean-files :=3D built-in-32.*.bin built-in-32.*.map build32.*.lds diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds.S similarity index 66% rename from xen/arch/x86/boot/build32.lds rename to xen/arch/x86/boot/build32.lds.S index 56edaa727b..d1b9dc6689 100644 --- a/xen/arch/x86/boot/build32.lds +++ b/xen/arch/x86/boot/build32.lds.S @@ -15,12 +15,37 @@ * with this program. If not, see . */ =20 -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 =3D . + (__LINE__ * MULT) + +ENTRY(dummy_start) =20 SECTIONS { /* Merge code and data into one section. */ - .text : { + .text TEXT_START : { + /* Silence linker warning, we are not going to use it */ + dummy_start =3D .; + + /* + * 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 la= ter + * relocation. + */ + DECLARE_IMPORT(__base_relocs_start); + DECLARE_IMPORT(__base_relocs_end); + . =3D . + 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 e= mpty. */ .got : { *(.got) diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c index fc9241ede9..196c580e91 100644 --- a/xen/arch/x86/boot/cmdline.c +++ b/xen/arch/x86/boot/cmdline.c @@ -18,18 +18,6 @@ * Linux kernel source (linux/lib/string.c). */ =20 -/* - * This entry point is entered from xen/arch/x86/boot/head.S with: - * - %eax =3D &cmdline, - * - %edx =3D &early_boot_opts. - */ -asm ( - " .text \n" - " .globl _start \n" - "_start: \n" - " jmp cmdline_parse_early \n" - ); - #include #include #include diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index c4de1dfab5..e0776e3896 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -759,18 +759,6 @@ trampoline_setup: /* Jump into the relocated trampoline. */ lret =20 - /* - * 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) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 8c58affcd9..94b078d7b1 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -12,20 +12,6 @@ * Daniel Kiper */ =20 -/* - * This entry point is entered from xen/arch/x86/boot/head.S with: - * - %eax =3D MAGIC, - * - %edx =3D INFORMATION_ADDRESS, - * - %ecx =3D TOPMOST_LOW_MEMORY_STACK_ADDRESS. - * - 0x04(%esp) =3D BOOT_VIDEO_INFO_ADDRESS. - */ -asm ( - " .text \n" - " .globl _start \n" - "_start: \n" - " jmp reloc \n" - ); - #include #include #include diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_bina= ries.py new file mode 100755 index 0000000000..447c0d3bdb --- /dev/null +++ b/xen/tools/combine_two_binaries.py @@ -0,0 +1,220 @@ +#!/usr/bin/env python3 + +from __future__ import print_function +import argparse +import functools +import re +import struct +import sys + +parser =3D argparse.ArgumentParser(description=3D'Generate assembly file t= o merge into other code.') +auto_int =3D functools.update_wrapper(lambda x: int(x, 0), int) # allows h= ex +parser.add_argument('--script', dest=3D'script', + required=3DTrue, + help=3D'Linker script for extracting symbols') +parser.add_argument('--bin1', dest=3D'bin1', + required=3DTrue, + help=3D'First binary') +parser.add_argument('--bin2', dest=3D'bin2', + required=3DTrue, + help=3D'Second binary') +parser.add_argument('--gap', dest=3D'gap', + required=3DTrue, + type=3Dauto_int, + help=3D'Gap inserted at the start of code section') +parser.add_argument('--text-diff', dest=3D'text_diff', + required=3DTrue, + type=3Dauto_int, + help=3D'Difference between code section start') +parser.add_argument('--output', dest=3D'output', + help=3D'Output file') +parser.add_argument('--map', dest=3D'mapfile', + help=3D'Map file to read for symbols to export') +parser.add_argument('--exports', dest=3D'exports', + help=3D'Symbols to export') +parser.add_argument('--section-header', dest=3D'section_header', + default=3D'.section .init.text, "ax", @progbits', + help=3D'Section header declaration') +parser.add_argument('-v', '--verbose', + action=3D'store_true') +args =3D parser.parse_args() + +gap =3D args.gap +text_diff =3D args.text_diff + +# Parse linker script for external symbols to use. +# Next regex matches expanded DECLARE_IMPORT lines in linker script. +symbol_re =3D re.compile(r'\s+(\S+)\s*=3D\s*\.\s*\+\s*\((\d+)\s*\*\s*0\s*\= )\s*;') +symbols =3D {} +lines =3D {} +for line in open(args.script): + m =3D symbol_re.match(line) + if not m: + continue + (name, line_num) =3D (m.group(1), int(m.group(2))) + if line_num =3D=3D 0: + raise Exception("Invalid line number found:\n\t" + line) + if line_num in symbols: + raise Exception("Symbol with this line already present:\n\t" + lin= e) + if name in lines: + raise Exception("Symbol with this name already present:\n\t" + nam= e) + symbols[line_num] =3D name + lines[name] =3D line_num + +exports =3D [] +if args.exports is not None: + exports =3D dict([(name, None) for name in args.exports.split(',')]) + +# Parse mapfile, look for ther symbols we want to export. +if args.mapfile is not None: + symbol_re =3D re.compile(r'\s{15,}0x([0-9a-f]+)\s+(\S+)\n') + for line in open(args.mapfile): + m =3D symbol_re.match(line) + if not m or m.group(2) not in exports: + continue + addr =3D int(m.group(1), 16) + exports[m.group(2)] =3D addr +for (name, addr) in exports.items(): + if addr is None: + raise Exception("Required export symbols %s not found" % name) + +file1 =3D open(args.bin1, 'rb') +file2 =3D open(args.bin2, 'rb') +file1.seek(0, 2) +size1 =3D file1.tell() +file2.seek(0, 2) +size2 =3D file2.tell() +if size1 > size2: + file1, file2 =3D file2, file1 + size1, size2 =3D size2, size1 +if size2 !=3D size1 + gap: + raise Exception('File sizes do not match') +del size2 + +file1.seek(0, 0) +data1 =3D file1.read(size1) +del file1 +file2.seek(gap, 0) +data2 =3D file2.read(size1) +del file2 + +max_line =3D max(symbols.keys()) + +def to_int32(n): + '''Convert a number to signed 32 bit integer truncating if needed''' + mask =3D (1 << 32) - 1 + h =3D 1 << 31 + return (n & mask) ^ h - h + +i =3D 0 +references =3D {} +internals =3D 0 +while i <=3D size1 - 4: + n1 =3D struct.unpack('=3D 10: + break + continue + # This is a relative relocation to a symbol, accepted, code/data is + # relocatable. + if diff < gap and diff >=3D gap - max_line: + n =3D gap - diff + symbol =3D symbols.get(n) + # check we have a symbol + if symbol is None: + raise Exception("Cannot find symbol for line %d" % n) + pos =3D i - 1 + if args.verbose: + print('Position %#x %d %s' % (pos, n, symbol), file=3Dsys.stde= rr) + i +=3D 3 + references[pos] =3D symbol + continue + # First byte is the same, move to next byte + if diff & 0xff =3D=3D 0 and i <=3D size1 - 4: + continue + # Probably a type of relocation we don't want or support + pos =3D i - 1 + suggestion =3D '' + symbol =3D symbols.get(-diff - text_diff) + if symbol is not None: + suggestion =3D " Maybe %s is not defined as hidden?" % symbol + raise Exception("Unexpected difference found at %#x " + "n1=3D%#x n2=3D%#x diff=3D%#x gap=3D%#x.%s" % \ + (pos, n1, n2, diff, gap, suggestion)) +if internals !=3D 0: + raise Exception("Previous relocations found") + +def line_bytes(buf, out): + '''Output an assembly line with all bytes in "buf"''' + # Python 2 compatibility + if type(buf) =3D=3D str: + print("\t.byte " + ','.join([str(ord(c)) for c in buf]), file=3Dou= t) + else: + print("\t.byte " + ','.join([str(n) for n in buf]), file=3Dout) + +def part(start, end, out): + '''Output bytes of "data" from "start" to "end"''' + while start < end: + e =3D min(start + 16, end) + line_bytes(data1[start:e], out) + start =3D e + +def reference(pos, out): + name =3D references[pos] + n =3D struct.unpack('=3D (1 << 31): + n -=3D (1 << 32) + n +=3D pos + if n < 0: + n =3D -n + sign =3D '-' + print("\t.hidden %s\n" + "\t.long %s %s %#x - ." % (name, name, sign, n), + file=3Dout) + +def output(out): + prev =3D 0 + exports_by_addr =3D {} + for (sym, addr) in exports.items(): + exports_by_addr.setdefault(addr, []).append(sym) + positions =3D list(references.keys()) + positions +=3D list(exports_by_addr.keys()) + for pos in sorted(positions): + part(prev, pos, out) + prev =3D pos + if pos in references: + reference(pos, out) + prev =3D pos + 4 + if pos in exports_by_addr: + for sym in exports_by_addr[pos]: + print("\t.global %s\n" + "\t.hidden %s\n" + "%s:" % (sym, sym, sym), + file=3Dout) + part(prev, size1, out) + +out =3D sys.stdout +if args.output is not None: + out =3D open(args.output, 'w') +print('''/* + * File autogenerated by combine_two_binaries.py DO NOT EDIT + */''', file=3Dout) +print('\t' + args.section_header, file=3Dout) +print('obj32_start:', file=3Dout) +output(out) +print('\n\t.section .note.GNU-stack,"",@progbits', file=3Dout) +out.flush() --=20 2.34.1 From nobody Sat Nov 23 20:15:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1730197831; cv=none; d=zohomail.com; s=zohoarc; b=n0uS9qL38C/Vpj0fc2IzXUxuSjTFwQJ1fCvz/EcKxRvCoyAPKPQSaRwPUQnDlx+paBADq7rCSJiqIDq6e02GUyMUJraEtsQn297wW76mlo8bo/AnlVMPVNlyHWuzqCyHX+okoegLfWKr0adEgmd/RQfEkfRu2OLYL8SqjCMDZfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730197831; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qhWSbnJvPwHAY4fvW4OKlyERgJEwgRJ/ziSxdZab8H8=; b=FkeWd5dGYmanB+KSSX+gDZwYtQSawELUBgksySZ9Mmh/90Q7Px615rJMrZZkewB6+xtYlbJaDLY1B7dMa6TiRz0aGWlYJh6koXZh7epN3gbouNK247AL3tYSKPiZGcIdp21UfRZQ86f8/ymAkhW6mnevs/v3vjMpPJKvSF1bQks= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730197831754383.77034476138897; Tue, 29 Oct 2024 03:30:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.827210.1241774 (Exim 4.92) (envelope-from ) id 1t5jUA-0007Ul-Ps; Tue, 29 Oct 2024 10:30:02 +0000 Received: by outflank-mailman (output) from mailman id 827210.1241774; Tue, 29 Oct 2024 10:30:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUA-0007U8-KY; Tue, 29 Oct 2024 10:30:02 +0000 Received: by outflank-mailman (input) for mailman id 827210; Tue, 29 Oct 2024 10:30:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jU9-0006t0-Bw for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 10:30:01 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bcdbf6d7-95e0-11ef-99a3-01e77a169b0f; Tue, 29 Oct 2024 11:29:54 +0100 (CET) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5c9850ae22eso6822389a12.3 for ; Tue, 29 Oct 2024 03:29:54 -0700 (PDT) Received: from fziglio-desktop.. ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbc7e8sm458495466b.31.2024.10.29.03.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:29:53 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bcdbf6d7-95e0-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo1MzAiLCJoZWxvIjoibWFpbC1lZDEteDUzMC5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImJjZGJmNmQ3LTk1ZTAtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwMTk3Nzk0Ljc0NDE2Nywic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730197794; x=1730802594; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qhWSbnJvPwHAY4fvW4OKlyERgJEwgRJ/ziSxdZab8H8=; b=O4AiBgY3bSIAL1udwvf/MEbjpDVWD/KuNdlDUszy2dRTYpp2N4jJplDupT3Xjk4Sst EwEA1+aXRktG8qXGE+5BBc79qmO9VgVefc7mEfQtMAjoby+XEx4TjxjpzTV6rBWcwLxL V7fXFgqAjSUFSLa2hkE73dshqnIhf+m9OMEVM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730197794; x=1730802594; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qhWSbnJvPwHAY4fvW4OKlyERgJEwgRJ/ziSxdZab8H8=; b=P2VNWXaCUpLh9Fin4SWWiNyH5lIPIOL6wkHyAox2lHWuT4CmKwaUbqQ1gculcZqa9l lLamNnZ7KBvhu8GdFF5jo/0pZM1RDtNOqFI0IlxJKGxdgfmPxNxBkKk/HEvTI4olaqdH 6ikGMxhqx7BCW+fXjGha1Mf2p9OlP2PLD5PWf6l7i8uu7Xee+ugTBwtITTEoR/IZ4bNc ZRAxv9lf6E99EFEmTgwBTjVIBEadejHOiIJV/ft92uAzNChbhS+nVEXdP2hLkVgdpz3g f3iTe3WPBSnmr7ucdzsrRdDPv0aNKGADJEPNjGRZgKjpyPztmIuYdEiuMpQLZMoKYxvt 3dZw== X-Gm-Message-State: AOJu0YxQnm6gPyWYQ4Lq/2EWsYXoE4cTkgfgtamHfD+1CQf22ZvorKJ7 FrDga8W7oryY6KA4XL3mJv5/G69ZdTW+5ra8yBs/XusbiQiZ0/OGznLNL8E8M5XSxSgdAUvbawM / X-Google-Smtp-Source: AGHT+IEwafcwQ80FRIWYOqFJJZeeimSvtxbVohIw3MUHAXU8T8Oc41ZySLiMRn6LMBR5lL60ppBD+Q== X-Received: by 2002:a17:907:9815:b0:a9a:9b1:f972 with SMTP id a640c23a62f3a-a9de61cf153mr974394866b.40.1730197793814; Tue, 29 Oct 2024 03:29:53 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Subject: [PATCH v7 2/5] x86/boot: Reuse code to relocate trampoline Date: Tue, 29 Oct 2024 10:29:39 +0000 Message-Id: <20241029102942.162912-3-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029102942.162912-1-frediano.ziglio@cloud.com> References: <20241029102942.162912-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1730197832230116600 Move 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. Signed-off-by: Frediano Ziglio Reviewed-by: Andrew Cooper Acked-by: Marek Marczykowski-G=C3=B3recki --- 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 diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index 230a99a1e5..e102bd8c70 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -1,11 +1,15 @@ obj-bin-y +=3D head.o obj-bin-y +=3D built-in-32.o +obj-bin-y +=3D $(obj64) =20 obj32 :=3D cmdline.32.o obj32 +=3D reloc.32.o +obj32 +=3D reloc-trampoline.32.o =20 -nocov-y +=3D $(obj32) -noubsan-y +=3D $(obj32) +obj64 :=3D reloc-trampoline.o + +nocov-y +=3D $(obj32) $(obj64) +noubsan-y +=3D $(obj32) $(obj64) targets +=3D $(obj32) =20 obj32 :=3D $(addprefix $(obj)/,$(obj32)) @@ -75,7 +79,7 @@ cmd_combine =3D \ --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 $@ =20 targets +=3D built-in-32.S diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.ld= s.S index d1b9dc6689..27f0d7ac3c 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -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); . =3D . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index e0776e3896..ade2c5c43d 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -706,28 +706,7 @@ trampoline_setup: mov %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8) =20 /* 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 =20 /* Do not parse command line on EFI platform here. */ cmpb $0, sym_esi(efi_platform) diff --git a/xen/arch/x86/boot/reloc-trampoline.c b/xen/arch/x86/boot/reloc= -trampoline.c new file mode 100644 index 0000000000..0a74c1e75a --- /dev/null +++ b/xen/arch/x86/boot/reloc-trampoline.c @@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include +#include + +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 =3D 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 =3D __trampoline_rel_start; + trampoline_ptr < __trampoline_rel_stop; + ++trampoline_ptr ) + *(uint32_t *)(*trampoline_ptr + (long)trampoline_ptr) +=3D phys; + + for ( trampoline_ptr =3D __trampoline_seg_start; + trampoline_ptr < __trampoline_seg_stop; + ++trampoline_ptr ) + *(uint16_t *)(*trampoline_ptr + (long)trampoline_ptr) =3D phys >> = 4; +} diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h index 3b26f0b0f5..3133985c88 100644 --- a/xen/arch/x86/efi/efi-boot.h +++ b/xen/arch/x86/efi/efi-boot.h @@ -103,27 +103,16 @@ static void __init efi_arch_relocate_image(unsigned l= ong delta) } } =20 -extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[]; -extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[]; +void reloc_trampoline64(void); =20 static void __init relocate_trampoline(unsigned long phys) { - const int32_t *trampoline_ptr; - trampoline_phys =3D phys; =20 if ( !efi_enabled(EFI_LOADER) ) return; =20 - /* Apply relocations to trampoline. */ - for ( trampoline_ptr =3D __trampoline_rel_start; - trampoline_ptr < __trampoline_rel_stop; - ++trampoline_ptr ) - *(u32 *)(*trampoline_ptr + (long)trampoline_ptr) +=3D phys; - for ( trampoline_ptr =3D __trampoline_seg_start; - trampoline_ptr < __trampoline_seg_stop; - ++trampoline_ptr ) - *(u16 *)(*trampoline_ptr + (long)trampoline_ptr) =3D phys >> 4; + reloc_trampoline64(); } =20 static void __init place_string(u32 *addr, const char *s) --=20 2.34.1 From nobody Sat Nov 23 20:15:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1730197835; cv=none; d=zohomail.com; s=zohoarc; b=dNAVoWXkp4TxD7Hb5pUEAvIcr6rlwMAJetWd09BgZUby0MWdJC1xUr4HUYQ9H2jEf8yukMWrPZWd5/IPyWUw/HzbZyK9GnIZ/g55dRiWC0GQPnyRi5J1hFaQBy2pBdJBOG7ksgf4XO2vq+BnjMDH/s8e3bVCyT2c0x9a4GMI/44= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730197835; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GlmexNYkWAFWJCr6Snri0UTFiTtdD3QbNKgKkQOoYME=; b=X4yyYHHSOoYld3sPKMzczpHw0RRD2ZuyPJvOMJdKnTIFE8ukTzhtF4eKUdGMz8tOef0lTXIMln88Jn1rxAo8YP37Kg3BVEEUtqm+VTAFDd3bDo13wLc53EQX+qZbas5vJ+w/7niRVZO1yRExmx78qMNp/rFEhSIyplgp427lDmQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730197835847998.9563489010071; Tue, 29 Oct 2024 03:30:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.827212.1241799 (Exim 4.92) (envelope-from ) id 1t5jUD-0008Pt-Cy; Tue, 29 Oct 2024 10:30:05 +0000 Received: by outflank-mailman (output) from mailman id 827212.1241799; Tue, 29 Oct 2024 10:30:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUD-0008NX-5s; Tue, 29 Oct 2024 10:30:05 +0000 Received: by outflank-mailman (input) for mailman id 827212; Tue, 29 Oct 2024 10:30:03 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUB-0006t0-C9 for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 10:30:03 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bd53e640-95e0-11ef-99a3-01e77a169b0f; Tue, 29 Oct 2024 11:29:55 +0100 (CET) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a99ebb390a5so1156311166b.1 for ; Tue, 29 Oct 2024 03:29:55 -0700 (PDT) Received: from fziglio-desktop.. ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbc7e8sm458495466b.31.2024.10.29.03.29.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:29:54 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bd53e640-95e0-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MzMiLCJoZWxvIjoibWFpbC1lajEteDYzMy5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImJkNTNlNjQwLTk1ZTAtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwMTk3Nzk1LjUzMDAzNCwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730197795; x=1730802595; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GlmexNYkWAFWJCr6Snri0UTFiTtdD3QbNKgKkQOoYME=; b=eGYJBZiXRlHP+J8Bnvt6OW/Ftw3Ceh5UDlhcIYQoeelkoMThzDkWixNb8JLzbba7Hy m6OCkCxr6C1nX12vGT0cFewKrfvPTOaaMAq6i6Vq1kqRSdWZBbusSfyXXurMyYx/R20+ +XmmSJtgQj1lyjrt39jQp47IOQGzTzXWc9YYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730197795; x=1730802595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GlmexNYkWAFWJCr6Snri0UTFiTtdD3QbNKgKkQOoYME=; b=qMbt1otv1wy54Uzi0MfLZIrc76l2QxJr0P3PX/9JUi2bj27ZxytoOUouChPiJbt3s1 WyuaaBDhyTPy/ha9QiFVjxrJh46Va+aaNfIc/kFqBQON7sa5+27RKYA1ZKkx2MyNJ3tJ 6RRqlnMIRHj0fj/g6d4cotPFAsRODjs2YwiLVLXfeiTy01RUtfqNyGwdghmhHY/MmM0p 4JGq96IlHevoiwbWk+2GQln/6yymj6PwcKzhs3hZaJ6JKoB4G3BV2RajN1qJOomrc51y LQpWVi/lg3X0LUNptec/2mWQTwv7+gxVpEvmmu+iWEISDYTuZhwkTJXetkUVrSiY0fbO kgKA== X-Gm-Message-State: AOJu0Yx4ZQHVzxZuIPQapHJ3u4Llnwdn5ZT2JoGpBGyk3XUwQSJe0BEx WoBaFqSvmW7xIu0Q+SbbOrbPvmjmy8QSatO6ebZkIy75Mpw2JmrC24pnD6x6PHJ5k8X76JGBRmh U X-Google-Smtp-Source: AGHT+IE2wUsDPiSFiORRAyMj/1O36KBCAzkvKv2Vba6kqickrrJHq8KEcCk4wfzDtDkPTqYZIi/l+w== X-Received: by 2002:a17:906:da8b:b0:a99:5f45:cb69 with SMTP id a640c23a62f3a-a9e2b32edcdmr149064566b.4.1730197794666; Tue, 29 Oct 2024 03:29:54 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v7 3/5] x86/boot: Use boot_vid_info variable directly from C code Date: Tue, 29 Oct 2024 10:29:40 +0000 Message-Id: <20241029102942.162912-4-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029102942.162912-1-frediano.ziglio@cloud.com> References: <20241029102942.162912-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1730197836255116600 Content-Type: text/plain; charset="utf-8" No more need to pass from assembly code. Signed-off-by: Frediano Ziglio Reviewed-by: Andrew Cooper --- 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(-) diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.ld= s.S index 27f0d7ac3c..f20fc18977 100644 --- a/xen/arch/x86/boot/build32.lds.S +++ b/xen/arch/x86/boot/build32.lds.S @@ -50,6 +50,7 @@ SECTIONS DECLARE_IMPORT(__trampoline_seg_start); DECLARE_IMPORT(__trampoline_seg_stop); DECLARE_IMPORT(trampoline_phys); + DECLARE_IMPORT(boot_vid_info); . =3D . + GAP; *(.text) *(.text.*) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index ade2c5c43d..5da7ac138f 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -514,18 +514,10 @@ trampoline_setup: mov sym_esi(trampoline_phys), %ecx add $TRAMPOLINE_SPACE,%ecx =20 -#ifdef CONFIG_VIDEO - lea sym_esi(boot_vid_info), %edx -#else - xor %edx, %edx -#endif - /* Save Multiboot / PVH info struct (after relocation) for later u= se. */ - push %edx /* Boot video info to be filled from M= B2. */ mov %ebx, %edx /* Multiboot / PVH information address= . */ - /* reloc(magic/eax, info/edx, trampoline/ecx, video/stk) usin= g fastcall. */ + /* reloc(magic/eax, info/edx, trampoline/ecx) using fastcall.= */ call reloc - add $4, %esp =20 #ifdef CONFIG_PVH_GUEST cmpb $0, sym_esi(pvh_boot) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 94b078d7b1..707d9c5f15 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -176,7 +176,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in, mem= ctx *ctx) return mbi_out; } =20 -static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, m= emctx *ctx) +static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx) { const multiboot2_fixed_t *mbi_fix =3D _p(mbi_in); const multiboot2_memory_map_t *mmap_src; @@ -185,7 +185,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out, memctx memory_map_t *mmap_dst; multiboot_info_t *mbi_out; #ifdef CONFIG_VIDEO - struct boot_video_info *video =3D NULL; + struct boot_video_info *video =3D &boot_vid_info; #endif uint32_t ptr; unsigned int i, mod_idx =3D 0; @@ -290,12 +290,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, = uint32_t video_out, memctx =20 #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; =20 - video =3D _p(video_out); ci =3D (const void *)get_mb2_data(tag, vbe, vbe_control_in= fo); mi =3D (const void *)get_mb2_data(tag, vbe, vbe_mode_info); =20 @@ -321,7 +320,6 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out, memctx if ( (get_mb2_data(tag, framebuffer, framebuffer_type) !=3D MULTIBOOT2_FRAMEBUFFER_TYPE_RGB) ) { - video_out =3D 0; video =3D NULL; } break; @@ -346,8 +344,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out, memctx } =20 /* 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 =3D { trampoline }; =20 @@ -357,7 +354,7 @@ void *reloc(uint32_t magic, uint32_t in, uint32_t tramp= oline, return mbi_reloc(in, &ctx); =20 case MULTIBOOT2_BOOTLOADER_MAGIC: - return mbi2_reloc(in, video_info, &ctx); + return mbi2_reloc(in, &ctx); =20 case XEN_HVM_START_MAGIC_VALUE: if ( IS_ENABLED(CONFIG_PVH_GUEST) ) --=20 2.34.1 From nobody Sat Nov 23 20:15:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1730197829; cv=none; d=zohomail.com; s=zohoarc; b=nGce0bBabADQbczyOMAVP/9MrZiQOQvMYsUpFwD3Z/NXHqae+hwQguGSamd/9RXSNfIXPxy8cbNSIn70OQOYzKvS2Do8degXv1wtysPZ0P+OToD6Mq1ZQu5RQgksq7igNTd3vd3KE7Gxy7xiqeUPXJ796m5Wsm8V7qU7RTLzAFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730197829; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tUEXdxMnhhDzo/2gzjHB2TfqPR4THpXflyTPiqcQYhg=; b=dnbxM5t0/0h1WgEyL9icB5+Nc8sYW7Xig6+00DS1DQEXF3nP4vS+M/mf5Z9nK+8FSBATpds7AxUprm60vnpI4WanJaQRzQEbGpBlXQd6HQY7Ib27QeUCgGZp94V4qlvILfILPC3XlJC9lUiSxvCgC4AWooM8wOjibNNDX9Rcwzk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730197829271298.86055807819866; Tue, 29 Oct 2024 03:30:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.827209.1241768 (Exim 4.92) (envelope-from ) id 1t5jUA-0007Qv-FB; Tue, 29 Oct 2024 10:30:02 +0000 Received: by outflank-mailman (output) from mailman id 827209.1241768; Tue, 29 Oct 2024 10:30:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUA-0007QR-CM; Tue, 29 Oct 2024 10:30:02 +0000 Received: by outflank-mailman (input) for mailman id 827209; Tue, 29 Oct 2024 10:30:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jU8-0006t0-Bt for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 10:30:00 +0000 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [2a00:1450:4864:20::62d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bde1b9c7-95e0-11ef-99a3-01e77a169b0f; Tue, 29 Oct 2024 11:29:56 +0100 (CET) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a9a6acac4c3so832132266b.0 for ; Tue, 29 Oct 2024 03:29:56 -0700 (PDT) Received: from fziglio-desktop.. ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbc7e8sm458495466b.31.2024.10.29.03.29.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:29:55 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bde1b9c7-95e0-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MmQiLCJoZWxvIjoibWFpbC1lajEteDYyZC5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImJkZTFiOWM3LTk1ZTAtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwMTk3Nzk2LjQyOTgxOSwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730197795; x=1730802595; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tUEXdxMnhhDzo/2gzjHB2TfqPR4THpXflyTPiqcQYhg=; b=MUAQfGwpge00Py/t8zTeur+4TIm6FpmnHwOil5HPpJpZPj8IVadkF9xrruucWVsuoJ OuHf5yluAalHwULeoTkokmikoJYx8KAaUaKuXkeprS3Ce0K4+K33ERRUNVfEaLpjOWWc 30qeMiYEyx228d0s+eOHtd70HaWMa7W7dfHLE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730197795; x=1730802595; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tUEXdxMnhhDzo/2gzjHB2TfqPR4THpXflyTPiqcQYhg=; b=exwVeqKR1gxhdTejmyugiFo0auzRMV5dxmgiZjOz9/y35HblTyCa3iuaYP145RkJ7F WxPIkjS2AMh8JhX+1yqNDk/HpxLEORydq5N+ttcvO7mHNHy2Y0vjUQZKKlO8nUBJtQPy vpe7gcB3KLMbkdSYMPFnnbpHX9a2T3mvj55PAqENHKW0qEPeKoBbW5QtMzleb0ZIArmu szHIo5TPS+u8mZgJne6csJP1/sQ4Y/xkjgvcfTA7f5tn3SB0hTSq3VbkB8d/ABqIUJCi 4SqTcFBhUM3x8u5zCLVNFWG59jinmhXR3e4XL6oM3VYWTvgYQorM7w4lbU9c6VSG/wMP vlVQ== X-Gm-Message-State: AOJu0YzyTRNp9SJVMJsOFlO0iQXcqoDJfTAUdSbY84X98YNQdHA6lgeB aAK7+VqTFuKO2oG86fgSN65OXMRDbhFI8gjaLRc9G3wvZbz6dCj7mYSRN1yxgwdmWUZB1x4MLBi 1 X-Google-Smtp-Source: AGHT+IHuaiAwnRmIeicovLku4Aje8nLcMMxOIYnEMOQVMXbzlJRUcAcOn3Plls0fiPUc9Ysx80nUYg== X-Received: by 2002:a17:906:6a09:b0:a99:ffdb:6fef with SMTP id a640c23a62f3a-a9de61cef8amr1269099566b.46.1730197795470; Tue, 29 Oct 2024 03:29:55 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v7 4/5] x86/boot: Use trampoline_phys variable directly from C code Date: Tue, 29 Oct 2024 10:29:41 +0000 Message-Id: <20241029102942.162912-5-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029102942.162912-1-frediano.ziglio@cloud.com> References: <20241029102942.162912-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1730197830198116600 Content-Type: text/plain; charset="utf-8" No more need to pass from assembly code. Signed-off-by: Frediano Ziglio Reviewed-by: Andrew Cooper --- 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(-) diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 5da7ac138f..dcda91cfda 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -510,13 +510,9 @@ trampoline_setup: mov %esi, sym_esi(xen_phys_start) mov %esi, sym_esi(trampoline_xen_phys_start) =20 - /* 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 u= se. */ 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 =20 #ifdef CONFIG_PVH_GUEST diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 707d9c5f15..e50e161b27 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -19,6 +19,9 @@ #include #include #include +#include + +#include =20 #include =20 @@ -344,9 +347,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, m= emctx *ctx) } =20 /* SAF-1-safe */ -void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline) +void *reloc(uint32_t magic, uint32_t in) { - memctx ctx =3D { trampoline }; + /* Get bottom-most low-memory stack address. */ + memctx ctx =3D { trampoline_phys + TRAMPOLINE_SPACE }; =20 switch ( magic ) { --=20 2.34.1 From nobody Sat Nov 23 20:15:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1730197822; cv=none; d=zohomail.com; s=zohoarc; b=RTS4UHSYWxmcsbd8HWoK4ufFohYGn1EIy7oWZlbiB3wqVNq2R6yGKvLlmiWGR7TxTiemV8SQAbUi0JAL/W6OZY5h8lhLDduuW3hzAVEjukY4G0NLdXdpDquNfUTurcgedhdJRnf3HQEpYVkRetLqX0/pHKURlWYIRSpt2OPzF8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730197822; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/R9IwC5Rg/1YFlZU2XC6OhmnY2lp5++tA2yhEvcFGMk=; b=kkSJqT9Y6mBD1pByTIp+vI8roKUdZJc3rKKgUVN/k3fWtMlCSDRmwNgrsm+gE8Oi4A3W3xlKhPejLMwTWdgR91GAXbix6myQccTQxwjLxaoVeR/11saruQ1JUJ5FlhZT2Rie5kS1WU9HU9cIowFEhY1xIT7txkdjSNtCeju4GMI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1730197822860262.5584112258897; Tue, 29 Oct 2024 03:30:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.827211.1241789 (Exim 4.92) (envelope-from ) id 1t5jUC-00080p-1g; Tue, 29 Oct 2024 10:30:04 +0000 Received: by outflank-mailman (output) from mailman id 827211.1241789; Tue, 29 Oct 2024 10:30:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUB-0007zO-TU; Tue, 29 Oct 2024 10:30:03 +0000 Received: by outflank-mailman (input) for mailman id 827211; Tue, 29 Oct 2024 10:30:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1t5jUA-0006t0-C2 for xen-devel@lists.xenproject.org; Tue, 29 Oct 2024 10:30:02 +0000 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id be2a9fa0-95e0-11ef-99a3-01e77a169b0f; Tue, 29 Oct 2024 11:29:56 +0100 (CET) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a998a5ca499so700904066b.0 for ; Tue, 29 Oct 2024 03:29:56 -0700 (PDT) Received: from fziglio-desktop.. ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1dfbc7e8sm458495466b.31.2024.10.29.03.29.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Oct 2024 03:29:55 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: be2a9fa0-95e0-11ef-99a3-01e77a169b0f X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MmEiLCJoZWxvIjoibWFpbC1lajEteDYyYS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImJlMmE5ZmEwLTk1ZTAtMTFlZi05OWEzLTAxZTc3YTE2OWIwZiIsInRzIjoxNzMwMTk3Nzk2LjkwNDE2MSwic2VuZGVyIjoiZnJlZGlhbm8uemlnbGlvQGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1730197796; x=1730802596; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/R9IwC5Rg/1YFlZU2XC6OhmnY2lp5++tA2yhEvcFGMk=; b=YebmN4NL4khk1ahRXKW8C1SUlM5ZZ3QMMN3ovjUJ2pAzcOK3gGTwqNl0S2XD3tp3lZ UjHU0uoltDQNKsFDEx1jqC8VEcjIL45DYz/WrUgqEFKbJe4yRpQFkP5FH7TgNUbSigrJ 4z0cyQ+pU779D18fyEFH+r1h+J3eTy8ndPGFU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730197796; x=1730802596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/R9IwC5Rg/1YFlZU2XC6OhmnY2lp5++tA2yhEvcFGMk=; b=L/eSYBCXjcWYPEUzLSvHFR6SbHQjfHG4EVdwMAvKh3G8qvDSmkCvAFHeOp35xYm7kr ZVw94bElRwdY77QG3jAT2AYzkGSz9voxiDXVJegElxxwDP5HcSCDmGRDKngIFe3EIjkR sNaLfErLrjVeszKlXbDq/ZXHlSeLkfsUGeUyxNryrzTyamt+12XtNADfw5j7MJJvoEQM aSoLYYxwJeSPOR8teSpJMrbJI8pzUTY0y9NVNDdy3tbO2heBkGsvb2EGL+IgaXlcLA8z y9FiRuAfTajcr5HlxQS6etEtp9t9KimtxY0X/h1T++A7jT56Ve4m7IPGXs6+pdFjRNRY Zcug== X-Gm-Message-State: AOJu0Ywucd6dUAzd6cWFUbCG1bF6ol5Sa4zZESGS2aH2/qMSzaPa0Gze WraxDD4mK75wb1RGSPxdQf68PeFxPIq20ToKh1bmiI2SGHjLmU87ms1IV61r2EbhxzqIcqCx4EC 5 X-Google-Smtp-Source: AGHT+IFtTmzbWe1tXihaQjdCkWDhmGLw61ux3klKpwQxC8yvZG9lx9DIE8RctK4biXZqWGvmoAxvbQ== X-Received: by 2002:a17:907:96aa:b0:a8a:8cdb:83a7 with SMTP id a640c23a62f3a-a9de61eb56bmr1139022266b.54.1730197796145; Tue, 29 Oct 2024 03:29:56 -0700 (PDT) From: Frediano Ziglio To: xen-devel@lists.xenproject.org Cc: Frediano Ziglio , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v7 5/5] x86/boot: Clarify comment Date: Tue, 29 Oct 2024 10:29:42 +0000 Message-Id: <20241029102942.162912-6-frediano.ziglio@cloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241029102942.162912-1-frediano.ziglio@cloud.com> References: <20241029102942.162912-1-frediano.ziglio@cloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1730197824136116600 Content-Type: text/plain; charset="utf-8" Signed-off-by: Frediano Ziglio --- xen/arch/x86/boot/reloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index e50e161b27..e725cfb6eb 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -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; --=20 2.34.1