-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
powerpc/asm: Add a patch_site macro & helpers for patching instructions
Add a macro and some helper C functions for patching single asm instructions. The gas macro means we can do something like: 1: nop patch_site 1b, patch__foo Which is less visually distracting than defining a GLOBAL symbol at 1, and also doesn't pollute the symbol table which can confuse eg. perf. These are obviously similar to our existing feature sections, but are not automatically patched based on CPU/MMU features, rather they are designed to be manually patched by C code at some arbitrary point. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
- Loading branch information
Michael Ellerman
committed
Aug 7, 2018
1 parent
26cb1f3
commit 06d0bbc
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* SPDX-License-Identifier: GPL-2.0+ */ | ||
/* | ||
* Copyright 2018, Michael Ellerman, IBM Corporation. | ||
*/ | ||
#ifndef _ASM_POWERPC_CODE_PATCHING_ASM_H | ||
#define _ASM_POWERPC_CODE_PATCHING_ASM_H | ||
|
||
/* Define a "site" that can be patched */ | ||
.macro patch_site label name | ||
.pushsection ".rodata" | ||
.balign 4 | ||
.global \name | ||
\name: | ||
.4byte \label - . | ||
.popsection | ||
.endm | ||
|
||
#endif /* _ASM_POWERPC_CODE_PATCHING_ASM_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters