[PATCH 3/4] x86/boot: Use <xen/compiler.h>

Andrew Cooper posted 4 patches 2 months, 2 weeks ago
[PATCH 3/4] x86/boot: Use <xen/compiler.h>
Posted by Andrew Cooper 2 months, 2 weeks ago
... rather than opencoding locally.  __stdcall is x86-only and not something
we want to introduce to Xen generically, so opencode it in the two positions
where it matters.

With this, defs.h is empty so delete it.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Frediano Ziglio <frediano.ziglio@cloud.com>

I was hoping to do away with stdcall entirely and use fastcall instead, but
I've clearly got something wrong and the result doesn't boot.
---
 xen/arch/x86/boot/cmdline.c |  5 +++--
 xen/arch/x86/boot/defs.h    | 27 ---------------------------
 xen/arch/x86/boot/reloc.c   |  7 +++----
 3 files changed, 6 insertions(+), 33 deletions(-)
 delete mode 100644 xen/arch/x86/boot/defs.h

diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index b7375d106678..bdd5b95c224b 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -30,11 +30,11 @@ asm (
     "    jmp  cmdline_parse_early      \n"
     );
 
+#include <xen/compiler.h>
 #include <xen/kconfig.h>
 #include <xen/macros.h>
 #include <xen/types.h>
 
-#include "defs.h"
 #include "video.h"
 
 /* Keep in sync with trampoline.S:early_boot_opts label! */
@@ -347,7 +347,8 @@ static void vga_parse(const char *cmdline, early_boot_opts_t *ebo)
 #endif
 
 /* SAF-1-safe */
-void __stdcall cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
+void __attribute__((__stdcall__))
+cmdline_parse_early(const char *cmdline, early_boot_opts_t *ebo)
 {
     if ( !cmdline )
         return;
diff --git a/xen/arch/x86/boot/defs.h b/xen/arch/x86/boot/defs.h
deleted file mode 100644
index 4d519ac4f5ea..000000000000
--- a/xen/arch/x86/boot/defs.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * max() was copied from xen/xen/include/xen/kernel.h.
- */
-
-#ifndef __BOOT_DEFS_H__
-#define __BOOT_DEFS_H__
-
-#define __maybe_unused	__attribute__((__unused__))
-#define __packed	__attribute__((__packed__))
-#define __stdcall	__attribute__((__stdcall__))
-
-#endif /* __BOOT_DEFS_H__ */
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index eb9902d73fd9..1e3a30fab0c6 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -26,11 +26,10 @@ asm (
     "    jmp  reloc                    \n"
     );
 
+#include <xen/compiler.h>
 #include <xen/macros.h>
 #include <xen/types.h>
 
-#include "defs.h"
-
 #include <xen/kconfig.h>
 #include <xen/multiboot.h>
 #include <xen/multiboot2.h>
@@ -354,8 +353,8 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out)
 }
 
 /* SAF-1-safe */
-void *__stdcall reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
-                      uint32_t video_info)
+void *__attribute__((__stdcall__))
+reloc(uint32_t magic, uint32_t in, uint32_t trampoline, uint32_t video_info)
 {
     alloc = trampoline;
 
-- 
2.39.2


Re: [PATCH 3/4] x86/boot: Use <xen/compiler.h>
Posted by Jan Beulich 2 months, 2 weeks ago
On 02.09.2024 15:32, Andrew Cooper wrote:
> ... rather than opencoding locally.  __stdcall is x86-only and not something
> we want to introduce to Xen generically, so opencode it in the two positions
> where it matters.
> 
> With this, defs.h is empty so delete it.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>