Commit a34aca8a authored by Patrick Mochel's avatar Patrick Mochel

Merge bk://linux.bkbits.net/linux-2.5

into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
parents 199578c4 ae4d9837
......@@ -121,8 +121,10 @@ include/asm-$(ARCH)/asm_offsets.h: arch/$(ARCH)/kernel/asm-offsets.s
archclean:
$(Q)$(MAKE) -f scripts/Makefile.clean obj=$(boot)
CLEAN_FILES += include/asm-$(ARCH)/offset.h.tmp \
include/asm-$(ARCH)/offset.h
archmrproper:
CLEAN_FILES += include/asm-$(ARCH)/asm_offsets.h.tmp \
include/asm-$(ARCH)/asm_offsets.h
define archhelp
echo '* boot - Compressed kernel image (arch/alpha/boot/vmlinux.gz)'
......
......@@ -14,6 +14,7 @@
#include <linux/tty.h>
#include <linux/delay.h>
#include <linux/smp_lock.h>
#include <linux/module.h>
#include <asm/gentrap.h>
#include <asm/uaccess.h>
......@@ -465,7 +466,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
{
long error, tmp1, tmp2, tmp3, tmp4;
unsigned long pc = regs.pc - 4;
unsigned fixup;
const struct exception_table_entry *fixup;
unaligned[0].count++;
unaligned[0].va = (unsigned long) va;
......@@ -638,7 +639,7 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg,
got_exception:
/* Ok, we caught the exception, but we don't want it. Is there
someone to pass it along to? */
if ((fixup = search_exception_table(pc)) != 0) {
if ((fixup = search_exception_tables(pc)) != 0) {
unsigned long newpc;
newpc = fixup_exception(una_reg, fixup, pc);
......
......@@ -6,13 +6,10 @@
#include <linux/module.h>
#include <asm/uaccess.h>
extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[];
static inline unsigned
search_one_table(const struct exception_table_entry *first,
const struct exception_table_entry *last,
unsigned long value)
const struct exception_table_entry *
search_extable(const struct exception_table_entry *first,
const struct exception_table_entry *last,
unsigned long value)
{
while (first <= last) {
const struct exception_table_entry *mid;
......@@ -21,40 +18,12 @@ search_one_table(const struct exception_table_entry *first,
mid = (last - first) / 2 + first;
mid_value = (unsigned long)&mid->insn + mid->insn;
if (mid_value == value)
return mid->fixup.unit;
return mid;
else if (mid_value < value)
first = mid+1;
else
last = mid-1;
}
return 0;
}
unsigned
search_exception_table(unsigned long addr)
{
unsigned ret;
#ifndef CONFIG_MODULES
ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr);
#else
unsigned long flags;
struct list_head *i;
ret = 0;
spin_lock_irqsave(&modlist_lock, flags);
list_for_each(i, &extables) {
struct exception_table *ex
= list_entry(i, struct exception_table, list);
if (ex->num_entries == 0)
continue;
ret = search_one_table(ex->entry,
ex->entry + ex->num_entries - 1, addr);
if (ret)
break;
}
spin_unlock_irqrestore(&modlist_lock, flags);
#endif
return ret;
return NULL;
}
......@@ -24,6 +24,7 @@
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <asm/system.h>
#include <asm/uaccess.h>
......@@ -88,7 +89,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
{
struct vm_area_struct * vma;
struct mm_struct *mm = current->mm;
unsigned int fixup;
const struct exception_table_entry *fixup;
int fault, si_code = SEGV_MAPERR;
siginfo_t info;
......@@ -176,7 +177,7 @@ do_page_fault(unsigned long address, unsigned long mmcsr,
no_context:
/* Are we prepared to handle this fault as an exception? */
if ((fixup = search_exception_table(regs->pc)) != 0) {
if ((fixup = search_exception_tables(regs->pc)) != 0) {
unsigned long newpc;
newpc = fixup_exception(dpf_reg, fixup, regs->pc);
regs->pc = newpc;
......
......@@ -67,9 +67,9 @@ void module_free(struct module *module, void *region)
vfree(region);
}
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
......
......@@ -31,8 +31,6 @@
#define REG_CSCIR 0x22 /* Chip Setup and Control Index Register */
#define REG_CSCDR 0x23 /* Chip Setup and Control Data Register */
#define SAFE_FREQ 33000 /* every Elan CPU can run at 33 MHz */
static struct cpufreq_driver *elanfreq_driver;
/* Module parameter */
......@@ -184,7 +182,7 @@ static int elanfreq_verify (struct cpufreq_policy *policy)
cpufreq_verify_within_limits(policy, 1000, max_freq);
for (i=(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i>=0; i--)
for (i=7; i>=0; i--)
if ((elan_multiplier[i].clock >= policy->min) &&
(elan_multiplier[i].clock <= policy->max))
number_states++;
......@@ -192,57 +190,46 @@ static int elanfreq_verify (struct cpufreq_policy *policy)
if (number_states)
return 0;
for (i=(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i>=0; i--)
for (i=7; i>=0; i--)
if (elan_multiplier[i].clock < policy->max)
break;
policy->max = elan_multiplier[i+1].clock;
cpufreq_verify_within_limits(policy, 1000, max_freq);
return 0;
}
static int elanfreq_setpolicy (struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i, j=4;
unsigned int i;
unsigned int optimal = 8;
if (!elanfreq_driver)
return -EINVAL;
for (i=(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i>=0; i--)
if ((elan_multiplier[i].clock >= policy->min) &&
(elan_multiplier[i].clock <= policy->max))
{
number_states++;
j = i;
for (i=0; i<8; i++) {
if ((elan_multiplier[i].clock > policy->max) ||
(elan_multiplier[i].clock < policy->min))
continue;
switch(policy->policy) {
case CPUFREQ_POLICY_POWERSAVE:
if (optimal == 8)
optimal = i;
break;
case CPUFREQ_POLICY_PERFORMANCE:
optimal = i;
break;
default:
return -EINVAL;
}
if (number_states == 1) {
elanfreq_set_cpu_state(j);
return 0;
}
switch (policy->policy) {
case CPUFREQ_POLICY_POWERSAVE:
for (i=(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i>=0; i--)
if ((elan_multiplier[i].clock >= policy->min) &&
(elan_multiplier[i].clock <= policy->max))
j = i;
break;
case CPUFREQ_POLICY_PERFORMANCE:
for (i=0; i<(sizeof(elan_multiplier)/sizeof(struct s_elan_multiplier) - 1); i++)
if ((elan_multiplier[i].clock >= policy->min) &&
(elan_multiplier[i].clock <= policy->max))
j = i;
break;
default:
if ((optimal == 8) || (elan_multiplier[optimal].clock > max_freq))
return -EINVAL;
}
if (elan_multiplier[j].clock > max_freq)
return -EINVAL;
elanfreq_set_cpu_state(optimal);
elanfreq_set_cpu_state(j);
return 0;
}
......@@ -307,7 +294,7 @@ static int __init elanfreq_init(void)
driver->policy[0].max = max_freq;
driver->policy[0].policy = CPUFREQ_POLICY_PERFORMANCE;
driver->policy[0].cpuinfo.max_freq = max_freq;
driver->policy[0].cpuinfo.min_freq = min_freq;
driver->policy[0].cpuinfo.min_freq = 1000;
driver->policy[0].cpuinfo.transition_latency = CPUFREQ_ETERNAL;
elanfreq_driver = driver;
......
......@@ -82,12 +82,17 @@ static int cpufreq_p4_setdc(unsigned int cpu, unsigned int newstate)
/* get current state */
rdmsr(MSR_IA32_THERM_CONTROL, l, h);
l = l >> 1;
l &= 0x7;
if (l & 0x10) {
l = l >> 1;
l &= 0x7;
} else
l = DC_DISABLE;
if (l == newstate) {
set_cpus_allowed(current, cpus_allowed);
return 0;
} else if (l == DC_RESV) {
printk(KERN_ERR PFX "BIG FAT WARNING: currently in invalid setting\n");
}
/* notifiers */
......@@ -141,13 +146,18 @@ static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
unsigned int i;
unsigned int newstate = 0;
unsigned int number_states = 0;
unsigned int minstate = 1;
if (!cpufreq_p4_driver || !stock_freq || !policy)
if (!cpufreq_p4_driver || !stock_freq ||
!policy || !cpu_online(policy->cpu))
return -EINVAL;
if (has_N44_O17_errata)
minstate = 3;
if (policy->policy == CPUFREQ_POLICY_POWERSAVE)
{
for (i=8; i>0; i--)
for (i=8; i>=minstate; i--)
if ((policy->min <= ((stock_freq / 8) * i)) &&
(policy->max >= ((stock_freq / 8) * i)))
{
......@@ -155,7 +165,7 @@ static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
number_states++;
}
} else {
for (i=1; i<=8; i++)
for (i=minstate; i<=8; i++)
if ((policy->min <= ((stock_freq / 8) * i)) &&
(policy->max >= ((stock_freq / 8) * i)))
{
......@@ -164,25 +174,8 @@ static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
}
}
/* if (number_states == 1) */
{
if (policy->cpu == CPUFREQ_ALL_CPUS) {
for (i=0; i<NR_CPUS; i++)
if (cpu_online(i))
cpufreq_p4_setdc(i, newstate);
} else {
cpufreq_p4_setdc(policy->cpu, newstate);
}
}
/* else {
if (policy->policy == CPUFREQ_POLICY_POWERSAVE) {
min_state = newstate;
max_state = newstate + (number_states - 1);
} else {
max_state = newstate;
min_state = newstate - (number_states - 1);
}
} */
cpufreq_p4_setdc(policy->cpu, newstate);
return 0;
}
......@@ -190,17 +183,21 @@ static int cpufreq_p4_setpolicy(struct cpufreq_policy *policy)
static int cpufreq_p4_verify(struct cpufreq_policy *policy)
{
unsigned int number_states = 0;
unsigned int i;
unsigned int i = 1;
if (!cpufreq_p4_driver || !stock_freq || !policy)
if (!cpufreq_p4_driver || !stock_freq ||
!policy || !cpu_online(policy->cpu))
return -EINVAL;
if (!cpu_online(policy->cpu))
policy->cpu = CPUFREQ_ALL_CPUS;
cpufreq_verify_within_limits(policy, (stock_freq / 8), stock_freq);
cpufreq_verify_within_limits(policy,
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
if (has_N44_O17_errata)
i = 3;
/* is there at least one state within limit? */
for (i=1; i<=8; i++)
/* is there at least one state within the limit? */
for (; i<=8; i++)
if ((policy->min <= ((stock_freq / 8) * i)) &&
(policy->max >= ((stock_freq / 8) * i)))
number_states++;
......@@ -209,11 +206,14 @@ static int cpufreq_p4_verify(struct cpufreq_policy *policy)
return 0;
policy->max = (stock_freq / 8) * (((unsigned int) ((policy->max * 8) / stock_freq)) + 1);
cpufreq_verify_within_limits(policy,
policy->cpuinfo.min_freq,
policy->cpuinfo.max_freq);
return 0;
}
int __init cpufreq_p4_init(void)
static int __init cpufreq_p4_init(void)
{
struct cpuinfo_x86 *c = cpu_data;
int cpuid;
......@@ -245,6 +245,16 @@ int __init cpufreq_p4_init(void)
}
printk(KERN_INFO PFX "P4/Xeon(TM) CPU On-Demand Clock Modulation available\n");
if (!stock_freq) {
if (cpu_khz)
stock_freq = cpu_khz;
else {
printk(KERN_INFO PFX "unknown core frequency - please use module parameter 'stock_freq'\n");
return -EINVAL;
}
}
driver = kmalloc(sizeof(struct cpufreq_driver) +
NR_CPUS * sizeof(struct cpufreq_policy), GFP_KERNEL);
if (!driver)
......@@ -252,9 +262,6 @@ int __init cpufreq_p4_init(void)
driver->policy = (struct cpufreq_policy *) (driver + 1);
if (!stock_freq)
stock_freq = cpu_khz;
#ifdef CONFIG_CPU_FREQ_24_API
for (i=0;i<NR_CPUS;i++) {
driver->cpu_cur_freq[i] = stock_freq;
......@@ -290,15 +297,16 @@ int __init cpufreq_p4_init(void)
}
void __exit cpufreq_p4_exit(void)
static void __exit cpufreq_p4_exit(void)
{
u32 l, h;
unsigned int i;
if (cpufreq_p4_driver) {
for (i=0; i<NR_CPUS; i++) {
if (cpu_online(i))
cpufreq_p4_setdc(i, DC_DISABLE);
}
cpufreq_unregister();
/* return back to a non modulated state */
rdmsr(MSR_IA32_THERM_CONTROL, l, h);
wrmsr(MSR_IA32_THERM_CONTROL, l & ~(1<<4), h);
kfree(cpufreq_p4_driver);
}
}
......
......@@ -45,9 +45,9 @@ void module_free(struct module *mod, void *module_region)
}
/* We don't need anything special. */
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
......
......@@ -189,39 +189,38 @@ static unsigned long __init calibrate_tsc(void)
#ifdef CONFIG_CPU_FREQ
static unsigned int ref_freq = 0;
static unsigned long loops_per_jiffy_ref = 0;
#ifndef CONFIG_SMP
static unsigned long fast_gettimeoffset_ref = 0;
static unsigned long cpu_khz_ref = 0;
#endif
static int
time_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
void *data)
{
struct cpufreq_freqs *freq = data;
unsigned int i;
if (!cpu_has_tsc)
return 0;
if (!ref_freq) {
ref_freq = freq->old;
loops_per_jiffy_ref = cpu_data[freq->cpu].loops_per_jiffy;
#ifndef CONFIG_SMP
fast_gettimeoffset_ref = fast_gettimeoffset_quotient;
cpu_khz_ref = cpu_khz;
#endif
}
switch (val) {
case CPUFREQ_PRECHANGE:
if ((freq->old < freq->new) &&
((freq->cpu == CPUFREQ_ALL_CPUS) || (freq->cpu == 0))) {
cpu_khz = cpufreq_scale(cpu_khz, freq->old, freq->new);
fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_quotient, freq->new, freq->old);
}
for (i=0; i<NR_CPUS; i++)
if ((freq->cpu == CPUFREQ_ALL_CPUS) || (freq->cpu == i))
cpu_data[i].loops_per_jiffy = cpufreq_scale(cpu_data[i].loops_per_jiffy, freq->old, freq->new);
break;
case CPUFREQ_POSTCHANGE:
if ((freq->new < freq->old) &&
((freq->cpu == CPUFREQ_ALL_CPUS) || (freq->cpu == 0))) {
cpu_khz = cpufreq_scale(cpu_khz, freq->old, freq->new);
fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_quotient, freq->new, freq->old);
if ((val == CPUFREQ_PRECHANGE && freq->old < freq->new) ||
(val == CPUFREQ_POSTCHANGE && freq->old > freq->new)) {
cpu_data[freq->cpu].loops_per_jiffy = cpufreq_scale(loops_per_jiffy_ref, ref_freq, freq->new);
#ifndef CONFIG_SMP
if (use_tsc) {
fast_gettimeoffset_quotient = cpufreq_scale(fast_gettimeoffset_ref, freq->new, ref_freq);
cpu_khz = cpufreq_scale(cpu_khz_ref, ref_freq, freq->new);
}
for (i=0; i<NR_CPUS; i++)
if ((freq->cpu == CPUFREQ_ALL_CPUS) || (freq->cpu == i))
cpu_data[i].loops_per_jiffy = cpufreq_scale(cpu_data[i].loops_per_jiffy, freq->old, freq->new);
break;
#endif
}
return 0;
......@@ -260,6 +259,10 @@ static int init_tsc(void)
* moaned if you have the only one in the world - you fix it!
*/
#ifdef CONFIG_CPU_FREQ
cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
#endif
if (cpu_has_tsc) {
unsigned long tsc_quotient = calibrate_tsc();
if (tsc_quotient) {
......@@ -282,9 +285,6 @@ static int init_tsc(void)
"0" (eax), "1" (edx));
printk("Detected %lu.%03lu MHz processor.\n", cpu_khz / 1000, cpu_khz % 1000);
}
#ifdef CONFIG_CPU_FREQ
cpufreq_register_notifier(&time_cpufreq_notifier_block, CPUFREQ_TRANSITION_NOTIFIER);
#endif
return 0;
}
}
......
......@@ -87,50 +87,6 @@ asmlinkage void machine_check(void);
static int kstack_depth_to_print = 24;
/*
* If the address is either in the .text section of the
* kernel, or in the vmalloc'ed module regions, it *may*
* be the address of a calling routine
*/
#ifdef CONFIG_MODULES
/* FIXME: Accessed without a lock --RR */
extern struct list_head modules;
static inline int kernel_text_address(unsigned long addr)
{
int retval = 0;
struct module *mod;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
list_for_each_entry(mod, &modules, list) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound((void *)addr, 0, mod)) {
retval = 1;
break;
}
}
return retval;
}
#else
static inline int kernel_text_address(unsigned long addr)
{
return (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext);
}
#endif
void show_trace(unsigned long * stack)
{
int i;
......
......@@ -821,42 +821,6 @@ asmlinkage void buserr_c(struct frame *fp)
static int kstack_depth_to_print = 48;
extern char _stext, _etext;
#ifdef CONFIG_MODULES
/* FIXME: Accessed without a lock --RR */
extern struct list_head modules;
static inline int kernel_text_address(unsigned long addr)
{
struct module *mod;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
list_for_each_entry(mod, &modules, list) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound((void *)addr, 0, mod))
return 1;
}
return 0;
}
#else // !CONFIG_MODULES
static inline int kernel_text_address(unsigned long addr)
{
return (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext);
}
#endif // !CONFIG_MODULES
void show_trace(unsigned long *stack)
{
unsigned long *endstack;
......
......@@ -123,31 +123,6 @@ void dump_stack(void)
static int kstack_depth_to_print = 48;
extern struct module kernel_module;
static inline int kernel_text_address(unsigned long addr)
{
#ifdef CONFIG_MODULES
struct module *mod;
#endif
extern char _stext, _etext;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
#ifdef CONFIG_MODULES
for (mod = module_list; mod != &kernel_module; mod = mod->next) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound(addr, 0, mod))
return 1;
}
#endif
return 0;
}
void show_stack(unsigned long *sp)
{
......
......@@ -103,7 +103,7 @@ static unsigned long get_plt_size(const Elf32_Ehdr *hdr,
int module_frob_arch_sections(Elf32_Ehdr *hdr,
Elf32_Shdr *sechdrs,
const char *secstrings,
char *secstrings,
struct module *me)
{
unsigned int i;
......
......@@ -51,9 +51,9 @@ void module_free(struct module *mod, void *module_region)
table entries. */
}
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
// FIXME: add space needed for GOT/PLT
......
......@@ -63,50 +63,6 @@ static ext_int_info_t ext_int_pfault;
static int kstack_depth_to_print = 12;
/*
* If the address is either in the .text section of the
* kernel, or in the vmalloc'ed module regions, it *may*
* be the address of a calling routine
*/
extern char _stext, _etext;
#ifdef CONFIG_MODULES
/* FIXME: Accessed without a lock --RR */
extern struct list_head modules;
static inline int kernel_text_address(unsigned long addr)
{
int retval = 0;
struct module *mod;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
list_for_each_entry(mod, &modules, list) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound((void*)addr, 0, mod)) {
retval = 1;
break;
}
}
return retval;
}
#else
static inline int kernel_text_address(unsigned long addr)
{
return (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext);
}
#endif
void show_trace(unsigned long * stack)
{
unsigned long backchain, low_addr, high_addr, ret_addr;
......
......@@ -52,9 +52,9 @@ void module_free(struct module *mod, void *module_region)
}
/* s390/s390x needs additional memory for GOT/PLT sections. */
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
// FIXME: add space needed for GOT/PLT
......
......@@ -65,50 +65,6 @@ static ext_int_info_t ext_int_pfault;
static int kstack_depth_to_print = 20;
/*
* If the address is either in the .text section of the
* kernel, or in the vmalloc'ed module regions, it *may*
* be the address of a calling routine
*/
extern char _stext, _etext;
#ifdef CONFIG_MODULES
/* FIXME: Accessed without a lock --RR */
extern struct list_head modules;
static inline int kernel_text_address(unsigned long addr)
{
int retval = 0;
struct module *mod;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
list_for_each_entry(mod, &modules, list) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound((void*)addr, 0, mod)) {
retval = 1;
break;
}
}
return retval;
}
#else
static inline int kernel_text_address(unsigned long addr)
{
return (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext);
}
#endif
void show_trace(unsigned long * stack)
{
unsigned long backchain, low_addr, high_addr, ret_addr;
......
......@@ -37,9 +37,9 @@ void module_free(struct module *mod, void *module_region)
}
/* We don't need anything special. */
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
......
......@@ -450,13 +450,13 @@ struct ifreq32 {
struct ifmap32 ifru_map;
char ifru_slave[IFNAMSIZ]; /* Just fits the size */
char ifru_newname[IFNAMSIZ];
__kernel_caddr_t32 ifru_data;
compat_caddr_t ifru_data;
} ifr_ifru;
};
struct ifconf32 {
int ifc_len; /* size of buffer */
__kernel_caddr_t32 ifcbuf;
compat_caddr_t ifcbuf;
};
#ifdef CONFIG_NET
......@@ -1009,7 +1009,7 @@ static int fbiogscursor(unsigned int fd, unsigned int cmd, unsigned long arg)
struct fb_fix_screeninfo32 {
char id[16];
__kernel_caddr_t32 smem_start;
compat_caddr_t smem_start;
__u32 smem_len;
__u32 type;
__u32 type_aux;
......@@ -1018,7 +1018,7 @@ struct fb_fix_screeninfo32 {
__u16 ypanstep;
__u16 ywrapstep;
__u32 line_length;
__kernel_caddr_t32 mmio_start;
compat_caddr_t mmio_start;
__u32 mmio_len;
__u32 accel;
__u16 reserved[3];
......@@ -1027,10 +1027,10 @@ struct fb_fix_screeninfo32 {
struct fb_cmap32 {
__u32 start;
__u32 len;
__kernel_caddr_t32 red;
__kernel_caddr_t32 green;
__kernel_caddr_t32 blue;
__kernel_caddr_t32 transp;
compat_caddr_t red;
compat_caddr_t green;
compat_caddr_t blue;
compat_caddr_t transp;
};
static int fb_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
......@@ -1169,7 +1169,7 @@ struct floppy_struct32 {
unsigned char rate;
unsigned char spec1;
unsigned char fmt_gap;
const __kernel_caddr_t32 name;
const compat_caddr_t name;
};
struct floppy_drive_params32 {
......@@ -1208,7 +1208,7 @@ struct floppy_drive_struct32 {
int fd_ref;
int fd_device;
int last_checked;
__kernel_caddr_t32 dmabuf;
compat_caddr_t dmabuf;
int bufblocks;
};
......@@ -1732,7 +1732,7 @@ static int ppp_sock_fprog_ioctl_trans(unsigned int fd, unsigned int cmd, unsigne
}
struct ppp_option_data32 {
__kernel_caddr_t32 ptr;
compat_caddr_t ptr;
__u32 length;
int transmit;
};
......@@ -1813,8 +1813,8 @@ struct mtget32 {
__u32 mt_dsreg;
__u32 mt_gstat;
__u32 mt_erreg;
__kernel_daddr_t32 mt_fileno;
__kernel_daddr_t32 mt_blkno;
compat_daddr_t mt_fileno;
compat_daddr_t mt_blkno;
};
#define MTIOCGET32 _IOR('m', 2, struct mtget32)
......@@ -1932,7 +1932,7 @@ static int mt_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
struct cdrom_read32 {
int cdread_lba;
__kernel_caddr_t32 cdread_bufaddr;
compat_caddr_t cdread_bufaddr;
int cdread_buflen;
};
......@@ -1940,16 +1940,16 @@ struct cdrom_read_audio32 {
union cdrom_addr addr;
u_char addr_format;
int nframes;
__kernel_caddr_t32 buf;
compat_caddr_t buf;
};
struct cdrom_generic_command32 {
unsigned char cmd[CDROM_PACKET_SIZE];
__kernel_caddr_t32 buffer;
compat_caddr_t buffer;
unsigned int buflen;
int stat;
__kernel_caddr_t32 sense;
__kernel_caddr_t32 reserved[3];
compat_caddr_t sense;
compat_caddr_t reserved[3];
};
static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
......@@ -1958,7 +1958,7 @@ static int cdrom_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long ar
struct cdrom_read cdread;
struct cdrom_read_audio cdreadaudio;
struct cdrom_generic_command cgc;
__kernel_caddr_t32 addr;
compat_caddr_t addr;
char *data = 0;
void *karg;
int err = 0;
......@@ -2041,9 +2041,9 @@ out: if (data)
struct loop_info32 {
int lo_number; /* ioctl r/o */
__kernel_dev_t32 lo_device; /* ioctl r/o */
compat_dev_t lo_device; /* ioctl r/o */
unsigned int lo_inode; /* ioctl r/o */
__kernel_dev_t32 lo_rdevice; /* ioctl r/o */
compat_dev_t lo_rdevice; /* ioctl r/o */
int lo_offset;
int lo_encrypt_type;
int lo_encrypt_key_size; /* ioctl w/o */
......@@ -2248,7 +2248,7 @@ static int do_smb_getmountuid(unsigned int fd, unsigned int cmd, unsigned long a
set_fs(old_fs);
if (err >= 0)
err = put_user(kuid, (__kernel_uid_t32 *)arg);
err = put_user(kuid, (compat_uid_t *)arg);
return err;
}
......@@ -2256,7 +2256,7 @@ static int do_smb_getmountuid(unsigned int fd, unsigned int cmd, unsigned long a
struct ncp_ioctl_request_32 {
unsigned int function;
unsigned int size;
__kernel_caddr_t32 data;
compat_caddr_t data;
};
struct ncp_fs_info_v2_32 {
......@@ -2277,13 +2277,13 @@ struct ncp_objectname_ioctl_32
{
int auth_type;
unsigned int object_name_len;
__kernel_caddr_t32 object_name; /* an userspace data, in most cases user name */
compat_caddr_t object_name; /* an userspace data, in most cases user name */
};
struct ncp_privatedata_ioctl_32
{
unsigned int len;
__kernel_caddr_t32 data; /* ~1000 for NDS */
compat_caddr_t data; /* ~1000 for NDS */
};
#define NCP_IOC_NCPREQUEST_32 _IOR('n', 1, struct ncp_ioctl_request_32)
......@@ -2557,12 +2557,12 @@ static int do_ncp_setprivatedata(unsigned int fd, unsigned int cmd, unsigned lon
struct atmif_sioc32 {
int number;
int length;
__kernel_caddr_t32 arg;
compat_caddr_t arg;
};
struct atm_iobuf32 {
int length;
__kernel_caddr_t32 buffer;
compat_caddr_t buffer;
};
#define ATM_GETLINKRATE32 _IOW('a', ATMIOC_ITF+1, struct atmif_sioc32)
......@@ -2623,7 +2623,7 @@ static int do_atm_iobuf(unsigned int fd, unsigned int cmd, unsigned long arg)
iobuf.length = iobuf32.length;
if (iobuf32.buffer == (__kernel_caddr_t32) NULL || iobuf32.length == 0) {
if (iobuf32.buffer == (compat_caddr_t) NULL || iobuf32.length == 0) {
iobuf.buffer = (void*)(unsigned long)iobuf32.buffer;
} else {
iobuf.buffer = kmalloc(iobuf.length, GFP_KERNEL);
......@@ -2677,7 +2677,7 @@ static int do_atmif_sioc(unsigned int fd, unsigned int cmd, unsigned long arg)
sioc.number = sioc32.number;
sioc.length = sioc32.length;
if (sioc32.arg == (__kernel_caddr_t32) NULL || sioc32.length == 0) {
if (sioc32.arg == (compat_caddr_t) NULL || sioc32.length == 0) {
sioc.arg = (void*)(unsigned long)sioc32.arg;
} else {
sioc.arg = kmalloc(sioc.length, GFP_KERNEL);
......@@ -2835,7 +2835,7 @@ typedef struct {
} lv_status_byindex_req32_t;
typedef struct {
__kernel_dev_t32 dev;
compat_dev_t dev;
u32 lv;
} lv_status_bydev_req32_t;
......@@ -5128,7 +5128,7 @@ HANDLE_IOCTL(VIDIOCSFBUF32, do_video_ioctl)
HANDLE_IOCTL(VIDIOCGFREQ32, do_video_ioctl)
HANDLE_IOCTL(VIDIOCSFREQ32, do_video_ioctl)
/* One SMB ioctl needs translations. */
#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, __kernel_uid_t32)
#define SMB_IOC_GETMOUNTUID_32 _IOR('u', 1, compat_uid_t)
HANDLE_IOCTL(SMB_IOC_GETMOUNTUID_32, do_smb_getmountuid)
/* NCPFS */
HANDLE_IOCTL(NCP_IOC_NCPREQUEST_32, do_ncp_ncprequest)
......
......@@ -144,9 +144,9 @@ void module_free(struct module *mod, void *module_region)
}
/* We don't need anything special. */
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
......
......@@ -22,6 +22,7 @@
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/compat.h>
#include <asm/kbio.h>
/* Use this to get at 32-bit user passed pointers. */
......@@ -80,13 +81,13 @@ struct ifreq32 {
int ifru_mtu;
struct ifmap32 ifru_map;
char ifru_slave[IFNAMSIZ]; /* Just fits the size */
__kernel_caddr_t32 ifru_data;
compat_caddr_t ifru_data;
} ifr_ifru;
};
struct ifconf32 {
int ifc_len; /* size of buffer */
__kernel_caddr_t32 ifcbuf;
compat_caddr_t ifcbuf;
};
extern asmlinkage int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
......
......@@ -290,11 +290,11 @@ struct msgbuf32 { s32 mtype; char mtext[1]; };
struct ipc_perm32
{
key_t key;
__kernel_uid_t32 uid;
__kernel_gid_t32 gid;
__kernel_uid_t32 cuid;
__kernel_gid_t32 cgid;
__kernel_mode_t32 mode;
compat_uid_t uid;
compat_gid_t gid;
compat_uid_t cuid;
compat_gid_t cgid;
compat_mode_t mode;
unsigned short seq;
};
......@@ -333,8 +333,8 @@ struct msqid_ds32
unsigned short msg_cbytes;
unsigned short msg_qnum;
unsigned short msg_qbytes;
__kernel_ipc_pid_t32 msg_lspid;
__kernel_ipc_pid_t32 msg_lrpid;
compat_ipc_pid_t msg_lspid;
compat_ipc_pid_t msg_lrpid;
};
struct msqid64_ds32 {
......@@ -348,8 +348,8 @@ struct msqid64_ds32 {
unsigned int msg_cbytes;
unsigned int msg_qnum;
unsigned int msg_qbytes;
__kernel_pid_t32 msg_lspid;
__kernel_pid_t32 msg_lrpid;
compat_pid_t msg_lspid;
compat_pid_t msg_lrpid;
unsigned int __unused1;
unsigned int __unused2;
};
......@@ -361,8 +361,8 @@ struct shmid_ds32 {
compat_time_t shm_atime;
compat_time_t shm_dtime;
compat_time_t shm_ctime;
__kernel_ipc_pid_t32 shm_cpid;
__kernel_ipc_pid_t32 shm_lpid;
compat_ipc_pid_t shm_cpid;
compat_ipc_pid_t shm_lpid;
unsigned short shm_nattch;
};
......@@ -375,8 +375,8 @@ struct shmid64_ds32 {
unsigned int __pad3;
compat_time_t shm_ctime;
compat_size_t shm_segsz;
__kernel_pid_t32 shm_cpid;
__kernel_pid_t32 shm_lpid;
compat_pid_t shm_cpid;
compat_pid_t shm_lpid;
unsigned int shm_nattch;
unsigned int __unused1;
unsigned int __unused2;
......@@ -1378,6 +1378,9 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
{
int err;
if (stat->size > MAX_NON_LFS)
return -EOVERFLOW;
err = put_user(stat->dev, &statbuf->st_dev);
err |= put_user(stat->ino, &statbuf->st_ino);
err |= put_user(stat->mode, &statbuf->st_mode);
......@@ -1385,8 +1388,6 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat *statbuf)
err |= put_user(high2lowuid(stat->uid), &statbuf->st_uid);
err |= put_user(high2lowgid(stat->gid), &statbuf->st_gid);
err |= put_user(stat->rdev, &statbuf->st_rdev);
if (stat->size > MAX_NON_LFS)
return -EOVERFLOW;
err |= put_user(stat->size, &statbuf->st_size);
err |= put_user(stat->atime.tv_sec, &statbuf->st_atime);
err |= put_user(0, &statbuf->__unused1);
......@@ -1412,16 +1413,16 @@ asmlinkage int sys32_sysfs(int option, u32 arg1, u32 arg2)
struct ncp_mount_data32_v3 {
int version;
unsigned int ncp_fd;
__kernel_uid_t32 mounted_uid;
__kernel_pid_t32 wdog_pid;
compat_uid_t mounted_uid;
compat_pid_t wdog_pid;
unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
unsigned int time_out;
unsigned int retry_count;
unsigned int flags;
__kernel_uid_t32 uid;
__kernel_gid_t32 gid;
__kernel_mode_t32 file_mode;
__kernel_mode_t32 dir_mode;
compat_uid_t uid;
compat_gid_t gid;
compat_mode_t file_mode;
compat_mode_t dir_mode;
};
struct ncp_mount_data32_v4 {
......@@ -1492,11 +1493,11 @@ static void *do_ncp_super_data_conv(void *raw_data)
struct smb_mount_data32 {
int version;
__kernel_uid_t32 mounted_uid;
__kernel_uid_t32 uid;
__kernel_gid_t32 gid;
__kernel_mode_t32 file_mode;
__kernel_mode_t32 dir_mode;
compat_uid_t mounted_uid;
compat_uid_t uid;
compat_gid_t gid;
compat_mode_t file_mode;
compat_mode_t dir_mode;
};
static void *do_smb_super_data_conv(void *raw_data)
......@@ -1656,7 +1657,7 @@ static int put_rusage (struct rusage32 *ru, struct rusage *r)
return err;
}
asmlinkage int sys32_wait4(__kernel_pid_t32 pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
asmlinkage int sys32_wait4(compat_pid_t pid, unsigned int *stat_addr, int options, struct rusage32 *ru)
{
if (!ru)
return sys_wait4(pid, stat_addr, options, NULL);
......@@ -1718,7 +1719,7 @@ asmlinkage int sys32_sysinfo(struct sysinfo32 *info)
extern asmlinkage int sys_sched_rr_get_interval(pid_t pid, struct timespec *interval);
asmlinkage int sys32_sched_rr_get_interval(__kernel_pid_t32 pid, struct compat_timespec *interval)
asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid, struct compat_timespec *interval)
{
struct timespec t;
int ret;
......@@ -3027,27 +3028,27 @@ struct nfsctl_client32 {
struct nfsctl_export32 {
s8 ex32_client[NFSCLNT_IDMAX+1];
s8 ex32_path[NFS_MAXPATHLEN+1];
__kernel_dev_t32 ex32_dev;
__kernel_ino_t32 ex32_ino;
compat_dev_t ex32_dev;
compat_ino_t ex32_ino;
s32 ex32_flags;
__kernel_uid_t32 ex32_anon_uid;
__kernel_gid_t32 ex32_anon_gid;
compat_uid_t ex32_anon_uid;
compat_gid_t ex32_anon_gid;
};
struct nfsctl_uidmap32 {
u32 ug32_ident; /* char * */
__kernel_uid_t32 ug32_uidbase;
compat_uid_t ug32_uidbase;
s32 ug32_uidlen;
u32 ug32_udimap; /* uid_t * */
__kernel_uid_t32 ug32_gidbase;
compat_uid_t ug32_gidbase;
s32 ug32_gidlen;
u32 ug32_gdimap; /* gid_t * */
};
struct nfsctl_fhparm32 {
struct sockaddr gf32_addr;
__kernel_dev_t32 gf32_dev;
__kernel_ino_t32 gf32_ino;
compat_dev_t gf32_dev;
compat_ino_t gf32_ino;
s32 gf32_version;
};
......@@ -3176,7 +3177,7 @@ static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_uidlen; i++)
err |= __get_user(karg->ca_umap.ug_udimap[i],
&(((__kernel_uid_t32 *)A(uaddr))[i]));
&(((compat_uid_t *)A(uaddr))[i]));
err |= __get_user(karg->ca_umap.ug_gidbase,
&arg32->ca32_umap.ug32_gidbase);
err |= __get_user(karg->ca_umap.ug_uidlen,
......@@ -3190,7 +3191,7 @@ static int nfs_uud32_trans(struct nfsctl_arg *karg, struct nfsctl_arg32 *arg32)
return -ENOMEM;
for(i = 0; i < karg->ca_umap.ug_gidlen; i++)
err |= __get_user(karg->ca_umap.ug_gdimap[i],
&(((__kernel_gid_t32 *)A(uaddr))[i]));
&(((compat_gid_t *)A(uaddr))[i]));
return (err ? -EFAULT : 0);
}
......@@ -3482,7 +3483,7 @@ asmlinkage compat_ssize_t sys32_readahead(int fd, u32 offhi, u32 offlo, s32 coun
extern asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t *offset, size_t count);
asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s32 count)
asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t *offset, s32 count)
{
mm_segment_t old_fs = get_fs();
int ret;
......@@ -3503,7 +3504,7 @@ asmlinkage int sys32_sendfile(int out_fd, int in_fd, __kernel_off_t32 *offset, s
extern asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t *offset, size_t count);
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, __kernel_loff_t32 *offset, s32 count)
asmlinkage int sys32_sendfile64(int out_fd, int in_fd, compat_loff_t *offset, s32 count)
{
mm_segment_t old_fs = get_fs();
int ret;
......@@ -3737,7 +3738,7 @@ asmlinkage long sys32_sysctl(struct __sysctl_args32 *args)
extern asmlinkage int sys_sched_setaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
asmlinkage int sys32_sched_setaffinity(compat_pid_t pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
......@@ -3761,7 +3762,7 @@ asmlinkage int sys32_sched_setaffinity(__kernel_pid_t32 pid, unsigned int len,
extern asmlinkage int sys_sched_getaffinity(pid_t pid, unsigned int len,
unsigned long *user_mask_ptr);
asmlinkage int sys32_sched_getaffinity(__kernel_pid_t32 pid, unsigned int len,
asmlinkage int sys32_sched_getaffinity(compat_pid_t pid, unsigned int len,
u32 *user_mask_ptr)
{
unsigned long kernel_mask;
......
......@@ -798,14 +798,14 @@ asmlinkage int sunos_setpgrp(pid_t pid, pid_t pgid)
}
/* So stupid... */
extern asmlinkage int sys32_wait4(__kernel_pid_t32 pid,
extern asmlinkage int sys32_wait4(compat_pid_t pid,
u32 stat_addr, int options, u32 ru);
asmlinkage int sunos_wait4(__kernel_pid_t32 pid, u32 stat_addr, int options, u32 ru)
asmlinkage int sunos_wait4(compat_pid_t pid, u32 stat_addr, int options, u32 ru)
{
int ret;
ret = sys32_wait4((pid ? pid : ((__kernel_pid_t32)-1)),
ret = sys32_wait4((pid ? pid : ((compat_pid_t)-1)),
stat_addr, options, ru);
return ret;
}
......@@ -931,11 +931,11 @@ struct msgbuf32 {
struct ipc_perm32
{
key_t key;
__kernel_uid_t32 uid;
__kernel_gid_t32 gid;
__kernel_uid_t32 cuid;
__kernel_gid_t32 cgid;
__kernel_mode_t32 mode;
compat_uid_t uid;
compat_gid_t gid;
compat_uid_t cuid;
compat_gid_t cgid;
compat_mode_t mode;
unsigned short seq;
};
......@@ -952,8 +952,8 @@ struct msqid_ds32
unsigned short msg_cbytes;
unsigned short msg_qnum;
unsigned short msg_qbytes;
__kernel_ipc_pid_t32 msg_lspid;
__kernel_ipc_pid_t32 msg_lrpid;
compat_ipc_pid_t msg_lspid;
compat_ipc_pid_t msg_lrpid;
};
static inline int sunos_msqid_get(struct msqid_ds32 *user,
......@@ -1084,8 +1084,8 @@ struct shmid_ds32 {
compat_time_t shm_atime;
compat_time_t shm_dtime;
compat_time_t shm_ctime;
__kernel_ipc_pid_t32 shm_cpid;
__kernel_ipc_pid_t32 shm_lpid;
compat_ipc_pid_t shm_cpid;
compat_ipc_pid_t shm_lpid;
unsigned short shm_nattch;
};
......
......@@ -149,17 +149,17 @@ void data_access_exception (struct pt_regs *regs,
if (regs->tstate & TSTATE_PRIV) {
/* Test if this comes from uaccess places. */
const struct exception_table_entry *entry;
unsigned long fixup;
unsigned long g2 = regs->u_regs[UREG_G2];
if ((entry = search_extables_range(regs->tpc, &g2))) {
if ((fixup = search_extables_range(regs->tpc, &g2))) {
/* Ouch, somebody is trying ugly VM hole tricks on us... */
#ifdef DEBUG_EXCEPTIONS
printk("Exception: PC<%016lx> faddr<UNKNOWN>\n", regs->tpc);
printk("EX_TABLE: insn<%016lx> fixup<%016lx> "
"g2<%016lx>\n", regs->tpc, entry->fixup, g2);
"g2<%016lx>\n", regs->tpc, fixup, g2);
#endif
regs->tpc = entry->fixup;
regs->tpc = fixup;
regs->tnpc = regs->tpc + 4;
regs->u_regs[UREG_G2] = g2;
return;
......@@ -1390,8 +1390,8 @@ void cheetah_deferred_handler(struct pt_regs *regs, unsigned long afsr, unsigned
/* Only perform fixup if we still have a
* recoverable condition.
*/
if (entry && recoverable) {
regs->tpc = entry->fixup;
if (recoverable) {
regs->tpc = fixup;
regs->tnpc = regs->tpc + 4;
regs->u_regs[UREG_G2] = g2;
}
......
......@@ -361,7 +361,7 @@ void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn) __asm__ ("ke
void kernel_mna_trap_fault(struct pt_regs *regs, unsigned int insn)
{
unsigned long g2 = regs->u_regs [UREG_G2];
unsigned long fixup = search_exception_table (regs->tpc, &g2);
unsigned long fixup = search_extables_range(regs->tpc, &g2);
if (!fixup) {
unsigned long address = compute_effective_address(regs, insn, ((insn >> 25) & 0x1f));
......
......@@ -31,7 +31,7 @@ search_extable(const struct exception_table_entry *start,
*/
/* 1. Try to find an exact match. */
for (walk = start; walk <= end; walk++) {
for (walk = start; walk <= last; walk++) {
if (walk->fixup == 0) {
/* A range entry, skip both parts. */
walk++;
......@@ -43,7 +43,7 @@ search_extable(const struct exception_table_entry *start,
}
/* 2. Try to find a range match. */
for (walk = start; walk <= (end - 1); walk++) {
for (walk = start; walk <= (last - 1); walk++) {
if (walk->fixup)
continue;
......
......@@ -286,7 +286,7 @@ static void do_kernel_fault(struct pt_regs *regs, int si_code, int fault_code,
/* Look in asi.h: All _S asis have LS bit set */
if ((asi & 0x1) &&
(fizup = search_extables_range(regs->tpc, &g2))) {
(fixup = search_extables_range(regs->tpc, &g2))) {
regs->tpc = fixup;
regs->tnpc = regs->tpc + 4;
regs->u_regs[UREG_G2] = g2;
......
......@@ -11,49 +11,6 @@
#include "sysrq.h"
#include "user_util.h"
/*
* If the address is either in the .text section of the
* kernel, or in the vmalloc'ed module regions, it *may*
* be the address of a calling routine
*/
#ifdef CONFIG_MODULES
/* FIXME: Accessed without a lock --RR */
extern struct list_head modules;
static inline int kernel_text_address(unsigned long addr)
{
int retval = 0;
struct module *mod;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
list_for_each_entry(mod, &modules, list) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound((void *) addr, 0, mod)) {
retval = 1;
break;
}
}
return retval;
}
#else
static inline int kernel_text_address(unsigned long addr)
{
return (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext);
}
#endif
void show_trace(unsigned long * stack)
{
int i;
......
......@@ -26,9 +26,9 @@
#define DEBUGP(fmt...)
/* We don't need anything special. */
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
......
......@@ -104,44 +104,6 @@ int printk_address(unsigned long address)
}
#endif
#ifdef CONFIG_MODULES
/* FIXME: Accessed without a lock --RR */
extern struct list_head modules;
static inline int kernel_text_address(unsigned long addr)
{
int retval = 0;
struct module *mod;
if (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext)
return 1;
list_for_each_entry(mod, &modules, list) {
/* mod_bound tests for addr being inside the vmalloc'ed
* module area. Of course it'd be better to test only
* for the .text subset... */
if (mod_bound((void *)addr, 0, mod)) {
retval = 1;
break;
}
}
return retval;
}
#else
static inline int kernel_text_address(unsigned long addr)
{
return (addr >= (unsigned long) &_stext &&
addr <= (unsigned long) &_etext);
}
#endif
static inline unsigned long *in_exception_stack(int cpu, unsigned long stack)
{
int k;
......
......@@ -133,6 +133,7 @@ struct agp_bridge_data {
u32 *gatt_table;
u32 *gatt_table_real;
unsigned long scratch_page;
unsigned long scratch_page_real;
unsigned long gart_bus_addr;
unsigned long gatt_bus_addr;
u32 mode;
......@@ -145,7 +146,6 @@ struct agp_bridge_data {
int needs_scratch_page;
int aperture_size_idx;
int num_aperture_sizes;
int num_of_masks;
int capndx;
int cant_use_aperture;
......
......@@ -198,7 +198,6 @@ static struct aper_size_info_32 ali_generic_sizes[7] =
static int __init ali_generic_setup (struct pci_dev *pdev)
{
agp_bridge.masks = ali_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) ali_generic_sizes;
agp_bridge.size_type = U32_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -308,7 +308,8 @@ static int amd_insert_memory(agp_memory * mem,
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
addr = (j * PAGE_SIZE) + agp_bridge.gart_bus_addr;
cur_gatt = GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = mem->memory[i];
cur_gatt[GET_GATT_OFF(addr)] =
agp_bridge.mask_memory(mem->memory[i], mem->type);
}
agp_bridge.tlb_flush(mem);
return 0;
......@@ -354,7 +355,6 @@ static struct gatt_mask amd_irongate_masks[] =
static int __init amd_irongate_setup (struct pci_dev *pdev)
{
agp_bridge.masks = amd_irongate_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) amd_irongate_sizes;
agp_bridge.size_type = LVL2_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -81,7 +81,7 @@ static int x86_64_insert_memory(agp_memory * mem, off_t pg_start, int type)
}
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
addr = mem->memory[i];
addr = agp_bridge.mask_memory(mem->memory[i], mem->type);
tmp = addr;
BUG_ON(tmp & 0xffffff0000000ffc);
......@@ -446,7 +446,6 @@ static void agp_x86_64_agp_enable(u32 mode)
static int __init amd_8151_setup (struct pci_dev *pdev)
{
agp_bridge.masks = amd_8151_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) amd_8151_sizes;
agp_bridge.size_type = U32_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -512,6 +511,7 @@ static struct __initdata pci_driver agp_amdk8_pci_driver = {
.probe = agp_amdk8_probe,
};
/* Not static due to IOMMU code calling it early. */
int __init agp_amdk8_init(void)
{
int ret_val;
......
......@@ -86,7 +86,7 @@ static int agp_find_max (void)
{
long memory, index, result;
memory = virt_to_phys(high_memory) >> 20;
memory = (num_physpages << PAGE_SHIFT) >> 20;
index = 1;
while ((memory > maxes_table[index].mem) && (index < 8))
......@@ -123,8 +123,9 @@ static int agp_backend_initialize(struct pci_dev *dev)
printk(KERN_ERR PFX "unable to get memory for scratch page.\n");
return -ENOMEM;
}
agp_bridge.scratch_page = virt_to_phys(addr);
agp_bridge.scratch_page = agp_bridge.mask_memory(agp_bridge.scratch_page, 0);
agp_bridge.scratch_page_real = virt_to_phys(addr);
agp_bridge.scratch_page =
agp_bridge.mask_memory(agp_bridge.scratch_page_real, 0);
}
size_value = agp_bridge.fetch_size();
......@@ -165,8 +166,7 @@ static int agp_backend_initialize(struct pci_dev *dev)
err_out:
if (agp_bridge.needs_scratch_page == TRUE) {
agp_bridge.scratch_page &= ~(0x00000fff);
agp_bridge.agp_destroy_page(phys_to_virt(agp_bridge.scratch_page));
agp_bridge.agp_destroy_page(phys_to_virt(agp_bridge.scratch_page_real));
}
if (got_gatt)
agp_bridge.free_gatt_table();
......@@ -184,8 +184,7 @@ static void agp_backend_cleanup(void)
vfree(agp_bridge.key_list);
if (agp_bridge.needs_scratch_page == TRUE) {
agp_bridge.scratch_page &= ~(0x00000fff);
agp_bridge.agp_destroy_page(phys_to_virt(agp_bridge.scratch_page));
agp_bridge.agp_destroy_page(phys_to_virt(agp_bridge.scratch_page_real));
}
}
......
......@@ -110,7 +110,6 @@ void agp_free_memory(agp_memory * curr)
}
if (curr->page_count != 0) {
for (i = 0; i < curr->page_count; i++) {
curr->memory[i] &= ~(0x00000fff);
agp_bridge.agp_destroy_page(phys_to_virt(curr->memory[i]));
}
}
......@@ -158,7 +157,7 @@ agp_memory *agp_allocate_memory(size_t page_count, u32 type)
agp_free_memory(new);
return NULL;
}
new->memory[i] = agp_bridge.mask_memory(virt_to_phys(addr), type);
new->memory[i] = virt_to_phys(addr);
new->page_count++;
}
......@@ -241,9 +240,6 @@ int agp_num_entries(void)
int agp_copy_info(agp_kern_info * info)
{
unsigned long page_mask = 0;
int i;
memset(info, 0, sizeof(agp_kern_info));
if (agp_bridge.type == NOT_SUPPORTED) {
info->chipset = agp_bridge.type;
......@@ -259,11 +255,7 @@ int agp_copy_info(agp_kern_info * info)
info->max_memory = agp_bridge.max_memory_agp;
info->current_memory = atomic_read(&agp_bridge.current_memory_agp);
info->cant_use_aperture = agp_bridge.cant_use_aperture;
for(i = 0; i < agp_bridge.num_of_masks; i++)
page_mask |= agp_bridge.mask_memory(page_mask, i);
info->page_mask = ~page_mask;
info->page_mask = ~0UL;
return 0;
}
......@@ -640,7 +632,8 @@ int agp_generic_insert_memory(agp_memory * mem, off_t pg_start, int type)
}
for (i = 0, j = pg_start; i < mem->page_count; i++, j++)
agp_bridge.gatt_table[j] = mem->memory[i];
agp_bridge.gatt_table[j] =
agp_bridge.mask_memory(mem->memory[i], mem->type);
agp_bridge.tlb_flush(mem);
return 0;
......
......@@ -331,7 +331,6 @@ static unsigned long hp_zx1_mask_memory(unsigned long addr, int type)
static int __init hp_zx1_setup (struct pci_dev *pdev __attribute__((unused)))
{
agp_bridge.masks = hp_zx1_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.dev_private_data = NULL;
agp_bridge.size_type = FIXED_APER_SIZE;
agp_bridge.needs_scratch_page = FALSE;
......
......@@ -525,7 +525,6 @@ static unsigned long i460_mask_memory (unsigned long addr, int type)
static int __init intel_i460_setup (struct pci_dev *pdev __attribute__((unused)))
{
agp_bridge.num_of_masks = 1;
agp_bridge.masks = i460_masks;
agp_bridge.aperture_sizes = (void *) i460_sizes;
agp_bridge.size_type = U8_APER_SIZE;
......
......@@ -96,7 +96,6 @@ static void i7505_setup (u32 mode)
static int __init intel_7505_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_7505_sizes;
agp_bridge.size_type = U16_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -153,7 +153,8 @@ static int intel_i810_insert_entries(agp_memory * mem, off_t pg_start,
CACHE_FLUSH();
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
OUTREG32(intel_i810_private.registers,
I810_PTE_BASE + (j * 4), mem->memory[i]);
I810_PTE_BASE + (j * 4),
agp_bridge.mask_memory(mem->memory[i], mem->type));
}
CACHE_FLUSH();
......@@ -219,11 +220,11 @@ static agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type)
agp_free_memory(new);
return NULL;
}
new->memory[0] = agp_bridge.mask_memory(virt_to_phys(addr), type);
new->memory[0] = virt_to_phys(addr);
new->page_count = 1;
new->num_scratch_pages = 1;
new->type = AGP_PHYS_MEMORY;
new->physical = virt_to_phys((void *) new->memory[0]);
new->physical = new->memory[0];
return new;
}
return NULL;
......@@ -251,7 +252,6 @@ static int __init intel_i810_setup(struct pci_dev *i810_dev)
intel_i810_private.i810_dev = i810_dev;
agp_bridge.masks = intel_i810_masks;
agp_bridge.num_of_masks = 2;
agp_bridge.aperture_sizes = (void *) intel_i810_sizes;
agp_bridge.size_type = FIXED_APER_SIZE;
agp_bridge.num_aperture_sizes = 2;
......@@ -454,7 +454,8 @@ static int intel_i830_insert_entries(agp_memory *mem,off_t pg_start,int type)
CACHE_FLUSH();
for (i = 0, j = pg_start; i < mem->page_count; i++, j++)
OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (j * 4),mem->memory[i]);
OUTREG32(intel_i830_private.registers,I810_PTE_BASE + (j * 4),
agp_bridge.mask_memory(mem->memory[i], mem->type));
CACHE_FLUSH();
......@@ -514,11 +515,11 @@ static agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type)
return(NULL);
}
nw->memory[0] = agp_bridge.mask_memory(virt_to_phys(addr),type);
nw->memory[0] = virt_to_phys(addr);
nw->page_count = 1;
nw->num_scratch_pages = 1;
nw->type = AGP_PHYS_MEMORY;
nw->physical = virt_to_phys(addr);
nw->physical = nw->memory[0];
return(nw);
}
......@@ -530,7 +531,6 @@ static int __init intel_i830_setup(struct pci_dev *i830_dev)
intel_i830_private.i830_dev = i830_dev;
agp_bridge.masks = intel_i810_masks;
agp_bridge.num_of_masks = 3;
agp_bridge.aperture_sizes = (void *) intel_i830_sizes;
agp_bridge.size_type = FIXED_APER_SIZE;
agp_bridge.num_aperture_sizes = 2;
......@@ -974,7 +974,6 @@ static struct aper_size_info_8 intel_830mp_sizes[4] =
static int __init intel_generic_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_generic_sizes;
agp_bridge.size_type = U16_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -1004,7 +1003,6 @@ static int __init intel_generic_setup (struct pci_dev *pdev)
static int __init intel_815_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_815_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 2;
......@@ -1035,7 +1033,6 @@ static int __init intel_815_setup (struct pci_dev *pdev)
static int __init intel_820_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_8xx_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -1065,7 +1062,6 @@ static int __init intel_820_setup (struct pci_dev *pdev)
static int __init intel_830mp_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_830mp_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 4;
......@@ -1095,7 +1091,6 @@ static int __init intel_830mp_setup (struct pci_dev *pdev)
static int __init intel_840_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_8xx_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -1125,7 +1120,6 @@ static int __init intel_840_setup (struct pci_dev *pdev)
static int __init intel_845_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_8xx_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -1155,7 +1149,6 @@ static int __init intel_845_setup (struct pci_dev *pdev)
static int __init intel_850_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_8xx_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -1185,7 +1178,6 @@ static int __init intel_850_setup (struct pci_dev *pdev)
static int __init intel_860_setup (struct pci_dev *pdev)
{
agp_bridge.masks = intel_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) intel_8xx_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -89,7 +89,6 @@ static struct gatt_mask sis_generic_masks[] =
static int __init sis_generic_setup (struct pci_dev *pdev)
{
agp_bridge.masks = sis_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) sis_generic_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -363,7 +363,8 @@ static int serverworks_insert_memory(agp_memory * mem,
for (i = 0, j = pg_start; i < mem->page_count; i++, j++) {
addr = (j * PAGE_SIZE) + agp_bridge.gart_bus_addr;
cur_gatt = SVRWRKS_GET_GATT(addr);
cur_gatt[GET_GATT_OFF(addr)] = mem->memory[i];
cur_gatt[GET_GATT_OFF(addr)] =
agp_bridge.mask_memory(mem->memory[i], mem->type);
}
agp_bridge.tlb_flush(mem);
return 0;
......@@ -520,7 +521,6 @@ static int __init serverworks_setup (struct pci_dev *pdev)
serverworks_private.svrwrks_dev = pdev;
agp_bridge.masks = serverworks_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) serverworks_sizes;
agp_bridge.size_type = LVL2_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -97,7 +97,6 @@ static struct gatt_mask via_generic_masks[] =
static int __init via_generic_setup (struct pci_dev *pdev)
{
agp_bridge.masks = via_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) via_generic_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......@@ -203,9 +202,9 @@ static struct agp_device_ids via_agp_device_ids[] __initdata =
.chipset_name = "Apollo ProSavage PM133"
},
{
.device_id = PCI_DEVICE_ID_VIA_8235_0,
.chipset = VIA_P4X400,
.chipset_name = "P4X400"
.device_id = PCI_DEVICE_ID_VIA_8754,
.chipset = VIA_P4X,
.chipset_name = "Apollo P4X333/P4X400"
},
{ }, /* dummy final entry, always present */
};
......
......@@ -122,7 +122,6 @@ static int __init agp_via_probe (struct pci_dev *dev, const struct pci_device_id
agp_bridge.type = VIA_APOLLO_KT400_3;
agp_bridge.capndx = cap_ptr;
agp_bridge.masks = via_generic_masks;
agp_bridge.num_of_masks = 1;
agp_bridge.aperture_sizes = (void *) via_generic_sizes;
agp_bridge.size_type = U8_APER_SIZE;
agp_bridge.num_aperture_sizes = 7;
......
......@@ -790,13 +790,6 @@ int _zft_close(void)
zft_uninit_mem();
going_offline = 0;
zft_offline = 1;
} else if (zft_dirty()) {
TRACE(ft_t_noise, "Keeping module locked in memory because:\n"
KERN_INFO "header segments need updating: %s\n"
KERN_INFO "tape not at BOT : %s",
(zft_volume_table_changed || zft_header_changed)
? "yes" : "no",
zft_tape_at_lbot(&zft_pos) ? "no" : "yes");
} else if (zft_cmpr_lock(0 /* don't load */) == 0) {
(*zft_cmpr_ops->reset)(); /* unlock it again */
}
......
......@@ -47,7 +47,6 @@ extern int zft_resid;
extern void zft_reset_position(zft_position *pos);
extern int zft_check_write_access(zft_position *pos);
extern int zft_def_idle_state(void);
extern int zft_dirty(void);
/* hooks for the VFS interface
*/
......
......@@ -886,7 +886,7 @@ static void probeLptPort(unsigned idx)
instances[idx].run_flag = 0;
init_timer(&instances[idx].timer_list);
instances[idx].timer_list.function = bpp_wake_up;
if (check_region(lpAddr,3)) return;
if (!request_region(lpAddr,3, dev_name)) return;
/*
* First, make sure the instance exists. Do this by writing to
......@@ -904,7 +904,6 @@ static void probeLptPort(unsigned idx)
unsigned save;
instances[idx].present = 1;
request_region(lpAddr,3, dev_name);
save = inb_p(lpAddr+2);
for (testvalue=0; testvalue<BPP_DELAY; testvalue++)
;
......@@ -921,7 +920,9 @@ static void probeLptPort(unsigned idx)
instances[idx].enhanced = 1;
outb_p(save, lpAddr+2);
}
else {
release_region(lpAddr,3);
}
/*
* Leave the port in compat idle mode.
*/
......
......@@ -892,6 +892,10 @@ static void envctrl_init_i2c_child(struct linux_ebus_child *edev_child,
}
pchild->tables = kmalloc(tbls_size, GFP_KERNEL);
if (pchild->tables == NULL){
printk("envctrl: Failed to allocate table.\n");
return;
}
len = prom_getproperty(node, "tables",
(char *) pchild->tables, tbls_size);
if (len <= 0) {
......
......@@ -386,6 +386,7 @@ static void __init fb_set_logocmap(struct fb_info *info)
palette_cmap.red = palette_red;
palette_cmap.green = palette_green;
palette_cmap.blue = palette_blue;
palette_cmap.transp = NULL;
for (i = 0; i < LINUX_LOGO_COLORS; i += n) {
n = LINUX_LOGO_COLORS - i;
......@@ -767,6 +768,7 @@ fb_set_var(struct fb_var_screeninfo *var, struct fb_info *info)
int
fb_blank(int blank, struct fb_info *info)
{
/* ??? Varible sized stack allocation. */
u16 black[info->cmap.len];
struct fb_cmap cmap;
......@@ -775,8 +777,7 @@ fb_blank(int blank, struct fb_info *info)
if (blank) {
memset(black, 0, info->cmap.len * sizeof(u16));
cmap.red = cmap.green = cmap.blue = black;
if (info->cmap.transp)
cmap.transp = black;
cmap.transp = info->cmap.transp ? black : NULL;
cmap.start = info->cmap.start;
cmap.len = info->cmap.len;
} else
......
......@@ -501,19 +501,14 @@ struct exception_table_entry
} fixup;
};
/* Returns 0 if exception not found and fixup.unit otherwise. */
extern unsigned search_exception_table(unsigned long);
/* Returns the new pc */
#define fixup_exception(map_reg, fixup_unit, pc) \
#define fixup_exception(map_reg, fixup, pc) \
({ \
union exception_fixup __fie_fixup; \
__fie_fixup.unit = fixup_unit; \
if (__fie_fixup.bits.valreg != 31) \
map_reg(__fie_fixup.bits.valreg) = 0; \
if (__fie_fixup.bits.errreg != 31) \
map_reg(__fie_fixup.bits.errreg) = -EFAULT; \
(pc) + __fie_fixup.bits.nextinsn; \
if ((fixup)->fixup.bits.valreg != 31) \
map_reg((fixup)->fixup.bits.valreg) = 0; \
if ((fixup)->fixup.bits.errreg != 31) \
map_reg((fixup)->fixup.bits.errreg) = -EFAULT; \
(pc) + (fixup)->fixup.bits.nextinsn; \
})
......
......@@ -5,32 +5,25 @@
*/
#include <linux/types.h>
#define COMPAT_USER_HZ 100
#define COMPAT_USER_HZ 100
typedef u32 compat_size_t;
typedef s32 compat_ssize_t;
typedef s32 compat_time_t;
typedef s32 compat_clock_t;
struct compat_stat {
__kernel_dev_t32 st_dev;
__kernel_ino_t32 st_ino;
__kernel_mode_t32 st_mode;
s16 st_nlink;
__kernel_uid_t32 st_uid;
__kernel_gid_t32 st_gid;
__kernel_dev_t32 st_rdev;
__kernel_off_t32 st_size;
compat_time_t st_atime;
u32 __unused1;
compat_time_t st_mtime;
u32 __unused2;
compat_time_t st_ctime;
u32 __unused3;
__kernel_off_t32 st_blksize;
__kernel_off_t32 st_blocks;
u32 __unused4[2];
};
typedef s32 compat_pid_t;
typedef u16 compat_uid_t;
typedef u16 compat_gid_t;
typedef u16 compat_mode_t;
typedef u32 compat_ino_t;
typedef u16 compat_dev_t;
typedef s32 compat_off_t;
typedef s64 compat_loff_t;
typedef s16 compat_nlink_t;
typedef u16 compat_ipc_pid_t;
typedef s32 compat_daddr_t;
typedef u32 compat_caddr_t;
typedef __kernel_fsid_t compat_fsid_t;
struct compat_timespec {
compat_time_t tv_sec;
......@@ -42,13 +35,33 @@ struct compat_timeval {
s32 tv_usec;
};
struct compat_stat {
compat_dev_t st_dev;
compat_ino_t st_ino;
compat_mode_t st_mode;
compat_nlink_t st_nlink;
compat_uid_t st_uid;
compat_gid_t st_gid;
compat_dev_t st_rdev;
compat_off_t st_size;
compat_time_t st_atime;
u32 __unused1;
compat_time_t st_mtime;
u32 __unused2;
compat_time_t st_ctime;
u32 __unused3;
compat_off_t st_blksize;
compat_off_t st_blocks;
u32 __unused4[2];
};
struct compat_flock {
short l_type;
short l_whence;
__kernel_off_t32 l_start;
__kernel_off_t32 l_len;
__kernel_pid_t32 l_pid;
short __unused;
short l_type;
short l_whence;
compat_off_t l_start;
compat_off_t l_len;
compat_pid_t l_pid;
short __unused;
};
#endif /* _ASM_SPARC64_COMPAT_H */
......@@ -47,23 +47,6 @@ typedef struct {
#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
} __kernel_fsid_t;
/* Now 32bit compatibility types */
typedef int __kernel_ptrdiff_t32;
typedef int __kernel_pid_t32;
typedef unsigned short __kernel_ipc_pid_t32;
typedef unsigned short __kernel_uid_t32;
typedef unsigned short __kernel_gid_t32;
typedef unsigned short __kernel_dev_t32;
typedef unsigned int __kernel_ino_t32;
typedef unsigned short __kernel_mode_t32;
typedef unsigned short __kernel_umode_t32;
typedef short __kernel_nlink_t32;
typedef int __kernel_daddr_t32;
typedef int __kernel_off_t32;
typedef unsigned int __kernel_caddr_t32;
typedef long __kernel_loff_t32;
typedef __kernel_fsid_t __kernel_fsid_t32;
#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
#undef __FD_SET
......
......@@ -13,7 +13,7 @@
#ifdef __KERNEL__
#include <asm/compat.h>
#include <linux/compat.h>
typedef union sigval32 {
int sival_int;
......@@ -30,7 +30,7 @@ typedef struct siginfo32 {
/* kill() */
struct {
__kernel_pid_t32 _pid; /* sender's pid */
compat_pid_t _pid; /* sender's pid */
unsigned int _uid; /* sender's uid */
} _kill;
......@@ -42,14 +42,14 @@ typedef struct siginfo32 {
/* POSIX.1b signals */
struct {
__kernel_pid_t32 _pid; /* sender's pid */
compat_pid_t _pid; /* sender's pid */
unsigned int _uid; /* sender's uid */
sigval_t32 _sigval;
} _rt;
/* SIGCHLD */
struct {
__kernel_pid_t32 _pid; /* which child */
compat_pid_t _pid; /* which child */
unsigned int _uid; /* sender's uid */
int _status; /* exit code */
compat_clock_t _utime;
......
......@@ -5,6 +5,7 @@
#ifndef __KERNEL_STRICT_NAMES
#include <linux/types.h>
#include <linux/compat.h> /* for compat_fsid_t */
typedef __kernel_fsid_t fsid_t;
......@@ -18,7 +19,7 @@ struct statfs32 {
int f_bavail;
int f_files;
int f_ffree;
__kernel_fsid_t32 f_fsid;
compat_fsid_t f_fsid;
int f_namelen; /* SunOS ignores this field. */
int f_spare[6];
};
......
......@@ -63,7 +63,7 @@ enum chipset_type {
VIA_APOLLO_KT400_3,
VIA_APOLLO_PRO_266,
VIA_VT8605,
VIA_P4X400,
VIA_P4X,
SIS_GENERIC,
AMD_GENERIC,
AMD_IRONGATE,
......
......@@ -84,6 +84,7 @@ extern unsigned long long memparse(char *ptr, char **retptr);
extern void dev_probe_lock(void);
extern void dev_probe_unlock(void);
extern int kernel_text_address(unsigned long addr);
extern int session_of_pgrp(int pgrp);
asmlinkage int printk(const char * fmt, ...)
......
......@@ -234,6 +234,9 @@ static inline int module_is_live(struct module *mod)
return mod->state != MODULE_STATE_GOING;
}
/* Is this address in a module? */
int module_text_address(unsigned long addr);
#ifdef CONFIG_MODULE_UNLOAD
void __symbol_put(const char *symbol);
......@@ -324,6 +327,12 @@ search_module_extables(unsigned long addr)
return NULL;
}
/* Is this address in a module? */
static int module_text_address(unsigned long addr)
{
return 0;
}
/* Get/put a kernel symbol (calls should be symmetric) */
#define symbol_get(x) (&(x))
#define symbol_put(x) do { } while(0)
......@@ -426,14 +435,6 @@ extern int module_dummy_usage;
#define GET_USE_COUNT(module) (module_dummy_usage)
#define MOD_IN_USE 0
#define __MODULE_STRING(x) __stringify(x)
#define __mod_between(a_start, a_len, b_start, b_len) \
(((a_start) >= (b_start) && (a_start) <= (b_start)+(b_len)) \
|| ((a_start)+(a_len) >= (b_start) \
&& (a_start)+(a_len) <= (b_start)+(b_len)))
#define mod_bound(p, n, m) \
(((m)->module_init \
&& __mod_between((p),(n),(m)->module_init,(m)->init_size)) \
|| __mod_between((p),(n),(m)->module_core,(m)->core_size))
/*
* The exception and symbol tables, and the lock
......
......@@ -16,9 +16,9 @@ unsigned long find_symbol_internal(Elf_Shdr *sechdrs,
/* These must be implemented by the specific architecture */
/* Adjust arch-specific sections. Return 0 on success. */
int module_frob_arch_sections(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
const char *secstrings,
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod);
/* Allocator used for allocating struct module, core sections and init
......
......@@ -1092,7 +1092,7 @@
#define PCI_DEVICE_ID_VIA_8233C_0 0x3109
#define PCI_DEVICE_ID_VIA_8361 0x3112
#define PCI_DEVICE_ID_VIA_8233A 0x3147
#define PCI_DEVICE_ID_VIA_8235_0 0x3168
#define PCI_DEVICE_ID_VIA_8754 0x3168
#define PCI_DEVICE_ID_VIA_8235 0x3177
#define PCI_DEVICE_ID_VIA_8377_0 0x3189
#define PCI_DEVICE_ID_VIA_86C100A 0x6100
......
......@@ -11,6 +11,7 @@
#ifdef __KERNEL__
#include <linux/string.h>
#include <linux/sunrpc/msg_prot.h>
#include <linux/sunrpc/cache.h>
#include <linux/string.h>
......
......@@ -927,17 +927,27 @@ EXPORT_SYMBOL(cpufreq_set_policy);
* adjust_jiffies - adjust the system "loops_per_jiffy"
*
* This function alters the system "loops_per_jiffy" for the clock
* speed change. Note that loops_per_jiffy is only updated if all
* CPUs are affected - else there is a need for per-CPU loops_per_jiffy
* values which are provided by various architectures.
* speed change. Note that loops_per_jiffy cannot be updated on SMP
* systems as each CPU might be scaled differently. So, use the arch
* per-CPU loops_per_jiffy value wherever possible.
*/
#ifndef CONFIG_SMP
static unsigned long l_p_j_ref = 0;
static unsigned int l_p_j_ref_freq = 0;
static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
{
if (!l_p_j_ref_freq) {
l_p_j_ref = loops_per_jiffy;
l_p_j_ref_freq = ci->old;
}
if ((val == CPUFREQ_PRECHANGE && ci->old < ci->new) ||
(val == CPUFREQ_POSTCHANGE && ci->old > ci->new))
if (ci->cpu == CPUFREQ_ALL_CPUS)
loops_per_jiffy = cpufreq_scale(loops_per_jiffy, ci->old, ci->new);
loops_per_jiffy = cpufreq_scale(l_p_j_ref, l_p_j_ref_freq, ci->new);
}
#else
#define adjust_jiffies(...)
#endif
/**
......
......@@ -19,6 +19,7 @@
extern const struct exception_table_entry __start___ex_table[];
extern const struct exception_table_entry __stop___ex_table[];
extern char _stext[], _etext[];
/* Given an address, look for it in the exception tables. */
const struct exception_table_entry *search_exception_tables(unsigned long addr)
......@@ -30,3 +31,12 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
e = search_module_extables(addr);
return e;
}
int kernel_text_address(unsigned long addr)
{
if (addr >= (unsigned long)_stext &&
addr <= (unsigned long)_etext)
return 1;
return module_text_address(addr);
}
......@@ -54,9 +54,9 @@
/* Protects extables and symbols lists */
static spinlock_t modlist_lock = SPIN_LOCK_UNLOCKED;
/* List of modules, protected by module_mutex */
/* List of modules, protected by module_mutex AND modlist_lock */
static DECLARE_MUTEX(module_mutex);
LIST_HEAD(modules); /* FIXME: Accessed w/o lock on oops by some archs */
static LIST_HEAD(modules);
static LIST_HEAD(symbols);
static LIST_HEAD(extables);
......@@ -754,8 +754,8 @@ unsigned long find_symbol_internal(Elf_Shdr *sechdrs,
static void free_module(struct module *mod)
{
/* Delete from various lists */
list_del(&mod->list);
spin_lock_irq(&modlist_lock);
list_del(&mod->list);
list_del(&mod->symbols.list);
list_del(&mod->gpl_symbols.list);
list_del(&mod->extable.list);
......@@ -1290,8 +1290,8 @@ sys_init_module(void *umod,
list_add(&mod->extable.list, &extables);
list_add_tail(&mod->symbols.list, &symbols);
list_add_tail(&mod->gpl_symbols.list, &symbols);
spin_unlock_irq(&modlist_lock);
list_add(&mod->list, &modules);
spin_unlock_irq(&modlist_lock);
/* Drop lock so they can recurse */
up(&module_mutex);
......@@ -1318,28 +1318,17 @@ sys_init_module(void *umod,
mod->state = MODULE_STATE_LIVE;
module_free(mod, mod->module_init);
mod->module_init = NULL;
mod->init_size = 0;
return 0;
}
#ifdef CONFIG_KALLSYMS
static inline int inside_init(struct module *mod, unsigned long addr)
{
if (mod->module_init
&& (unsigned long)mod->module_init <= addr
&& (unsigned long)mod->module_init + mod->init_size > addr)
return 1;
return 0;
}
static inline int inside_core(struct module *mod, unsigned long addr)
static inline int within(unsigned long addr, void *start, unsigned long size)
{
if ((unsigned long)mod->module_core <= addr
&& (unsigned long)mod->module_core + mod->core_size > addr)
return 1;
return 0;
return ((void *)addr >= start && (void *)addr < start + size);
}
#ifdef CONFIG_KALLSYMS
static const char *get_ksymbol(struct module *mod,
unsigned long addr,
unsigned long *size,
......@@ -1349,7 +1338,7 @@ static const char *get_ksymbol(struct module *mod,
unsigned long nextval;
/* At worse, next value is at end of module */
if (inside_core(mod, addr))
if (within(addr, mod->module_init, mod->init_size))
nextval = (unsigned long)mod->module_core+mod->core_size;
else
nextval = (unsigned long)mod->module_init+mod->init_size;
......@@ -1387,7 +1376,8 @@ const char *module_address_lookup(unsigned long addr,
struct module *mod;
list_for_each_entry(mod, &modules, list) {
if (inside_core(mod, addr) || inside_init(mod, addr)) {
if (within(addr, mod->module_init, mod->init_size)
|| within(addr, mod->module_core, mod->core_size)) {
*modname = mod->name;
return get_ksymbol(mod, addr, size, offset);
}
......@@ -1471,6 +1461,18 @@ const struct exception_table_entry *search_module_extables(unsigned long addr)
return e;
}
/* Is this a valid kernel address? We don't grab the lock: we are oopsing. */
int module_text_address(unsigned long addr)
{
struct module *mod;
list_for_each_entry(mod, &modules, list)
if (within(addr, mod->module_init, mod->init_size)
|| within(addr, mod->module_core, mod->core_size))
return 1;
return 0;
}
/* Provided by the linker */
extern const struct kernel_symbol __start___ksymtab[];
extern const struct kernel_symbol __stop___ksymtab[];
......
......@@ -273,7 +273,7 @@ void __init pidhash_init(void)
pidhash_shift = min(12, pidhash_shift);
pidhash_size = 1 << pidhash_shift;
printk("PID hash table entries: %d (order %d: %d bytes)\n",
printk("PID hash table entries: %d (order %d: %Zd bytes)\n",
pidhash_size, pidhash_shift,
pidhash_size * sizeof(struct list_head));
......
......@@ -92,7 +92,7 @@ u32 attribute((pure)) crc32_le(u32 crc, unsigned char const *p, size_t len)
crc = __cpu_to_le32(crc);
/* Align it */
for ( ; ((u32)b)&3 && len ; len--){
for ( ; ((long)b)&3 && len ; len--){
# ifdef __LITTLE_ENDIAN
crc = (crc>>8) ^ crc32table_le[ (crc ^ *((u8 *)b)++) & 0xff ];
# else
......@@ -201,7 +201,7 @@ u32 attribute((pure)) crc32_be(u32 crc, unsigned char const *p, size_t len)
crc = __cpu_to_be32(crc);
/* Align it */
for ( ; ((u32)b)&3 && len ; len--){
for ( ; ((long)b)&3 && len ; len--){
# ifdef __LITTLE_ENDIAN
crc = (crc>>8) ^ crc32table_be[ (crc ^ *((u8 *)b)++) & 0xff ];
# else
......
......@@ -97,7 +97,7 @@ void free_divert_blk(struct net_device *dev)
/*
* Adds a tcp/udp (source or dest) port to an array
*/
int add_port(u16 ports[], u16 port)
static int add_port(u16 ports[], u16 port)
{
int i;
......@@ -127,7 +127,7 @@ int add_port(u16 ports[], u16 port)
/*
* Removes a port from an array tcp/udp (source or dest)
*/
int remove_port(u16 ports[], u16 port)
static int remove_port(u16 ports[], u16 port)
{
int i;
......@@ -150,7 +150,7 @@ int remove_port(u16 ports[], u16 port)
}
/* Some basic sanity checks on the arguments passed to divert_ioctl() */
int check_args(struct divert_cf *div_cf, struct net_device **dev)
static int check_args(struct divert_cf *div_cf, struct net_device **dev)
{
char devname[32];
int ret;
......
......@@ -234,7 +234,7 @@ static struct rtable *rt_cache_get_next(struct seq_file *seq, struct rtable *r)
{
struct rt_cache_iter_state *st = seq->private;
read_barrier_depends();
smp_read_barrier_depends();
r = r->u.rt_next;
while (!r) {
rcu_read_unlock();
......@@ -718,7 +718,18 @@ static int rt_intern_hash(unsigned hash, struct rtable *rt, struct rtable **rp)
if (compare_keys(&rth->fl, &rt->fl)) {
/* Put it first */
*rthp = rth->u.rt_next;
/*
* Since lookup is lockfree, the deletion
* must be visible to another weakly ordered CPU before
* the insertion at the start of the hash chain.
*/
smp_wmb();
rth->u.rt_next = rt_hash_table[hash].chain;
/*
* Since lookup is lockfree, the update writes
* must be ordered for consistency on SMP.
*/
smp_wmb();
rt_hash_table[hash].chain = rth;
rth->u.dst.__use++;
......@@ -900,7 +911,7 @@ void ip_rt_redirect(u32 old_gw, u32 daddr, u32 new_gw,
while ((rth = *rthp) != NULL) {
struct rtable *rt;
read_barrier_depends();
smp_read_barrier_depends();
if (rth->fl.fl4_dst != daddr ||
rth->fl.fl4_src != skeys[i] ||
rth->fl.fl4_tos != tos ||
......@@ -1148,7 +1159,7 @@ unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu)
rcu_read_lock();
for (rth = rt_hash_table[hash].chain; rth;
rth = rth->u.rt_next) {
read_barrier_depends();
smp_read_barrier_depends();
if (rth->fl.fl4_dst == daddr &&
rth->fl.fl4_src == skeys[i] &&
rth->rt_dst == daddr &&
......@@ -1740,7 +1751,7 @@ int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr,
rcu_read_lock();
for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) {
read_barrier_depends();
smp_read_barrier_depends();
if (rth->fl.fl4_dst == daddr &&
rth->fl.fl4_src == saddr &&
rth->fl.iif == iif &&
......@@ -2105,7 +2116,7 @@ int __ip_route_output_key(struct rtable **rp, const struct flowi *flp)
rcu_read_lock();
for (rth = rt_hash_table[hash].chain; rth; rth = rth->u.rt_next) {
read_barrier_depends();
smp_read_barrier_depends();
if (rth->fl.fl4_dst == flp->fl4_dst &&
rth->fl.fl4_src == flp->fl4_src &&
rth->fl.iif == 0 &&
......@@ -2335,7 +2346,7 @@ int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb)
rcu_read_lock();
for (rt = rt_hash_table[h].chain, idx = 0; rt;
rt = rt->u.rt_next, idx++) {
read_barrier_depends();
smp_read_barrier_depends();
if (idx < s_idx)
continue;
skb->dst = dst_clone(&rt->u.dst);
......
......@@ -402,7 +402,13 @@ static int ipv6_auth_hdr(struct sk_buff **skb_ptr, int nhoff)
if (!pskb_may_pull(skb, (skb->h.raw-skb->data)+8))
goto fail;
len = (skb->h.raw[1]+1)<<2;
/*
* RFC2402 2.2 Payload Length
* The 8-bit field specifies the length of AH in 32-bit words
* (4-byte units), minus "2".
* -- Noriaki Takamiya @USAGI Project
*/
len = (skb->h.raw[1]+2)<<2;
if (len&7)
goto fail;
......
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