mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-01-23 15:12:55 +01:00
Add text patching api's to use in subsequent jump_label implementation. We use a new fixmap FIX_TEXT_POKE0 entry to temporarily override MMU mappings to allow read only text pages to be written to. Previously, __set_fix was marked with __init as it was only used during the EARLYCON stage. Now that TEXT_POKE mappings require post-init usage (e.g., FIX_TEXT_POKE0), keeping __init would cause runtime bugs whenset_fixmap accesses invalid memory. Thus, we remove the __init flag to ensure __set_fix remains valid beyond initialization. A new function patch_insn_write is exposed to allow single instruction patching. Link: https://lore.kernel.org/openrisc/aJIC8o1WmVHol9RY@antec/T/#t Signed-off-by: chenmiao <chenmiao.ku@gmail.com> Signed-off-by: Stafford Horne <shorne@gmail.com>
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* OpenRISC Linux
|
|
*
|
|
* Linux architectural port borrowing liberally from similar works of
|
|
* others. All original copyrights apply as per the original source
|
|
* declaration.
|
|
*
|
|
* OpenRISC implementation:
|
|
* Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
|
|
* Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
|
|
* et al.
|
|
*/
|
|
|
|
#ifndef __ASM_OPENRISC_FIXMAP_H
|
|
#define __ASM_OPENRISC_FIXMAP_H
|
|
|
|
/* Why exactly do we need 2 empty pages between the top of the fixed
|
|
* addresses and the top of virtual memory? Something is using that
|
|
* memory space but not sure what right now... If you find it, leave
|
|
* a comment here.
|
|
*/
|
|
#define FIXADDR_TOP ((unsigned long) (-2*PAGE_SIZE))
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/bug.h>
|
|
#include <asm/page.h>
|
|
|
|
enum fixed_addresses {
|
|
FIX_EARLYCON_MEM_BASE,
|
|
FIX_TEXT_POKE0,
|
|
__end_of_fixed_addresses
|
|
};
|
|
|
|
#define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
|
|
/* FIXADDR_BOTTOM might be a better name here... */
|
|
#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
|
|
#define FIXMAP_PAGE_IO PAGE_KERNEL_NOCACHE
|
|
|
|
extern void __set_fixmap(enum fixed_addresses idx,
|
|
phys_addr_t phys, pgprot_t flags);
|
|
|
|
#include <asm-generic/fixmap.h>
|
|
|
|
#endif
|