From owner-svn-src-head@FreeBSD.ORG Thu Mar 5 05:53:10 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0742D1E0; Thu, 5 Mar 2015 05:53:10 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E5B00F71; Thu, 5 Mar 2015 05:53:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t255r987037293; Thu, 5 Mar 2015 05:53:09 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t255r8RV037291; Thu, 5 Mar 2015 05:53:08 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201503050553.t255r8RV037291@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Thu, 5 Mar 2015 05:53:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279623 - head/sys/powerpc/booke X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Mar 2015 05:53:10 -0000 Author: nwhitehorn Date: Thu Mar 5 05:53:08 2015 New Revision: 279623 URL: https://svnweb.freebsd.org/changeset/base/279623 Log: Move IVOR setup from assembler to C, decreasing required assumptions about address formats for trap handlers. Modified: head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/machdep.c Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Thu Mar 5 03:11:47 2015 (r279622) +++ head/sys/powerpc/booke/locore.S Thu Mar 5 05:53:08 2015 (r279623) @@ -536,42 +536,6 @@ __boot_page_padding: /* locore subroutines */ /************************************************************************/ -ivor_setup: - /* Set base address of interrupt handler routines */ - lis %r3, interrupt_vector_base@h - mtspr SPR_IVPR, %r3 - - /* Assign interrupt handler routines offsets */ - li %r3, int_critical_input@l - mtspr SPR_IVOR0, %r3 - li %r3, int_machine_check@l - mtspr SPR_IVOR1, %r3 - li %r3, int_data_storage@l - mtspr SPR_IVOR2, %r3 - li %r3, int_instr_storage@l - mtspr SPR_IVOR3, %r3 - li %r3, int_external_input@l - mtspr SPR_IVOR4, %r3 - li %r3, int_alignment@l - mtspr SPR_IVOR5, %r3 - li %r3, int_program@l - mtspr SPR_IVOR6, %r3 - li %r3, int_syscall@l - mtspr SPR_IVOR8, %r3 - li %r3, int_decrementer@l - mtspr SPR_IVOR10, %r3 - li %r3, int_fixed_interval_timer@l - mtspr SPR_IVOR11, %r3 - li %r3, int_watchdog@l - mtspr SPR_IVOR12, %r3 - li %r3, int_data_tlb_error@l - mtspr SPR_IVOR13, %r3 - li %r3, int_inst_tlb_error@l - mtspr SPR_IVOR14, %r3 - li %r3, int_debug@l - mtspr SPR_IVOR15, %r3 - blr - /* * void tid_flush(tlbtid_t tid); * Modified: head/sys/powerpc/booke/machdep.c ============================================================================== --- head/sys/powerpc/booke/machdep.c Thu Mar 5 03:11:47 2015 (r279622) +++ head/sys/powerpc/booke/machdep.c Thu Mar 5 05:53:08 2015 (r279623) @@ -187,6 +187,51 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, void print_kernel_section_addr(void); void print_kenv(void); u_int booke_init(uint32_t, uint32_t); +void ivor_setup(void); + +extern void *interrupt_vector_base; +extern void *int_critical_input; +extern void *int_machine_check; +extern void *int_data_storage; +extern void *int_instr_storage; +extern void *int_external_input; +extern void *int_alignment; +extern void *int_program; +extern void *int_syscall; +extern void *int_decrementer; +extern void *int_fixed_interval_timer; +extern void *int_watchdog; +extern void *int_data_tlb_error; +extern void *int_inst_tlb_error; +extern void *int_debug; + +#define SET_TRAP(ivor, handler) \ + KASSERT(((uintptr_t)(&handler) & ~0xffffUL) == \ + ((uintptr_t)(&interrupt_vector_base) & ~0xffffUL), \ + ("Handler " #handler " too far from interrupt vector base")); \ + mtspr(ivor, (uintptr_t)(&handler) & 0xffffUL); + +void +ivor_setup(void) +{ + + mtspr(SPR_IVPR, ((uintptr_t)&interrupt_vector_base) & 0xffff0000); + + SET_TRAP(SPR_IVOR0, int_critical_input); + SET_TRAP(SPR_IVOR1, int_machine_check); + SET_TRAP(SPR_IVOR2, int_data_storage); + SET_TRAP(SPR_IVOR3, int_instr_storage); + SET_TRAP(SPR_IVOR4, int_external_input); + SET_TRAP(SPR_IVOR5, int_alignment); + SET_TRAP(SPR_IVOR6, int_program); + SET_TRAP(SPR_IVOR8, int_syscall); + SET_TRAP(SPR_IVOR10, int_decrementer); + SET_TRAP(SPR_IVOR11, int_fixed_interval_timer); + SET_TRAP(SPR_IVOR12, int_watchdog); + SET_TRAP(SPR_IVOR13, int_data_tlb_error); + SET_TRAP(SPR_IVOR14, int_inst_tlb_error); + SET_TRAP(SPR_IVOR15, int_debug); +} static void cpu_booke_startup(void *dummy)