* [PATCH] x86/realmode: Use const and u32 for embedded real-mode data
@ 2026-11-05 18:10 Thorsten Blum
2026-11-05 18:19 ` H. Peter Anvin
0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-11-05 18:10 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
H. Peter Anvin, Dexuan Cui, Michael Kelley,
Pratyush Yadav (Google), Yunhong Jiang, Mike Rapoport (Microsoft)
Cc: Thorsten Blum, Ricardo Neri, linux-kernel
Declare the embedded real-mode blob and relocation table as const since
they are not modified.
Also declare the relocation table as a u32 array since it contains
32-bit entries, and remove the cast in setup_real_mode().
No functional change.
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
arch/x86/include/asm/realmode.h | 6 +++---
arch/x86/realmode/init.c | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/include/asm/realmode.h b/arch/x86/include/asm/realmode.h
index e406a1e92c63..e48259f2e503 100644
--- a/arch/x86/include/asm/realmode.h
+++ b/arch/x86/include/asm/realmode.h
@@ -57,7 +57,7 @@ struct trampoline_header {
};
extern struct real_mode_header *real_mode_header;
-extern unsigned char real_mode_blob_end[];
+extern const unsigned char real_mode_blob_end[];
extern unsigned long initial_code;
extern unsigned long initial_stack;
@@ -67,8 +67,8 @@ extern unsigned long initial_vc_handler;
extern u32 *trampoline_lock;
-extern unsigned char real_mode_blob[];
-extern unsigned char real_mode_relocs[];
+extern const unsigned char real_mode_blob[];
+extern const u32 real_mode_relocs[];
#ifdef CONFIG_X86_32
extern unsigned char startup_32_smp[];
diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c
index 65110b2ee1a1..5430314d549d 100644
--- a/arch/x86/realmode/init.c
+++ b/arch/x86/realmode/init.c
@@ -118,7 +118,7 @@ static void __init setup_real_mode(void)
phys_base = __pa(base);
real_mode_seg = phys_base >> 4;
- rel = (u32 *) real_mode_relocs;
+ rel = real_mode_relocs;
/* 16-bit segment relocations. */
count = *rel++;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/realmode: Use const and u32 for embedded real-mode data
2026-11-05 18:10 [PATCH] x86/realmode: Use const and u32 for embedded real-mode data Thorsten Blum
@ 2026-11-05 18:19 ` H. Peter Anvin
0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2026-11-05 18:19 UTC (permalink / raw)
To: Thorsten Blum, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
Dave Hansen, x86, Dexuan Cui, Michael Kelley,
Pratyush Yadav (Google), Yunhong Jiang, Mike Rapoport (Microsoft)
Cc: Ricardo Neri, linux-kernel
On 2026-11-05 10:10, Thorsten Blum wrote:
> Declare the embedded real-mode blob and relocation table as const since
> they are not modified.
>
> Also declare the relocation table as a u32 array since it contains
> 32-bit entries, and remove the cast in setup_real_mode().
>
> No functional change.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
Reviewed-by: H. Peter Anvin (RosaicLabs) <hpa@zytor.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 18:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 18:10 [PATCH] x86/realmode: Use const and u32 for embedded real-mode data Thorsten Blum
2026-11-05 18:19 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®