mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 21:52:04 +00:00
5f34fe1cfc
* 'core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (63 commits) stacktrace: provide save_stack_trace_tsk() weak alias rcu: provide RCU options on non-preempt architectures too printk: fix discarding message when recursion_bug futex: clean up futex_(un)lock_pi fault handling "Tree RCU": scalable classic RCU implementation futex: rename field in futex_q to clarify single waiter semantics x86/swiotlb: add default swiotlb_arch_range_needs_mapping x86/swiotlb: add default phys<->bus conversion x86: unify pci iommu setup and allow swiotlb to compile for 32 bit x86: add swiotlb allocation functions swiotlb: consolidate swiotlb info message printing swiotlb: support bouncing of HighMem pages swiotlb: factor out copy to/from device swiotlb: add arch hook to force mapping swiotlb: allow architectures to override phys<->bus<->phys conversions swiotlb: add comment where we handle the overflow of a dma mask on 32 bit rcu: fix rcutorture behavior during reboot resources: skip sanity check of busy resources swiotlb: move some definitions to header swiotlb: allow architectures to override swiotlb pool allocation ... Fix up trivial conflicts in arch/x86/kernel/Makefile arch/x86/mm/init_32.c include/linux/hardirq.h as per Ingo's suggestions.
86 lines
2.6 KiB
C
86 lines
2.6 KiB
C
/* Rewritten by Rusty Russell, on the backs of many others...
|
|
Copyright (C) 2001 Rusty Russell, 2002 Rusty Russell IBM.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
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, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
#include <linux/module.h>
|
|
#include <linux/init.h>
|
|
#include <linux/ftrace.h>
|
|
#include <asm/uaccess.h>
|
|
#include <asm/sections.h>
|
|
|
|
extern struct exception_table_entry __start___ex_table[];
|
|
extern struct exception_table_entry __stop___ex_table[];
|
|
|
|
/* Sort the kernel's built-in exception table */
|
|
void __init sort_main_extable(void)
|
|
{
|
|
sort_extable(__start___ex_table, __stop___ex_table);
|
|
}
|
|
|
|
/* Given an address, look for it in the exception tables. */
|
|
const struct exception_table_entry *search_exception_tables(unsigned long addr)
|
|
{
|
|
const struct exception_table_entry *e;
|
|
|
|
e = search_extable(__start___ex_table, __stop___ex_table-1, addr);
|
|
if (!e)
|
|
e = search_module_extables(addr);
|
|
return e;
|
|
}
|
|
|
|
__notrace_funcgraph int core_kernel_text(unsigned long addr)
|
|
{
|
|
if (addr >= (unsigned long)_stext &&
|
|
addr <= (unsigned long)_etext)
|
|
return 1;
|
|
|
|
if (system_state == SYSTEM_BOOTING &&
|
|
addr >= (unsigned long)_sinittext &&
|
|
addr <= (unsigned long)_einittext)
|
|
return 1;
|
|
return 0;
|
|
}
|
|
|
|
__notrace_funcgraph int __kernel_text_address(unsigned long addr)
|
|
{
|
|
if (core_kernel_text(addr))
|
|
return 1;
|
|
return __module_text_address(addr) != NULL;
|
|
}
|
|
|
|
int kernel_text_address(unsigned long addr)
|
|
{
|
|
if (core_kernel_text(addr))
|
|
return 1;
|
|
return module_text_address(addr) != NULL;
|
|
}
|
|
|
|
/*
|
|
* On some architectures (PPC64, IA64) function pointers
|
|
* are actually only tokens to some data that then holds the
|
|
* real function address. As a result, to find if a function
|
|
* pointer is part of the kernel text, we need to do some
|
|
* special dereferencing first.
|
|
*/
|
|
int func_ptr_is_kernel_text(void *ptr)
|
|
{
|
|
unsigned long addr;
|
|
addr = (unsigned long) dereference_function_descriptor(ptr);
|
|
if (core_kernel_text(addr))
|
|
return 1;
|
|
return module_text_address(addr) != NULL;
|
|
}
|