Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures
@ 2024-10-14 15:31 Andy Shevchenko
  2024-10-14 15:31 ` [PATCH v1 2/4] kexec: i386: Fix format specifiers for various printf() and scanf() Andy Shevchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-14 15:31 UTC (permalink / raw)
  To: kexec; +Cc: horms, Andy Shevchenko

32-bit compilation makes compiler unhappy about too big right shifts.
Use a similar trick to Linux kernel project by replacing foo >> 32 by
(foo >> 16) >> 16.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kexec/arch/i386/x86-linux-setup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index 73251b93397b..efb6e2cba508 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -99,11 +99,11 @@ void setup_linux_bootloader_parameters_high(
 
 	if (real_mode->protocol_version >= 0x020c &&
 	    (initrd_base & 0xffffffffUL) != initrd_base)
-		real_mode->ext_ramdisk_image = initrd_base >> 32;
+		real_mode->ext_ramdisk_image = (initrd_base >> 16) >> 16;
 
 	if (real_mode->protocol_version >= 0x020c &&
 	    (initrd_size & 0xffffffffUL) != initrd_size)
-		real_mode->ext_ramdisk_size = initrd_size >> 32;
+		real_mode->ext_ramdisk_size = (initrd_size >> 16) >> 16;
 
 	/* The location of the command line */
 	/* if (real_mode_base == 0x90000) { */
@@ -117,7 +117,7 @@ void setup_linux_bootloader_parameters_high(
 		real_mode->cmd_line_ptr = cmd_line_ptr & 0xffffffffUL;
 		if ((real_mode->protocol_version >= 0x020c) &&
 		    ((cmd_line_ptr & 0xffffffffUL) != cmd_line_ptr))
-			real_mode->ext_cmd_line_ptr = cmd_line_ptr >> 32;
+			real_mode->ext_cmd_line_ptr = (cmd_line_ptr >> 16) >> 16;
 	}
 
 	/* Fill in the command line */
@@ -172,7 +172,7 @@ static int setup_linux_vesafb(struct x86_linux_param_header *real_mode)
 	real_mode->vesapm_seg     = 0;
 
 	if (fix.smem_start > 0xffffffffUL) {
-		real_mode->ext_lfb_base = fix.smem_start >> 32;
+		real_mode->ext_lfb_base = (fix.smem_start >> 16) >> 16;
 		real_mode->capabilities |= VIDEO_CAPABILITY_64BIT_BASE;
 	}
 
-- 
2.43.0.rc1.1336.g36b5255a03ac


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/4] kexec: i386: Fix format specifiers for various printf() and scanf()
  2024-10-14 15:31 [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Andy Shevchenko
@ 2024-10-14 15:31 ` Andy Shevchenko
  2024-10-14 15:31 ` [PATCH v1 3/4] util_lib/elf_info: Fix format specifiers for fprintf() Andy Shevchenko
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-14 15:31 UTC (permalink / raw)
  To: kexec; +Cc: horms, Andy Shevchenko

Compiler is not happy when wrong specifier is being used.
Fix them all.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kexec/arch/i386/crashdump-x86.c    | 2 +-
 kexec/arch/i386/kexec-x86-common.c | 2 +-
 kexec/arch/i386/x86-linux-setup.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index a01031e570aa..800ae2c28da8 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -784,7 +784,7 @@ static void cmdline_add_efi(char *cmdline)
 	if (!acpi_rsdp)
 		return;
 
-	sprintf(acpi_rsdp_buf, " acpi_rsdp=0x%lx", acpi_rsdp);
+	sprintf(acpi_rsdp_buf, " acpi_rsdp=0x%llx", acpi_rsdp);
 	if (strlen(cmdline) + strlen(acpi_rsdp_buf) > (COMMAND_LINE_SIZE - 1))
 		die("Command line overflow\n");
 
diff --git a/kexec/arch/i386/kexec-x86-common.c b/kexec/arch/i386/kexec-x86-common.c
index ffc95a9e43f8..67da043f9441 100644
--- a/kexec/arch/i386/kexec-x86-common.c
+++ b/kexec/arch/i386/kexec-x86-common.c
@@ -422,7 +422,7 @@ static uint64_t efi_get_acpi_rsdp(void) {
 		/* ACPI20= always goes before ACPI= */
 		if ((strstr(line, "ACPI20=")) || (strstr(line, "ACPI="))) {
 			s = strchr(line, '=') + 1;
-			sscanf(s, "0x%lx", &acpi_rsdp);
+			sscanf(s, "0x%llx", &acpi_rsdp);
 			break;
 		}
 	}
diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
index efb6e2cba508..1f96372c469f 100644
--- a/kexec/arch/i386/x86-linux-setup.c
+++ b/kexec/arch/i386/x86-linux-setup.c
@@ -760,7 +760,7 @@ static void add_e820_map_from_mr(struct x86_linux_param_header *real_mode,
 				e820[i].type = E820_RESERVED;
 				break;
 		}
-		dbgprintf("%016lx-%016lx (%d)\n",
+		dbgprintf("%016llx-%016llx (%d)\n",
 				e820[i].addr,
 				e820[i].addr + e820[i].size - 1,
 				e820[i].type);
-- 
2.43.0.rc1.1336.g36b5255a03ac


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 3/4] util_lib/elf_info: Fix format specifiers for fprintf()
  2024-10-14 15:31 [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Andy Shevchenko
  2024-10-14 15:31 ` [PATCH v1 2/4] kexec: i386: Fix format specifiers for various printf() and scanf() Andy Shevchenko
