On 17 December 2024 10:29:21 CET, Ard Biesheuvel <a...@kernel.org> wrote: >On Tue, 17 Dec 2024 at 10:21, David Woodhouse <dw...@infradead.org> wrote: >> >> On 17 December 2024 09:49:04 CET, Ard Biesheuvel <a...@kernel.org> wrote: >> >On Tue, 17 Dec 2024 at 00:37, David Woodhouse <dw...@infradead.org> wrote: >> >> >> >> From: David Woodhouse <d...@amazon.co.uk> >> >> >> >> Both i386 and x86_64 now copy the relocate_kernel function into the >> >> control >> >> page and execute it from there, using an open-coded function pointer. >> >> >> >> Use a typedef for it instead. >> >> >> >> Signed-off-by: David Woodhouse <d...@amazon.co.uk> >> >> --- >> >> arch/x86/include/asm/kexec.h | 26 +++++++++++++------------- >> >> arch/x86/kernel/machine_kexec_32.c | 7 +------ >> >> arch/x86/kernel/machine_kexec_64.c | 6 +----- >> >> 3 files changed, 15 insertions(+), 24 deletions(-) >> >> >> >> diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h >> >> index 48e4f44f794f..8ad187462b68 100644 >> >> --- a/arch/x86/include/asm/kexec.h >> >> +++ b/arch/x86/include/asm/kexec.h >> >> @@ -111,21 +111,21 @@ static inline void crash_setup_regs(struct pt_regs >> >> *newregs, >> >> } >> >> >> >> #ifdef CONFIG_X86_32 >> >> -asmlinkage unsigned long >> >> -relocate_kernel(unsigned long indirection_page, >> >> - unsigned long control_page, >> >> - unsigned long start_address, >> >> - unsigned int has_pae, >> >> - unsigned int preserve_context); >> >> +typedef asmlinkage unsigned long >> >> +relocate_kernel_fn(unsigned long indirection_page, >> >> + unsigned long control_page, >> >> + unsigned long start_address, >> >> + unsigned int has_pae, >> >> + unsigned int preserve_context); >> > >> >linkage is not part of the type. 'asmlinkage' is #define'd to the >> >empty string today, so it doesn't matter, but better to omit it here. >> >> This is the i386 version. I thought ut was something like regparm(3) there? >> >> And... WTF? How is the calling convention not part of the fundamental type >> of the function? If I have a pointer to such a function, using this typedef >> to ensure we all share the same prototype, are you telling me all the users >> of the typedef have to remember to tag that part on for themselves? > >No. I am talking about linkage not the calling convention.
Hm, I am perfectly happy to believe that my memory is failing me, especially when it comes to specifics of i386 assembler code. But are you also telling me that <https://kernelnewbies.org/FAQ/asmlinkage> is a lie?