Commit ee78fdc7 authored by James Morse's avatar James Morse Committed by Will Deacon

arm64: Create sections.h

Each time new section markers are added, kernel/vmlinux.ld.S is updated,
and new extern char __start_foo[] definitions are scattered through the
tree.

Create asm/include/sections.h to collect these definitions (and include
the existing asm-generic version).
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
Tested-by: default avatarMark Rutland <mark.rutland@arm.com>
Reviewed-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
parent cab15ce6
...@@ -32,7 +32,6 @@ generic-y += poll.h ...@@ -32,7 +32,6 @@ generic-y += poll.h
generic-y += preempt.h generic-y += preempt.h
generic-y += resource.h generic-y += resource.h
generic-y += rwsem.h generic-y += rwsem.h
generic-y += sections.h
generic-y += segment.h generic-y += segment.h
generic-y += sembuf.h generic-y += sembuf.h
generic-y += serial.h generic-y += serial.h
......
/*
* Copyright (C) 2016 ARM Limited
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ASM_SECTIONS_H
#define __ASM_SECTIONS_H
#include <asm-generic/sections.h>
extern char __alt_instructions[], __alt_instructions_end[];
extern char __exception_text_start[], __exception_text_end[];
extern char __hibernate_exit_text_start[], __hibernate_exit_text_end[];
extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[];
extern char __hyp_text_start[], __hyp_text_end[];
extern char __idmap_text_start[], __idmap_text_end[];
extern char __irqentry_text_start[], __irqentry_text_end[];
#endif /* __ASM_SECTIONS_H */
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#define __ASM_TRAP_H #define __ASM_TRAP_H
#include <linux/list.h> #include <linux/list.h>
#include <asm/sections.h>
struct pt_regs; struct pt_regs;
...@@ -39,9 +40,6 @@ void arm64_notify_segfault(struct pt_regs *regs, unsigned long addr); ...@@ -39,9 +40,6 @@ void arm64_notify_segfault(struct pt_regs *regs, unsigned long addr);
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static inline int __in_irqentry_text(unsigned long ptr) static inline int __in_irqentry_text(unsigned long ptr)
{ {
extern char __irqentry_text_start[];
extern char __irqentry_text_end[];
return ptr >= (unsigned long)&__irqentry_text_start && return ptr >= (unsigned long)&__irqentry_text_start &&
ptr < (unsigned long)&__irqentry_text_end; ptr < (unsigned long)&__irqentry_text_end;
} }
...@@ -54,8 +52,6 @@ static inline int __in_irqentry_text(unsigned long ptr) ...@@ -54,8 +52,6 @@ static inline int __in_irqentry_text(unsigned long ptr)
static inline int in_exception_text(unsigned long ptr) static inline int in_exception_text(unsigned long ptr)
{ {
extern char __exception_text_start[];
extern char __exception_text_end[];
int in; int in;
in = ptr >= (unsigned long)&__exception_text_start && in = ptr >= (unsigned long)&__exception_text_start &&
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLY__
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/sections.h>
/* /*
* __boot_cpu_mode records what mode CPUs were booted in. * __boot_cpu_mode records what mode CPUs were booted in.
...@@ -87,14 +88,6 @@ extern void verify_cpu_run_el(void); ...@@ -87,14 +88,6 @@ extern void verify_cpu_run_el(void);
static inline void verify_cpu_run_el(void) {} static inline void verify_cpu_run_el(void) {}
#endif #endif
/* The section containing the hypervisor idmap text */
extern char __hyp_idmap_text_start[];
extern char __hyp_idmap_text_end[];
/* The section containing the hypervisor text */
extern char __hyp_text_start[];
extern char __hyp_text_end[];
#endif /* __ASSEMBLY__ */ #endif /* __ASSEMBLY__ */
#endif /* ! __ASM__VIRT_H */ #endif /* ! __ASM__VIRT_H */
...@@ -25,14 +25,13 @@ ...@@ -25,14 +25,13 @@
#include <asm/alternative.h> #include <asm/alternative.h>
#include <asm/cpufeature.h> #include <asm/cpufeature.h>
#include <asm/insn.h> #include <asm/insn.h>
#include <asm/sections.h>
#include <linux/stop_machine.h> #include <linux/stop_machine.h>
#define __ALT_PTR(a,f) (u32 *)((void *)&(a)->f + (a)->f) #define __ALT_PTR(a,f) (u32 *)((void *)&(a)->f + (a)->f)
#define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset) #define ALT_ORIG_PTR(a) __ALT_PTR(a, orig_offset)
#define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset) #define ALT_REPL_PTR(a) __ALT_PTR(a, alt_offset)
extern struct alt_instr __alt_instructions[], __alt_instructions_end[];
struct alt_region { struct alt_region {
struct alt_instr *begin; struct alt_instr *begin;
struct alt_instr *end; struct alt_instr *end;
...@@ -124,8 +123,8 @@ static int __apply_alternatives_multi_stop(void *unused) ...@@ -124,8 +123,8 @@ static int __apply_alternatives_multi_stop(void *unused)
{ {
static int patched = 0; static int patched = 0;
struct alt_region region = { struct alt_region region = {
.begin = __alt_instructions, .begin = (struct alt_instr *)__alt_instructions,
.end = __alt_instructions_end, .end = (struct alt_instr *)__alt_instructions_end,
}; };
/* We always have a CPU 0 at this point (__init) */ /* We always have a CPU 0 at this point (__init) */
......
...@@ -54,12 +54,6 @@ extern int in_suspend; ...@@ -54,12 +54,6 @@ extern int in_suspend;
/* Do we need to reset el2? */ /* Do we need to reset el2? */
#define el2_reset_needed() (is_hyp_mode_available() && !is_kernel_in_hyp_mode()) #define el2_reset_needed() (is_hyp_mode_available() && !is_kernel_in_hyp_mode())
/*
* Start/end of the hibernate exit code, this must be copied to a 'safe'
* location in memory, and executed from there.
*/
extern char __hibernate_exit_text_start[], __hibernate_exit_text_end[];
/* temporary el2 vectors in the __hibernate_exit_text section. */ /* temporary el2 vectors in the __hibernate_exit_text section. */
extern char hibernate_el2_vectors[]; extern char hibernate_el2_vectors[];
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <asm/insn.h> #include <asm/insn.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm-generic/sections.h> #include <asm/sections.h>
#include "decode-insn.h" #include "decode-insn.h"
...@@ -540,9 +540,6 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) ...@@ -540,9 +540,6 @@ int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
bool arch_within_kprobe_blacklist(unsigned long addr) bool arch_within_kprobe_blacklist(unsigned long addr)
{ {
extern char __idmap_text_start[], __idmap_text_end[];
extern char __hyp_idmap_text_start[], __hyp_idmap_text_end[];
if ((addr >= (unsigned long)__kprobes_text_start && if ((addr >= (unsigned long)__kprobes_text_start &&
addr < (unsigned long)__kprobes_text_end) || addr < (unsigned long)__kprobes_text_end) ||
(addr >= (unsigned long)__entry_text_start && (addr >= (unsigned long)__entry_text_start &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment