Commit f66c1132 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://ppc.bkbits.net/for-linus-ppc

into home.transmeta.com:/home/torvalds/v2.5/linux
parents df5c1aca 35ee70e6
......@@ -53,7 +53,9 @@ else
endif
endif
core-y += arch/ppc/kernel/ arch/ppc/platforms/ arch/ppc/mm/ arch/ppc/lib/
core-y += arch/ppc/kernel/ arch/ppc/platforms/ \
arch/ppc/mm/ arch/ppc/lib/
core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/
core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
core-$(CONFIG_XMON) += arch/ppc/xmon/
core-$(CONFIG_APUS) += arch/ppc/amiga/
......@@ -79,13 +81,21 @@ $(BOOT_TARGETS): vmlinux
cp -f arch/ppc/configs/$(@:config=defconfig) .config
archclean:
rm -f arch/ppc/kernel/{mk_defs,asm-offsets.h,find_name}
rm -f arch/ppc/iSeries/ReleaseData.h
@$(MAKEBOOT) clean
archmrproper:
prepare: checkbin
prepare: include/asm-$(ARCH)/offsets.h checkbin
arch/$(ARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
include/config/MARKER
include/asm-$(ARCH)/offsets.h.tmp: arch/$(ARCH)/kernel/asm-offsets.s
@$(generate-asm-offsets.h) < $< > $@
include/asm-$(ARCH)/offsets.h: include/asm-$(ARCH)/offsets.h.tmp
@echo -n ' Generating $@'
@$(update-if-changed)
ifdef CONFIG_6xx
# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later
......@@ -105,3 +115,8 @@ else
checkbin:
@true
endif
CLEAN_FILES += include/asm-$(ARCH)/offsets.h.tmp \
include/asm-$(ARCH)/offsets.h \
arch/$(ARCH)/kernel/asm-offsets.s \
arch/$(ARCH)/iSeries/ReleaseData.h
......@@ -89,23 +89,5 @@ obj-$(CONFIG_PPC_ISERIES) += iSeries_misc.o
include $(TOPDIR)/Rules.make
entry.o: entry.S asm-offsets.h
misc.o: misc.S asm-offsets.h
l2cr.o: l2cr.S asm-offsets.h
head.o: head.S asm-offsets.h
head_4xx.o: head_4xx.S asm-offsets.h
head_8xx.o: head_8xx.S asm-offsets.h
iSeries_head.o: iSeries_head.S asm-offsets.h
iSeries_misc.o: iSeries_misc.S asm-offsets.h
asm-offsets.h: mk_defs.c asm-offsets.head \
$(TOPDIR)/include/asm/mmu.h \
$(TOPDIR)/include/asm/processor.h \
$(TOPDIR)/include/asm/pgtable.h \
$(TOPDIR)/include/asm/ptrace.h
$(CC) $(CFLAGS) -S mk_defs.c
(cat asm-offsets.head; grep '^#define' mk_defs.s) >asm-offsets.h
rm mk_defs.s
find_name : find_name.c
$(HOSTCC) $(HOSTCFLAGS) -o find_name find_name.c
......@@ -8,7 +8,6 @@
* #defines from the assembly-language output.
*/
#include <stddef.h>
#include <linux/config.h>
#include <linux/signal.h>
#include <linux/sched.h>
......@@ -34,7 +33,9 @@
#endif /* CONFIG_PPC_ISERIES */
#define DEFINE(sym, val) \
asm volatile("\n#define\t" #sym "\t%0" : : "i" (val))
asm volatile("\n->" #sym " %0 " #val : : "i" (val))
#define BLANK() asm volatile("\n->" : : )
int
main(void)
......
/*
* WARNING! This file is automatically generated - DO NOT EDIT!
*/
......@@ -30,7 +30,7 @@
#include <asm/cputable.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
#ifdef CONFIG_PPC_ISERIES
#include "iSeries_asm.h"
#endif /* CONFIG_PPC_ISERIES */
......
......@@ -31,7 +31,7 @@
#include <asm/cache.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
#ifdef CONFIG_APUS
#include <asm/amigappc.h>
......
......@@ -40,7 +40,7 @@
#include <asm/cputable.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
/* As with the other PowerPC ports, it is expected that when code
* execution begins here, the following registers contain valid, yet
......
......@@ -30,7 +30,7 @@
#include <asm/cputable.h>
#include <asm/thread_info.h>
#include <asm/ppc_asm.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
.text
.globl _stext
......
......@@ -32,7 +32,7 @@
#include <asm/pgtable.h>
#include <asm/ppc_asm.h>
#include <asm/thread_info.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
#include "iSeries_asm.h"
......
......@@ -22,7 +22,7 @@
#include <asm/page.h>
#include <asm/cache.h>
#include <asm/ppc_asm.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
#include "iSeries_asm.h"
.text
......
......@@ -23,7 +23,7 @@
#include <asm/mmu.h>
#include <asm/ppc_asm.h>
#include <asm/thread_info.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
.text
......
......@@ -150,11 +150,11 @@ struct hw_interrupt_type open_pic_ipi = {
if (irq < open_pic_irq_offset || irq >= NumSources+open_pic_irq_offset \
|| ISR[irq - open_pic_irq_offset] == 0) { \
printk("open_pic.c:%d: illegal irq %d\n", __LINE__, irq); \
show_stack(NULL); }
dump_stack(); }
#define check_arg_cpu(cpu) \
if (cpu < 0 || cpu >= NumProcessors){ \
printk("open_pic.c:%d: illegal cpu %d\n", __LINE__, cpu); \
show_stack(NULL); }
dump_stack(); }
#else
#define check_arg_ipi(ipi) do {} while (0)
#define check_arg_timer(timer) do {} while (0)
......@@ -317,7 +317,7 @@ void __init openpic_init(int linux_irq_offset)
openpic_reset();
#endif
if (ppc_md.progress) ppc_md.progress("openpic enter", 0x122);
if (ppc_md.progress) ppc_md.progress("openpic: enter", 0x122);
t = openpic_read(&OpenPIC->Global.Feature_Reporting0);
switch (t & OPENPIC_FEATURE_VERSION_MASK) {
......@@ -351,7 +351,7 @@ void __init openpic_init(int linux_irq_offset)
open_pic_irq_offset = linux_irq_offset;
/* Initialize timer interrupts */
if ( ppc_md.progress ) ppc_md.progress("openpic timer",0x3ba);
if ( ppc_md.progress ) ppc_md.progress("openpic: timer",0x3ba);
for (i = 0; i < OPENPIC_NUM_TIMERS; i++) {
/* Disabled, Priority 0 */
openpic_inittimer(i, 0, OPENPIC_VEC_TIMER+i+linux_irq_offset);
......@@ -361,7 +361,7 @@ void __init openpic_init(int linux_irq_offset)
#ifdef CONFIG_SMP
/* Initialize IPI interrupts */
if ( ppc_md.progress ) ppc_md.progress("openpic ipi",0x3bb);
if ( ppc_md.progress ) ppc_md.progress("openpic: ipi",0x3bb);
for (i = 0; i < OPENPIC_NUM_IPI; i++) {
/* Disabled, Priority 10..13 */
openpic_initipi(i, 10+i, OPENPIC_VEC_IPI+i+linux_irq_offset);
......@@ -374,7 +374,7 @@ void __init openpic_init(int linux_irq_offset)
#endif
/* Initialize external interrupts */
if (ppc_md.progress) ppc_md.progress("openpic ext",0x3bc);
if (ppc_md.progress) ppc_md.progress("openpic: external",0x3bc);
openpic_set_priority(0xf);
......@@ -389,7 +389,7 @@ void __init openpic_init(int linux_irq_offset)
openpic_disable_irq(i+linux_irq_offset);
/*
* We find the vale from either the InitSenses table
* We find the value from either the InitSenses table
* or assume a negative polarity level interrupt.
*/
sense = (i < OpenPIC_NumInitSenses)? OpenPIC_InitSenses[i]: 1;
......@@ -410,7 +410,7 @@ void __init openpic_init(int linux_irq_offset)
irq_desc[i].handler = &open_pic;
/* Initialize the spurious interrupt */
if (ppc_md.progress) ppc_md.progress("openpic spurious",0x3bd);
if (ppc_md.progress) ppc_md.progress("openpic: spurious",0x3bd);
openpic_set_spurious(OPENPIC_VEC_SPURIOUS+linux_irq_offset);
/* Initialize the cascade */
......@@ -426,7 +426,7 @@ void __init openpic_init(int linux_irq_offset)
#endif
openpic_set_priority(0);
if (ppc_md.progress) ppc_md.progress("openpic exit",0x222);
if (ppc_md.progress) ppc_md.progress("openpic: exit",0x222);
}
#ifdef notused
......
......@@ -33,6 +33,7 @@
#include <linux/init.h>
#include <linux/prctl.h>
#include <linux/init_task.h>
#include <linux/module.h>
#include <asm/pgtable.h>
#include <asm/uaccess.h>
......@@ -69,6 +70,8 @@ struct task_struct init_task = INIT_TASK(init_task);
/* only used to get secondary processor up */
struct task_struct *current_set[NR_CPUS] = {&init_task, };
static void show_tsk_stack(struct task_struct *tsk, unsigned long sp);
#undef SHOW_TASK_SWITCHES
#undef CHECK_STACK
......@@ -264,15 +267,15 @@ void show_regs(struct pt_regs * regs)
printk("TASK = %p[%d] '%s' ",
current, current->pid, current->comm);
printk("Last syscall: %ld ", current->thread.last_syscall);
printk("\nlast math %p last altivec %p", last_task_used_math,
last_task_used_altivec);
#if defined(CONFIG_4xx) && defined(DCRN_PLB0_BEAR)
printk("\nPLB0: bear= 0x%8.8x acr= 0x%8.8x besr= 0x%8.8x\n",
mfdcr(DCRN_POB0_BEAR), mfdcr(DCRN_PLB0_ACR),
mfdcr(DCRN_PLB0_BEAR), mfdcr(DCRN_PLB0_ACR),
mfdcr(DCRN_PLB0_BESR));
#endif
#if defined(CONFIG_4xx) && defined(DCRN_POB0_BEAR)
printk("PLB0 to OPB: bear= 0x%8.8x besr0= 0x%8.8x besr1= 0x%8.8x\n",
mfdcr(DCRN_PLB0_BEAR), mfdcr(DCRN_POB0_BESR0),
mfdcr(DCRN_POB0_BEAR), mfdcr(DCRN_POB0_BESR0),
mfdcr(DCRN_POB0_BESR1));
#endif
......@@ -291,7 +294,7 @@ void show_regs(struct pt_regs * regs)
break;
}
printk("\n");
show_stack((unsigned long *)regs->gpr[1]);
show_tsk_stack(current, regs->gpr[1]);
}
void exit_thread(void)
......@@ -328,6 +331,8 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
unsigned long childframe;
p->user_tid = NULL;
CHECK_FULL_REGS(regs);
/* Copy registers */
sp -= sizeof(struct pt_regs);
......@@ -441,7 +446,10 @@ int sys_clone(int p1, int p2, int p3, int p4, int p5, int p6,
struct pt_regs *regs)
{
struct task_struct *p;
CHECK_FULL_REGS(regs);
if ((p1 & (CLONE_SETTID | CLONE_CLEARTID)) == 0)
p3 = 0;
p = do_fork(p1 & ~CLONE_IDLETASK, p2, regs, 0, (int *)p3);
return IS_ERR(p) ? PTR_ERR(p) : p->pid;
}
......@@ -489,50 +497,61 @@ int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
return error;
}
void
show_stack(unsigned long *sp)
void show_trace_task(struct task_struct *tsk)
{
int cnt = 0;
unsigned long i;
if (sp == NULL)
sp = (unsigned long *)_get_SP();
printk("Call backtrace: ");
for (;;) {
if (__get_user(sp, (unsigned long **)sp))
break;
if (sp == NULL)
break;
if (__get_user(i, &sp[1]))
break;
if (cnt++ % 7 == 0)
printk("\n");
printk("%08lX ", i);
if (cnt > 32)
break;
}
printk("\n");
show_tsk_stack(tsk, tsk->thread.ksp);
}
void show_trace_task(struct task_struct *tsk)
void dump_stack(void)
{
unsigned long stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
unsigned long sp, prev_sp;
show_tsk_stack(current, _get_SP());
}
static void show_tsk_stack(struct task_struct *tsk, unsigned long sp)
{
unsigned long stack_top, prev_sp, ret;
int count = 0;
unsigned long next_exc = 0;
struct pt_regs *regs;
extern char ret_from_except, ret_from_except_full, ret_from_syscall;
if (tsk == NULL)
return;
sp = (unsigned long) &tsk->thread.ksp;
do {
prev_sp = sp;
prev_sp = (unsigned long) (tsk->thread_info + 1);
stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
if (count == 0) {
printk("Call trace:");
#if CONFIG_KALLSYMS
printk("\n");
#endif
} else {
if (next_exc) {
ret = next_exc;
next_exc = 0;
} else
ret = *(unsigned long *)(sp + 4);
printk(" [%08lx] ", ret);
#if CONFIG_KALLSYMS
print_symbol("%s", ret);
printk("\n");
#endif
if (ret == (unsigned long) &ret_from_except
|| ret == (unsigned long) &ret_from_except_full
|| ret == (unsigned long) &ret_from_syscall) {
/* sp + 16 points to an exception frame */
regs = (struct pt_regs *) (sp + 16);
if (sp + 16 + sizeof(*regs) <= stack_top)
next_exc = regs->nip;
}
}
++count;
sp = *(unsigned long *)sp;
if (sp <= prev_sp || sp >= stack_top || (sp & 3) != 0)
break;
if (count > 0)
printk("[%08lx] ", *(unsigned long *)(sp + 4));
} while (++count < 16);
if (count > 1)
}
#if !CONFIG_KALLSYMS
if (count > 0)
printk("\n");
#endif
}
#if 0
......
......@@ -65,11 +65,11 @@ sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7,
sigset_t saveset;
mask &= _BLOCKABLE;
spin_lock_irq(&current->sigmask_lock);
spin_lock_irq(&current->sig->siglock);
saveset = current->blocked;
siginitset(&current->blocked, mask);
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
spin_unlock_irq(&current->sig->siglock);
regs->result = -EINTR;
regs->ccr |= 0x10000000;
......@@ -96,11 +96,11 @@ sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, int p3, int p4, int p6,
return -EFAULT;
sigdelsetmask(&newset, ~_BLOCKABLE);
spin_lock_irq(&current->sigmask_lock);
spin_lock_irq(&current->sig->siglock);
saveset = current->blocked;
current->blocked = newset;
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
spin_unlock_irq(&current->sig->siglock);
regs->result = -EINTR;
regs->ccr |= 0x10000000;
......@@ -157,7 +157,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
* When we have signals to deliver, we set up on the
* user stack, going down from the original stack pointer:
* a sigregs struct
* one or more sigcontext structs with
* a sigcontext struct
* a gap of __SIGNAL_FRAMESIZE bytes
*
* Each of these things must be a multiple of 16 bytes in size.
......@@ -196,7 +196,7 @@ int sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
struct pt_regs *regs)
{
struct rt_sigframe *rt_sf;
struct sigcontext_struct sigctx;
struct sigcontext sigctx;
struct sigregs *sr;
elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
sigset_t set;
......@@ -208,10 +208,10 @@ int sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
|| copy_from_user(&st, &rt_sf->uc.uc_stack, sizeof(st)))
goto badframe;
sigdelsetmask(&set, ~_BLOCKABLE);
spin_lock_irq(&current->sigmask_lock);
spin_lock_irq(&current->sig->siglock);
current->blocked = set;
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
spin_unlock_irq(&current->sig->siglock);
if (regs->msr & MSR_FP)
giveup_fpu(current);
......@@ -297,12 +297,12 @@ setup_rt_frame(struct pt_regs *regs, struct sigregs *frame,
int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
struct pt_regs *regs)
{
struct sigcontext_struct *sc, sigctx;
struct sigcontext *sc, sigctx;
struct sigregs *sr;
elf_gregset_t saved_regs; /* an array of ELF_NGREG unsigned longs */
sigset_t set;
sc = (struct sigcontext_struct *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
sc = (struct sigcontext *)(regs->gpr[1] + __SIGNAL_FRAMESIZE);
if (copy_from_user(&sigctx, sc, sizeof(sigctx)))
goto badframe;
......@@ -311,10 +311,10 @@ int sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
set.sig[1] = sigctx._unused[3];
#endif
sigdelsetmask(&set, ~_BLOCKABLE);
spin_lock_irq(&current->sigmask_lock);
spin_lock_irq(&current->sig->siglock);
current->blocked = set;
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
spin_unlock_irq(&current->sig->siglock);
if (regs->msr & MSR_FP )
giveup_fpu(current);
......@@ -344,7 +344,7 @@ static void
setup_frame(struct pt_regs *regs, struct sigregs *frame,
unsigned long newsp)
{
struct sigcontext_struct *sc = (struct sigcontext_struct *) newsp;
struct sigcontext *sc = (struct sigcontext *) newsp;
if (verify_area(VERIFY_WRITE, frame, sizeof(*frame)))
goto badframe;
......@@ -387,7 +387,7 @@ static void
handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
struct pt_regs * regs, unsigned long *newspp, unsigned long frame)
{
struct sigcontext_struct *sc;
struct sigcontext *sc;
struct rt_sigframe *rt_sf;
struct k_sigaction *ka = &current->sig->action[sig-1];
......@@ -428,7 +428,7 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
} else {
/* Put a sigcontext on the stack */
*newspp -= sizeof(*sc);
sc = (struct sigcontext_struct *) *newspp;
sc = (struct sigcontext *) *newspp;
if (verify_area(VERIFY_WRITE, sc, sizeof(*sc)))
goto badframe;
......@@ -446,11 +446,11 @@ handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
ka->sa.sa_handler = SIG_DFL;
if (!(ka->sa.sa_flags & SA_NODEFER)) {
spin_lock_irq(&current->sigmask_lock);
spin_lock_irq(&current->sig->siglock);
sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
sigaddset(&current->blocked,sig);
recalc_sigpending();
spin_unlock_irq(&current->sigmask_lock);
spin_unlock_irq(&current->sig->siglock);
}
return;
......
......@@ -30,7 +30,7 @@
#include <asm/cputable.h>
#include <asm/ppc_asm.h>
#include <asm/thread_info.h>
#include "asm-offsets.h"
#include <asm/offsets.h>
#ifdef CONFIG_SMP
.comm mmu_hash_lock,4
......@@ -144,9 +144,7 @@ retry:
#endif
/* Return from the exception */
lwz r4,_LINK(r11)
lwz r5,_CTR(r11)
mtlr r4
mtctr r5
lwz r0,GPR0(r11)
lwz r7,GPR7(r11)
......
......@@ -109,7 +109,7 @@ unsigned long __init mmu_mapin_ram(void)
break;
}
setbat(2, KERNELBASE, PPC_MEMSTART, bl, _PAGE_KERNEL);
setbat(2, KERNELBASE, PPC_MEMSTART, bl, _PAGE_RAM);
done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1;
if ((done < tot) && !bat_addrs[3].limit) {
/* use BAT3 to cover a bit more */
......@@ -117,8 +117,7 @@ unsigned long __init mmu_mapin_ram(void)
for (bl = 128<<10; bl < max_size; bl <<= 1)
if (bl * 2 > tot)
break;
setbat(3, KERNELBASE+done, PPC_MEMSTART+done, bl,
_PAGE_KERNEL);
setbat(3, KERNELBASE+done, PPC_MEMSTART+done, bl, _PAGE_RAM);
done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1;
}
......
#
# Makefile for the PowerPC 4xx linux kernel.
obj-$(CONFIG_ASH) += ash.o
obj-$(CONFIG_CEDAR) += cedar.o
obj-$(CONFIG_CPCI405) += cpci405.o
obj-$(CONFIG_EP405) += ep405.o
obj-$(CONFIG_OAK) += oak.o
obj-$(CONFIG_REDWOOD_4) += redwood.o
obj-$(CONFIG_REDWOOD_5) += redwood5.o
obj-$(CONFIG_WALNUT) += walnut.o
obj-$(CONFIG_NP405L) += ibmnp405l.o
obj-$(CONFIG_405GP) += ibm405gp.o
obj-$(CONFIG_REDWOOD_4) += ibmstb3.o
obj-$(CONFIG_REDWOOD_5) += ibmstb4.o
obj-$(CONFIG_NP405H) += ibmnp405h.o
include $(TOPDIR)/Rules.make
......@@ -14,13 +14,6 @@ CFLAGS_pmac_setup.o += -I$(TOPDIR)/arch/$(ARCH)/mm
export-objs := prep_setup.o
obj-$(CONFIG_CEDER) += ceder.o ibmnp405l.o
obj-$(CONFIG_CPCI405) += cpci405.o ibm405gp.o
obj-$(CONFIG_EP405) += ep405.o ibm405gp.o
obj-$(CONFIG_REDWOOD_4) += redwood.o ibmstb3.o
obj-$(CONFIG_REDWOOD_5) += redwood5.o ibmstb4.o
obj-$(CONFIG_WALNUT) += walnut.o ibm405gp.o
obj-$(CONFIG_ASH) += ash.o ibmnp405h.o
obj-$(CONFIG_APUS) += apus_setup.o
ifeq ($(CONFIG_APUS),y)
obj-$(CONFIG_PCI) += apus_pci.o
......
......@@ -147,6 +147,10 @@ SECTIONS
. = ALIGN(4096);
__openfirmware_end = .;
__start___kallsyms = .; /* All kernel symbols */
__kallsyms : { *(__kallsyms) }
__stop___kallsyms = .;
__bss_start = .;
.bss :
{
......@@ -155,6 +159,8 @@ SECTIONS
*(.bss)
*(COMMON)
}
__bss_stop = .;
_end = . ;
PROVIDE (end = .);
}
......@@ -82,7 +82,7 @@ typedef struct {
#define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
#if CONFIG_PREEMPT
# define in_atomic() (preempt_count() != kernel_locked())
# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
# define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
#else
# define in_atomic() (preempt_count() != 0)
......
......@@ -21,9 +21,9 @@ extern void pgd_free(pgd_t *pgd);
#define pgd_populate(mm, pmd, pte) BUG()
#define pmd_populate_kernel(mm, pmd, pte) \
(pmd_val(*(pmd)) = __pa(pte))
(pmd_val(*(pmd)) = __pa(pte) | _PMD_PRESENT)
#define pmd_populate(mm, pmd, pte) \
(pmd_val(*(pmd)) = (page_to_pfn(pte) << PAGE_SHIFT))
(pmd_val(*(pmd)) = (page_to_pfn(pte) << PAGE_SHIFT) | _PMD_PRESENT)
extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
extern struct page *pte_alloc_one(struct mm_struct *mm, unsigned long addr);
......
......@@ -145,8 +145,8 @@ extern unsigned long ioremap_bot, ioremap_base;
is cleared in the TLB miss handler before the TLB entry is loaded.
- All other bits of the PTE are loaded into TLBLO without
modification, leaving us only the bits 20, 21, 24, 25, 26, 30 for
software PTE bits. We actually use use bits 21, 24, 25, 26, and
30 respectively for the software bits: ACCESSED, DIRTY, RW, EXEC,
software PTE bits. We actually use use bits 21, 24, 25, and
30 respectively for the software bits: ACCESSED, DIRTY, RW, and
PRESENT.
*/
......@@ -162,6 +162,13 @@ extern unsigned long ioremap_bot, ioremap_base;
#define _PAGE_HWEXEC 0x200 /* hardware: EX permission */
#define _PAGE_ACCESSED 0x400 /* software: R: page referenced */
#define _PMD_PRESENT 0x400 /* PMD points to page of PTEs */
#define _PMD_BAD 0x802
#define _PMD_SIZE 0x0e0 /* size field, != 0 for large-page PMD entry */
#define _PMD_SIZE_4M 0x0c0
#define _PMD_SIZE_16M 0x0e0
#define PMD_PAGE_SIZE(pmdval) (1024 << (((pmdval) & _PMD_SIZE) >> 4))
#elif defined(CONFIG_8xx)
/* Definitions for 8xx embedded chips. */
#define _PAGE_PRESENT 0x0001 /* Page is valid */
......@@ -184,9 +191,21 @@ extern unsigned long ioremap_bot, ioremap_base;
#define _PAGE_HWWRITE 0x0100 /* h/w write enable: never set in Linux PTE */
#define _PAGE_USER 0x0800 /* One of the PP bits, the other is USER&~RW */
#define _PMD_PRESENT 0x0001
#define _PMD_BAD 0x0ff0
#define _PMD_PAGE_MASK 0x000c
#define _PMD_PAGE_8M 0x000c
/*
* The 8xx TLB miss handler allegedly sets _PAGE_ACCESSED in the PTE
* for an address even if _PAGE_PRESENT is not set, as a performance
* optimization. This is a bug if you ever want to use swap unless
* _PAGE_ACCESSED is 2, which it isn't, or unless you have 8xx-specific
* definitions for __swp_entry etc. below, which would be gross.
* -- paulus
*/
#define _PTE_NONE_MASK _PAGE_ACCESSED
#else /* CONFIG_6xx */
/* Definitions for 60x, 740/750, etc. */
#define _PAGE_PRESENT 0x001 /* software: pte contains a translation */
......@@ -200,21 +219,22 @@ extern unsigned long ioremap_bot, ioremap_base;
#define _PAGE_ACCESSED 0x100 /* R: page referenced */
#define _PAGE_EXEC 0x200 /* software: i-cache coherency required */
#define _PAGE_RW 0x400 /* software: user write access allowed */
#define _PTE_NONE_MASK _PAGE_HASHPTE
#define _PMD_PRESENT 0
#define _PMD_PRESENT_MASK (PAGE_MASK)
#define _PMD_BAD (~PAGE_MASK)
#endif
/* The non-standard PowerPC MMUs, which includes the 4xx and 8xx (and
* mabe 603e) have TLB miss handlers that unconditionally set the
* _PAGE_ACCESSED flag as a performance optimization. This causes
* problems for the page_none() macro, just like the HASHPTE flag does
* for the standard PowerPC MMUs. Depending upon the MMU configuration,
* either HASHPTE or ACCESSED will have to be masked to give us a
* proper pte_none() condition.
/*
* Some bits are only used on some cpu families...
*/
#ifndef _PAGE_HASHPTE
#define _PAGE_HASHPTE 0
#define _PTE_NONE_MASK _PAGE_ACCESSED
#else
#define _PTE_NONE_MASK _PAGE_HASHPTE
#endif
#ifndef _PTE_NONE_MASK
#define _PTE_NONE_MASK 0
#endif
#ifndef _PAGE_SHARED
#define _PAGE_SHARED 0
......@@ -228,6 +248,13 @@ extern unsigned long ioremap_bot, ioremap_base;
#ifndef _PAGE_EXEC
#define _PAGE_EXEC 0
#endif
#ifndef _PMD_PRESENT_MASK
#define _PMD_PRESENT_MASK _PMD_PRESENT
#endif
#ifndef _PMD_SIZE
#define _PMD_SIZE 0
#define PMD_PAGE_SIZE(pmd) bad_call_to_PMD_PAGE_SIZE()
#endif
#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
......@@ -237,27 +264,28 @@ extern unsigned long ioremap_bot, ioremap_base;
* to have it in the Linux PTE, and in fact the bit could be reused for
* another purpose. -- paulus.
*/
#define _PAGE_BASE _PAGE_PRESENT | _PAGE_ACCESSED
#define _PAGE_WRENABLE _PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE
#define _PAGE_KERNEL _PAGE_BASE | _PAGE_WRENABLE | _PAGE_SHARED | _PAGE_HWEXEC
#define _PAGE_IO _PAGE_KERNEL | _PAGE_NO_CACHE | _PAGE_GUARDED
#define _PAGE_BASE (_PAGE_PRESENT | _PAGE_ACCESSED)
#define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY | _PAGE_HWWRITE)
#define _PAGE_KERNEL (_PAGE_BASE | _PAGE_SHARED | _PAGE_WRENABLE)
#ifdef CONFIG_PPC_STD_MMU
/* On standard PPC MMU, no user access implies kernel read/write access,
* so to write-protect kernel memory we must turn on user access */
#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED | _PAGE_USER)
#else
#define _PAGE_KERNEL_RO (_PAGE_BASE | _PAGE_SHARED)
#endif
#define _PAGE_RAM _PAGE_KERNEL
#define _PAGE_IO (_PAGE_KERNEL | _PAGE_NO_CACHE | _PAGE_GUARDED)
#define _PAGE_RAM (_PAGE_KERNEL | _PAGE_HWEXEC)
#if defined(CONFIG_KGDB) || defined(CONFIG_XMON)
/* We want the debuggers to be able to set breakpoints anywhere, so
* don't write protect the kernel text */
#define _PAGE_RAM_TEXT _PAGE_RAM
#else
#ifdef CONFIG_PPC_STD_MMU
/* On standard PPC MMU, no user access implies kernel read/write
* access, so to write-protect the kernel text we must turn on user
* access */
#define _PAGE_RAM_TEXT (_PAGE_RAM & ~_PAGE_WRENABLE) | _PAGE_USER
#else
#define _PAGE_RAM_TEXT (_PAGE_RAM & ~_PAGE_WRENABLE)
#endif
#define _PAGE_RAM_TEXT (_PAGE_KERNEL_RO | _PAGE_HWEXEC)
#endif
#define PAGE_NONE __pgprot(_PAGE_BASE)
......@@ -268,9 +296,7 @@ extern unsigned long ioremap_bot, ioremap_base;
#define PAGE_COPY __pgprot(_PAGE_BASE | _PAGE_USER)
#define PAGE_COPY_X __pgprot(_PAGE_BASE | _PAGE_USER | _PAGE_EXEC)
#define PAGE_KERNEL __pgprot(_PAGE_KERNEL)
#define PAGE_KERNEL_RO __pgprot(_PAGE_BASE | _PAGE_SHARED)
#define PAGE_KERNEL_CI __pgprot(_PAGE_IO)
#define PAGE_KERNEL __pgprot(_PAGE_RAM)
/*
* The PowerPC can only do execute protection on a segment (256MB) basis,
......@@ -297,6 +323,10 @@ extern unsigned long ioremap_bot, ioremap_base;
#define __S111 PAGE_SHARED_X
#ifndef __ASSEMBLY__
/* Make sure we get a link error if PMD_PAGE_SIZE is ever called on a
* kernel without large page PMD support */
extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
/*
* Conversions between PTE values and page frame numbers.
*/
......@@ -321,8 +351,8 @@ extern unsigned long empty_zero_page[1024];
#define pte_clear(ptep) do { set_pte((ptep), __pte(0)); } while (0)
#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_bad(pmd) (0)
#define pmd_present(pmd) (pmd_val(pmd) != 0)
#define pmd_bad(pmd) (pmd_val(pmd) & _PMD_BAD)
#define pmd_present(pmd) (pmd_val(pmd) & _PMD_PRESENT_MASK)
#define pmd_clear(pmdp) do { pmd_val(*(pmdp)) = 0; } while (0)
#ifndef __ASSEMBLY__
......
......@@ -83,6 +83,7 @@ extern inline void down(struct semaphore * sem)
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
might_sleep();
/*
* Try to get the semaphore, take the slow path if we fail.
......@@ -99,6 +100,7 @@ extern inline int down_interruptible(struct semaphore * sem)
#if WAITQUEUE_DEBUG
CHECK_MAGIC(sem->__magic);
#endif
might_sleep();
if (atomic_dec_return(&sem->count) < 0)
ret = __down_interruptible(sem);
......
......@@ -4,7 +4,7 @@
#include <asm/ptrace.h>
struct sigcontext_struct {
struct sigcontext {
unsigned long _unused[4];
int signal;
unsigned long handler;
......
......@@ -7,7 +7,7 @@ struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
struct sigcontext_struct uc_mcontext;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask; /* mask last for extensibility */
};
......
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