@ 2024-10-14 15:31 ` Andy Shevchenko
  2024-10-14 15:31 ` [PATCH v1 4/4] build: Update configure.ac to follow the changes Andy Shevchenko
  2024-10-14 16:24 ` [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-14 15:31 UTC (permalink / raw)
  To: kexec; +Cc: horms, Andy Shevchenko

Compiler is not happy when wrong specifier is being used.
Fix them all.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 util_lib/elf_info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util_lib/elf_info.c b/util_lib/elf_info.c
index 7ca9870bfca0..8f84f5254cc2 100644
--- a/util_lib/elf_info.c
+++ b/util_lib/elf_info.c
@@ -890,7 +890,7 @@ static void dump_dmesg_structured(int fd, void (*handler)(char*, unsigned int))
 					handler(out_buf, len);
 				fprintf(stderr, "Cycle when parsing dmesg detected.\n");
 				fprintf(stderr, "The prink log_buf is most likely corrupted.\n");
-				fprintf(stderr, "log_buf = 0x%lx, idx = 0x%x\n",
+				fprintf(stderr, "log_buf = 0x%llx, idx = 0x%x\n",
 					log_buf, current_idx);
 				exit(68);
 			}
@@ -904,7 +904,7 @@ static void dump_dmesg_structured(int fd, void (*handler)(char*, unsigned int))
 					handler(out_buf, len);
 				fprintf(stderr, "Index outside log_buf detected.\n");
 				fprintf(stderr, "The prink log_buf is most likely corrupted.\n");
-				fprintf(stderr, "log_buf = 0x%lx, idx = 0x%x\n",
+				fprintf(stderr, "log_buf = 0x%llx, idx = 0x%x\n",
 					log_buf, current_idx);
 				exit(69);
 			}
-- 
2.43.0.rc1.1336.g36b5255a03ac


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 4/4] build: Update configure.ac to follow the changes
  2024-10-14 15:31 [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Andy Shevchenko
  2024-10-14 15:31 ` [PATCH v1 2/4] kexec: i386: Fix format specifiers for various printf() and scanf() Andy Shevchenko
  2024-10-14 15:31 ` [PATCH v1 3/4] util_lib/elf_info: Fix format specifiers for fprintf() Andy Shevchenko
@ 2024-10-14 15:31 ` Andy Shevchenko
  2024-10-14 16:24 ` [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2024-10-14 15:31 UTC (permalink / raw)
  To: kexec; +Cc: horms, Andy Shevchenko

Running bootstrap on Debian spills a few problems in configure.ac.
Update it accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 configure.ac | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8dcd4f57bdfb..a3cf34a33777 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl
 dnl 
 
 dnl ---Required
-AC_INIT(kexec-tools, 2.0.29.git)
+AC_INIT([kexec-tools],[2.0.29.git])
 AC_CONFIG_AUX_DIR(./config)
 AC_CONFIG_HEADERS([include/config.h])
 AC_LANG(C)
@@ -92,25 +92,25 @@ if test "x$TARGET_CFLAGS" = "x" ; then
 	TARGET_CFLAGS='-O2 -Wall'
 fi
 
-AC_ARG_WITH([objdir], AC_HELP_STRING([--with-objdir=<dir>],[select directory for object files]),
+AC_ARG_WITH([objdir], AS_HELP_STRING([--with-objdir=<dir>],[select directory for object files]),
 	[ OBJDIR="$withval" ], [ OBJDIR="$OBJDIR" ])
 
 AC_ARG_WITH([gamecube],
-		AC_HELP_STRING([--with-gamecube],[enable gamecube support]),
+		AS_HELP_STRING([--with-gamecube],[enable gamecube support]),
 		AC_DEFINE(WITH_GAMECUBE, 1,
 			[Define to include gamecube support]))
 
-AC_ARG_WITH([zlib], AC_HELP_STRING([--without-zlib],[disable zlib support]),
+AC_ARG_WITH([zlib], AS_HELP_STRING([--without-zlib],[disable zlib support]),
 	[ with_zlib="$withval"], [ with_zlib=yes ] )
 
-AC_ARG_WITH([lzma], AC_HELP_STRING([--without-lzma],[disable lzma support]),
+AC_ARG_WITH([lzma], AS_HELP_STRING([--without-lzma],[disable lzma support]),
 	[ with_lzma="$withval"], [ with_lzma=yes ] )
 
-AC_ARG_WITH([xen], AC_HELP_STRING([--without-xen],
+AC_ARG_WITH([xen], AS_HELP_STRING([--without-xen],
 	[disable extended xen support]), [ with_xen="$withval"], [ with_xen=yes ] )
 
 AC_ARG_WITH([booke],
-		AC_HELP_STRING([--with-booke],[build for booke]),
+		AS_HELP_STRING([--with-booke],[build for booke]),
 		AC_DEFINE(CONFIG_BOOKE,1,
 			[Define to build for BookE]))
 
@@ -245,4 +245,5 @@ AC_SUBST([OBJDIR])
 AC_SUBST([INSTALL])
 
 dnl ---Output
-AC_OUTPUT([Makefile])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
-- 
2.43.0.rc1.1336.g36b5255a03ac


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures
  2024-10-14 15:31 [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Andy Shevchenko
                   ` (2 preceding siblings ...)
  2024-10-14 15:31 ` [PATCH v1 4/4] build: Update configure.ac to follow the changes Andy Shevchenko
@ 2024-10-14 16:24 ` Simon Horman
  3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2024-10-14 16:24 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: kexec

On Mon, Oct 14, 2024 at 06:31:26PM +0300, Andy Shevchenko wrote:
> 32-bit compilation makes compiler unhappy about too big right shifts.
> Use a similar trick to Linux kernel project by replacing foo >> 32 by
> (foo >> 16) >> 16.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks Andy,

Series applied.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-14 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-14 15:31 [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Andy Shevchenko
2024-10-14 15:31 ` [PATCH v1 2/4] kexec: i386: Fix format specifiers for various printf() and scanf() Andy Shevchenko
2024-10-14 15:31 ` [PATCH v1 3/4] util_lib/elf_info: Fix format specifiers for fprintf() Andy Shevchenko
2024-10-14 15:31 ` [PATCH v1 4/4] build: Update configure.ac to follow the changes Andy Shevchenko
2024-10-14 16:24 ` [PATCH v1 1/4] kexec: i386: Fix 32-bit right shifts on 32-bit architectures Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox