From: Jan-Benedict G. <jb...@us...> - 2005-04-25 15:41:00
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/mm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31564 Modified Files: fault.c Log Message: - Whitespace only. - In page_fault_handler(), why isn't 'active' set to one? Index: fault.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/mm/fault.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- fault.c 10 Oct 2003 21:06:57 -0000 1.7 +++ fault.c 25 Apr 2005 15:40:32 -0000 1.8 @@ -2,9 +2,9 @@ * linux/arch/alpha/mm/fault.c * * Copyright (C) 1995 Linus Torvalds - * + * * Copyright (C) 2001 Kenn Humborg, Andy Phillips, David Airlie - * (Vax Porting team) + * (VAX Porting Team) */ #include <linux/sched.h> @@ -31,8 +31,8 @@ /* - * This routine handles page faults and access violations. It - * determines the address, and the problem, and then passes + * This routine handles page faults and access violations. It + * determines the address, and the problem, and then passes * it off to handle_mm_fault(). * * reason: @@ -47,10 +47,10 @@ #define REASON_PPTEREF (1<<1) #define REASON_WRITE (1<<2) -#undef VAX_MM_DEBUG +#undef VAX_MM_DEBUG #define VAX_MM_DEBUG_USER_FAULTS -static void +static void do_page_fault(struct accvio_info *info, struct pt_regs *regs) { unsigned long address = info->addr; @@ -60,28 +60,33 @@ struct mm_struct *mm = NULL; const struct exception_table_entry *fixup; -#ifdef VAX_MM_DEBUG - printk("mmfault: pid %d fault at %8x, pc %8x, psl %8x, reason %8x\n",current->pid,info->addr, info->pc, info->psl, info->reason); - printk("mmfault:p0br %8lx, p0lr %8lx, p1br %8lx, p1lr %8lx\n",Xmfpr(PR_P0BR),Xmfpr(PR_P0LR),Xmfpr(PR_P1BR),Xmfpr(PR_P1LR)); -#endif - /* This check, and the mm != NULL checks later, will be removed - later, once we actually have a 'current' properly defined */ - if (tsk != NULL) { +#ifdef VAX_MM_DEBUG + printk("mmfault: pid %d fault at %8x, pc %8x, psl %8x, reason %8x\n", + current->pid, info->addr, info->pc, info->psl, info->reason); + printk("mmfault:p0br %8lx, p0lr %8lx, p1br %8lx, p1lr %8lx\n", + Xmfpr(PR_P0BR), Xmfpr(PR_P0LR), Xmfpr(PR_P1BR), Xmfpr(PR_P1LR)); +#endif + /* + * This check, and the mm != NULL checks later, will be removed + * later, once we actually have a 'current' properly defined. + */ + if (tsk != NULL) mm = tsk->mm; - } - /* If we're in an interrupt context, or have no user context, - we must not take the fault. */ + /* + * If we're in an interrupt context, or have no user context, + * we must not take the fault. + */ if (in_interrupt() || !mm) goto no_context; - + down_read (&mm->mmap_sem); vma = find_vma(mm, address); - + if (!vma) goto bad_area; - + if (vma->vm_start <= address) goto good_area; @@ -90,11 +95,11 @@ if (expand_stack(vma, address)) goto bad_area; - -/* - * Ok, we have a good vm_area for this memory access, so - * we can handle it.. - */ + + /* + * Ok, we have a good vm_area for this memory access, so + * we can handle it.. + */ good_area: if (reason & REASON_WRITE) { @@ -120,75 +125,68 @@ default: BUG(); } - + up_read(&mm->mmap_sem); return; -/* - * Something tried to access memory that isn't in our memory map.. - * Fix it, but check if it's kernel or user first.. - */ + /* + * Something tried to access memory that isn't in our memory map.. + * Fix it, but check if it's kernel or user first.. + */ bad_area: - up_read(&mm->mmap_sem); if (user_mode(regs)) { -#ifdef VAX_MM_DEBUG_USER_FAULTS - printk(KERN_ALERT "Unable to do USER paging request: " - "pid %d, virtual address %08lx, reason mask %08x, " - "PC %08x, PSL %08x\n", - current->pid, address, reason, info->pc, info->psl); - - show_regs(regs); - show_cpu_regs(); - printk("\nStack dump\n"); - hex_dump( (void *)(regs->fp&~0xf), 512); - - printk("do_page_fault: sending SIGSEGV\n"); -#endif +#ifdef VAX_MM_DEBUG_USER_FAULTS + printk(KERN_ALERT "Unable to do USER paging request: " + "pid %d, virtual address %08lx, " + "reason mask %08x, PC %08x, PSL %08x\n", + current->pid, address, reason, info->pc, + info->psl); + show_regs(regs); + show_cpu_regs(); + printk("\nStack dump\n"); + hex_dump((void *) (regs->fp & ~0xf), 512); + printk(KERN_ALERT "do_page_fault: sending SIGSEGV\n"); +#endif force_sig(SIGSEGV, current); return; } no_context: - - /* Are we prepared to handle this fault as an exception? */ + /* Are we prepared to handle this fault as an exception? */ if ((fixup = search_exception_tables(regs->pc)) != NULL) { regs->pc = fixup->fixup; return; } -/* - * Oops. The kernel tried to access some bad page. We'll have to - * terminate things with extreme prejudice. - */ - + /* + * Oops. The kernel tried to access some bad page. We'll have to + * terminate things with extreme prejudice. + */ printk(KERN_ALERT "Unable to handle kernel paging request at " - "virtual address %08lx, reason mask %08x, " - "PC %08x, PSL %08x\n", - address, reason, info->pc, info->psl); - printk("\nStack dump\n"); - hex_dump((void *)(regs->sp), 256); + "virtual address %08lx, reason mask %08x, " + "PC %08x, PSL %08x\n", + address, reason, info->pc, info->psl); + printk("\nStack dump\n"); + hex_dump((void *) regs->sp, 256); show_stack(current, NULL); - show_regs(regs); - show_cpu_regs(); + show_regs(regs); + show_cpu_regs(); machine_halt(); - -/* - * We ran out of memory, or some other thing happened to us that made - * us unable to handle the page fault gracefully. - */ + /* + * We ran out of memory, or some other thing happened to us that made + * us unable to handle the page fault gracefully. + */ out_of_memory: - if (current->pid == 1) - { + if (current->pid == 1) { yield(); goto survive; } up_read(&mm->mmap_sem); - if (user_mode(regs)) - { + if (user_mode(regs)) { printk("VM: killing process %s\n", current->comm); do_exit(SIGKILL); } @@ -206,32 +204,32 @@ /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) goto no_context; - } -/* This is the access violation handler */ - +/* + * This is the access violation handler. + */ void accvio_handler(struct pt_regs *regs, void *excep_info) { - struct accvio_info *info = (struct accvio_info *)excep_info; + struct accvio_info *info = (struct accvio_info *) excep_info; static int active; - /* This active flag is just a temporary hack to help catch - accvios in the page fault handler. It will have to - go eventually as it's not SMP safe */ + /* + * This active flag is just a temporary hack to help catch + * accvios in the page fault handler. It will have to + * go eventually as it's not SMP safe. + */ if (!active) { active = 1; do_page_fault(info, regs); active = 0; - } else { - printk("\nNested access violation: reason mask %02x, " "addr %08x, PC %08x, PSL %08x\n", info->reason, info->addr, info->pc, info->psl); printk("\nStack dump\n"); - hex_dump((void *)(regs->sp), 256); + hex_dump((void *) regs->sp, 256); show_stack(current, NULL); show_regs(regs); show_cpu_regs(); @@ -240,33 +238,34 @@ } } -/* This is the page fault handler */ - +/* + * This is the page fault handler. + */ void page_fault_handler(struct pt_regs *regs, void *excep_info) { struct accvio_info *info = (struct accvio_info *)excep_info; static int active; - - /* This active flag is just a temporary hack to help catch - accvios in the page fault handler. It will have to - go eventually as it's not SMP safe */ + /* + * This active flag is just a temporary hack to help catch + * accvios in the page fault handler. It will have to + * go eventually as it's not SMP safe. + */ if (!active) { + /* FIXME: Why is this commented out? */ /* active = 1;*/ do_page_fault(info, regs); -#ifdef VAX_MM_DEBUG +#ifdef VAX_MM_DEBUG printk("finished fault\n"); -#endif +#endif active = 0; - } else { - printk("\nNested page fault: reason mask %02x, " "addr %08x, PC %08x, PSL %08x\n", info->reason, info->addr, info->pc, info->psl); printk("\nStack dump\n"); - hex_dump((void *)(regs->sp), 256); + hex_dump((void *) regs->sp, 256); show_stack(current, NULL); show_regs(regs); show_cpu_regs(); @@ -274,3 +273,4 @@ machine_halt(); } } + |