All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frediano Ziglio <frediano.ziglio@cloud.com>
To: xen-devel@lists.xenproject.org
Cc: "Frediano Ziglio" <frediano.ziglio@cloud.com>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [PATCH v3 4/5] x86/boot: Use trampoline_phys variable directly from C code
Date: Fri, 11 Oct 2024 09:52:43 +0100	[thread overview]
Message-ID: <20241011085244.432368-5-frediano.ziglio@cloud.com> (raw)
In-Reply-To: <20241011085244.432368-1-frediano.ziglio@cloud.com>

No more need to pass from assembly code.

Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
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)
 
-        /* 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
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 <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 )
     {
-- 
2.34.1



  parent reply	other threads:[~2024-10-11  8:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  8:52 [PATCH v3 0/5] Reuse 32 bit C code more safely Frediano Ziglio
2024-10-11  8:52 ` [PATCH v3 1/5] x86/boot: create a C bundle for 32 bit boot code and use it Frediano Ziglio
2024-10-11 10:57   ` [Makefile only] " Andrew Cooper
2024-10-11 13:17   ` [python] " Andrew Cooper
2024-10-11 13:53     ` Frediano Ziglio
2024-10-11 13:20   ` Jan Beulich
2024-10-11 13:21     ` Andrew Cooper
2024-10-11  8:52 ` [PATCH v3 2/5] x86/boot: Reuse code to relocate trampoline Frediano Ziglio
2024-10-11 12:02   ` Andrew Cooper
2024-10-11 12:50   ` Jan Beulich
2024-10-11  8:52 ` [PATCH v3 3/5] x86/boot: Use boot_vid_info variable directly from C code Frediano Ziglio
2024-10-11 12:07   ` Andrew Cooper
2024-10-11  8:52 ` Frediano Ziglio [this message]
2024-10-11 12:05   ` [PATCH v3 4/5] x86/boot: Use trampoline_phys " Andrew Cooper
2024-10-11  8:52 ` [PATCH v3 5/5] x86/boot: Clarify comment Frediano Ziglio
2024-10-11 12:56   ` Alejandro Vallejo
2024-10-11 13:08     ` Frediano Ziglio
2024-10-11 13:28       ` Alejandro Vallejo
2024-10-11 13:38         ` Andrew Cooper
2024-10-11 13:58           ` Frediano Ziglio
2024-10-11 15:06             ` Alejandro Vallejo
2024-10-11 16:07               ` Andrew Cooper
2024-10-11 14:06           ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241011085244.432368-5-frediano.ziglio@cloud.com \
    --to=frediano.ziglio@cloud.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.