ARM: 9389/2: mm: Define prototypes for all per-processor calls
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 23 Apr 2024 07:48:42 +0000 (08:48 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Mon, 29 Apr 2024 13:14:20 +0000 (14:14 +0100)
commit393999fa96273bab8d6efb2f4724030916afd61b
treefe7a36bcb0b937781ba4a3c54fc020c99251f441
parent51db13aa8d09ecd33ff712d888a8cfe5ac89d6de
ARM: 9389/2: mm: Define prototypes for all per-processor calls

Each CPU type ("proc") has assembly calls for initializing and
setting up the MM context, idle and so forth.

These calls have the C form of e.g.:

void cpu_arm920_init(void);

However this prototype is not really specified, instead it is
generated by the glue code in <asm/glue-proc.h> and the prototype
is implicit from the generic prototype defined in <asm/proc-fns.h>
such as cpu_proc_init() in this case. (This is a bit similar to
the "interface" or inheritance concept in other languages.)

To be able to annotate these assembly calls for CFI, they all need
to have a proper C prototype per CPU call.

Define these in a new C file that is only compiled when we use
CFI, and add __ADDRESSABLE() to each so the compiler knows that
these will be addressed (they are not explicitly called in C, they
are called by way of cpu_proc_init() etc).

It is a bit of definitions, but we do not expect new ARM32 CPUs
to appear very much so it should be pretty static.

Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/mm/Makefile
arch/arm/mm/proc.c [new file with mode: 0644]