From nobody Thu Nov 21 18:05:21 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=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725296097; cv=none; d=zohomail.com; s=zohoarc; b=amzdmWbBeUz1dW9ny30MZCXLbLzQyi1lHcjAd2a4h4K8lb9hbnOMgVvOItTnLuSQB6yvnOVtDx29jVt8x2mf1+ZPIT7eKC2Ios/yULEhODhyhxlFyFMOvhgJG5VAUUVJL5ekPVTACE/6+dDcTOh0A4tJDwULocYUAlJB1sN+ue0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725296097; 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=FDa0tJuZ6Pk5PfjJticTZGaLwjDkHQC5N99vb7lGyOU=; b=M3x/ze0IkfjD1zlmPpV1DztJX37Y8N5KKCnjHnmp/vKVHsxeyQa/90d5h8LMdWqPELge3SIGPGvP2CoS22/FHhENl1r1K5h9IIKKPaJFya3OOG2YZzaRH/rpDhLY9oNB7gL5O4lGE2zyL/CRkrcMOfgA0nJqOPr9Bg0A7qovuh0= 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 172529609750938.339081455659425; Mon, 2 Sep 2024 09:54:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.788293.1197780 (Exim 4.92) (envelope-from ) id 1slAJv-0007mq-Gu; Mon, 02 Sep 2024 16:54:27 +0000 Received: by outflank-mailman (output) from mailman id 788293.1197780; Mon, 02 Sep 2024 16:54:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1slAJv-0007mj-E5; Mon, 02 Sep 2024 16:54:27 +0000 Received: by outflank-mailman (input) for mailman id 788293; Mon, 02 Sep 2024 16:54:26 +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 1slAJu-0007md-DY for xen-devel@lists.xenproject.org; Mon, 02 Sep 2024 16:54:26 +0000 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [2a00:1450:4864:20::529]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0279f304-694c-11ef-a0b2-8be0dac302b0; Mon, 02 Sep 2024 18:54:25 +0200 (CEST) Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5c26815e174so783647a12.0 for ; Mon, 02 Sep 2024 09:54:25 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8988fef5acsm581125466b.4.2024.09.02.09.54.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 09:54:23 -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: 0279f304-694c-11ef-a0b2-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725296064; x=1725900864; 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=FDa0tJuZ6Pk5PfjJticTZGaLwjDkHQC5N99vb7lGyOU=; b=R7Spm4IupHbTneGd6S25zQhmtOELeF+A4M5H4wWDJQNviQ8jIjARKgM5cyhK5xXO9x h2v0nAlgd6XbSben7qj+ThCtezRDraNIeMOnmnqYJ3pxq8+m75NrHnni/5s2fn8jI4Gd 2JRaOekLPzcXC/64g3i0ezLc1HNzjAPrRplYM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725296064; x=1725900864; 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=FDa0tJuZ6Pk5PfjJticTZGaLwjDkHQC5N99vb7lGyOU=; b=vPQaNv9FhWlMhwlBCuM//My33tiW5X/GFE2pIIHp8lZjxkIl4mmFWpkcZ8nFj02rVY FxJqdtakqwCL5gN9A9fc/NUKcYZR+FeEBSOsWc9IqPGo6f6t1XBw1bGDV70VovVvo/9V s6czHDFMUuF1L8pCC6vZkH7kzYYqez4pH+USdRYoi3/byCEs8aQ2BT0kWG00QmY49iI3 ce9EKoP9c/dSIx8h14cOEbNgqymDt4zENLvsBy79R22MMxUJIMP+5flO+VB4vuHLn83y 7ew8KX18MdLKKVl8+cvhxqi+iNVCnHqCpCmdjFxJNd8Gl94XyAnRhyt+bf8GneWYEt59 PDPA== X-Gm-Message-State: AOJu0YwfEWwKCW6Z0bGHhpD/bxb5pxFp3Ptm82c0TgITdEdOfJUhR7TM CdPOk9Ag+IBPG1hfGi4Qyv26BIqSrYdVXVZW7z1w6WNITvnzxvdGJ/JPdFJF/H7yCQLEjevkp0F m X-Google-Smtp-Source: AGHT+IEkq1QNSoy4uTpaS1fGGwV5hyOxXhVH8hZwIEFfWCKVN5ncTjWpms9bmlUGZ9A+6/l36z3UFA== X-Received: by 2002:a17:907:12cd:b0:a89:f171:8dc0 with SMTP id a640c23a62f3a-a89f171926fmr233264066b.11.1725296063821; Mon, 02 Sep 2024 09:54:23 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Frediano Ziglio Subject: [PATCH v2] x86/boot: Use fastcall for 32bit code Date: Mon, 2 Sep 2024 17:54:21 +0100 Message-Id: <20240902165421.3429603-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240902133232.3302839-5-andrew.cooper3@citrix.com> References: <20240902133232.3302839-5-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725296098796116600 This is marginally more efficient, but is mostly to get rid of the use of stdcall in cmdline.c and reloc.c No functional change. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Frediano Ziglio v2: * Fixed up to work properly. I'm tempted to rebase this ahead of "[PATCH 3/4] x86/boot: Use " and remove the transatory opencoding of __stdcall. With some manual ELF annotations around the incbin's, this is the marginal delta: $ ../scripts/bloat-o-meter xen-syms-before xen-syms-after add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-188 (-188) Function old new delta reloc 2352 2328 -24 cmdline_parse_early 2699 2535 -164 --- xen/arch/x86/boot/Makefile | 2 +- xen/arch/x86/boot/cmdline.c | 7 +++---- xen/arch/x86/boot/head.S | 15 ++++++++------- xen/arch/x86/boot/reloc.c | 12 ++++++------ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile index 03d8ce3a9e48..b327663fba94 100644 --- a/xen/arch/x86/boot/Makefile +++ b/xen/arch/x86/boot/Makefile @@ -13,7 +13,7 @@ $(obj)/head.o: $(head-bin-objs:.o=3D.bin) =20 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 +CFLAGS_x86_32 +=3D -Werror -fno-builtin -g0 -msoft-float -mregparm=3D3 ifneq ($(abs_objtree),$(abs_srctree)) CFLAGS_x86_32 +=3D -I$(objtree)/include endif diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c index bdd5b95c224b..fc9241ede9a0 100644 --- a/xen/arch/x86/boot/cmdline.c +++ b/xen/arch/x86/boot/cmdline.c @@ -20,8 +20,8 @@ =20 /* * This entry point is entered from xen/arch/x86/boot/head.S with: - * - 0x4(%esp) =3D &cmdline, - * - 0x8(%esp) =3D &early_boot_opts. + * - %eax =3D &cmdline, + * - %edx =3D &early_boot_opts. */ asm ( " .text \n" @@ -347,8 +347,7 @@ static void vga_parse(const char *cmdline, early_boot_o= pts_t *ebo) #endif =20 /* SAF-1-safe */ -void __attribute__((__stdcall__)) -cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo) +void cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo) { if ( !cmdline ) return; diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S index 3c0346016ce8..f7497bce393c 100644 --- a/xen/arch/x86/boot/head.S +++ b/xen/arch/x86/boot/head.S @@ -613,10 +613,11 @@ trampoline_setup: =20 /* Save Multiboot / PVH info struct (after relocation) for later u= se. */ push %edx /* Boot video info to be filled from M= B2. */ - push %ecx /* Bottom-most low-memory stack addres= s. */ - push %ebx /* Multiboot / PVH information address= . */ - push %eax /* Magic number. */ + mov %ebx, %edx /* Multiboot / PVH information address= . */ + /* reloc(magic/eax, info/edx, trampoline/ecx, video/stk) usin= g fastcall. */ call reloc + add $4, %esp + #ifdef CONFIG_PVH_GUEST cmpb $0, sym_esi(pvh_boot) je 1f @@ -848,9 +849,9 @@ trampoline_setup: testl $MBI_CMDLINE,MB_flags(%ebx) jz 1f =20 - lea sym_esi(early_boot_opts),%eax - push %eax - pushl MB_cmdline(%ebx) + lea sym_esi(early_boot_opts), %edx + mov MB_cmdline(%ebx), %eax + /* cmdline_parse_early(cmdline/eax, opts/edx) using fastcall.= */ call cmdline_parse_early =20 1: @@ -871,7 +872,7 @@ trampoline_setup: =20 /* * cmdline and reloc are written in C, and linked to be 32bit PIC = with - * entrypoints at 0 and using the stdcall convention. + * entrypoints at 0 and using the fastcall convention. */ FUNC(cmdline_parse_early) .incbin "cmdline.bin" diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c index 1e3a30fab0c6..201e38d5445d 100644 --- a/xen/arch/x86/boot/reloc.c +++ b/xen/arch/x86/boot/reloc.c @@ -14,10 +14,10 @@ =20 /* * This entry point is entered from xen/arch/x86/boot/head.S with: - * - 0x04(%esp) =3D MAGIC, - * - 0x08(%esp) =3D INFORMATION_ADDRESS, - * - 0x0c(%esp) =3D TOPMOST_LOW_MEMORY_STACK_ADDRESS. - * - 0x10(%esp) =3D BOOT_VIDEO_INFO_ADDRESS. + * - %eax =3D MAGIC, + * - %edx =3D INFORMATION_ADDRESS, + * - %ecx =3D TOPMOST_LOW_MEMORY_STACK_ADDRESS. + * - 0x04(%esp) =3D BOOT_VIDEO_INFO_ADDRESS. */ asm ( " .text \n" @@ -353,8 +353,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, ui= nt32_t video_out) } =20 /* SAF-1-safe */ -void *__attribute__((__stdcall__)) -reloc(uint32_t magic, uint32_t in, uint32_t trampoline, uint32_t video_inf= o) +void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline, + uint32_t video_info) { alloc =3D trampoline; =20 base-commit: e884903ec56be8b0cc658cc5ba7c1cb70f25208d prerequisite-patch-id: eb50bac1dc5f4cec5653dfe46bb2c714035c8235 prerequisite-patch-id: f08a81c17bc5d1fbc73ad681dd834e077929fbd4 prerequisite-patch-id: ee066a61cacb309e0a9a186051a380ab985e7d63 prerequisite-patch-id: 78e4e47fd945ab266604b208a735601eed301017 --=20 2.39.2