From: Kenn H. <ke...@us...> - 2002-12-28 02:13:12
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel In directory sc8-pr-cvs1:/tmp/cvs-serv18917/kernel Modified Files: interrupt.c Log Message: guard_int_stack() cleaned up to use new PFN-based arch MM APIs Index: interrupt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/kernel/interrupt.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- interrupt.c 12 Dec 2002 01:19:20 -0000 1.8 +++ interrupt.c 28 Dec 2002 02:13:08 -0000 1.9 @@ -58,36 +58,29 @@ void guard_int_stack(void) { - pte_t p, *q; - unsigned char *t, *s; - t = (unsigned char *)&interrupt_stack[0]; - s = (unsigned char *)SPT_BASE; - /* Do we need more than a page for the int stack? */ + void *stack_base; + unsigned long base_pfn; + pte_t *base_pte_addr; + + /* Do we need more than a page for the int stack? + Yes, if we want a guard page. */ if (INT_STACK_SIZE <= PAGE_SIZE) { printk("Interrupt stack too small, must be > PAGE_SIZE\n"); machine_halt(); } - /* FIXME: kenn - does this want to be a 4k page or a hardware page ? */ - /* see include/asm/mm/pgtable.h */ -/* q = (((unsigned long) &interrupt_stack[smp_processor_id()])-PAGE_OFFSET)>>PAGELET_SHIFT;*/ - q = (pte_t *)GET_HWSPTE_VIRT(&interrupt_stack[smp_processor_id()]); + stack_base = interrupt_stack + smp_processor_id(); + base_pfn = MAP_NR(stack_base); + + base_pte_addr = GET_SPTE_VIRT(stack_base); /* Set first page of interrupt stack area to kernel read, thus trapping any writes to this page. This will catch attempts - to expand the interrupt stack before they can do any damage. */ + to overflow the interrupt stack before they can do any damage. */ - /* if this is a 4k page - need to use set_pte here */ - p = __mk_pte((unsigned long int)&interrupt_stack[smp_processor_id()],__pgprot(_PAGE_KR|_PAGE_VALID)); + set_pte(base_pte_addr, pfn_pte(base_pfn, __pgprot(_PAGE_KR|_PAGE_VALID))); -/* debug hwpte calculations FIXME: remove */ -/* asm("movl %0, r2\n" - "movl %1 ,r3\n" - "movl %2 ,r4\n" - "halt" : : "g"(q), "g"(t), "g"(s) );*/ - set_pte(q, p); - - __flush_tlb_one(interrupt_stack[smp_processor_id()]); + __flush_tlb_one(stack_base); } static void setup_scb(void) |