exception_vector.S revision 1.1
11.1Such/* $NetBSD: exception_vector.S,v 1.1 2002/02/24 18:19:43 uch Exp $ */ 21.1Such 31.1Such/*- 41.1Such * Copyright (c) 2002 The NetBSD Foundation, Inc. 51.1Such * All rights reserved. 61.1Such * 71.1Such * Redistribution and use in source and binary forms, with or without 81.1Such * modification, are permitted provided that the following conditions 91.1Such * are met: 101.1Such * 1. Redistributions of source code must retain the above copyright 111.1Such * notice, this list of conditions and the following disclaimer. 121.1Such * 2. Redistributions in binary form must reproduce the above copyright 131.1Such * notice, this list of conditions and the following disclaimer in the 141.1Such * documentation and/or other materials provided with the distribution. 151.1Such * 3. All advertising materials mentioning features or use of this software 161.1Such * must display the following acknowledgement: 171.1Such * This product includes software developed by the NetBSD 181.1Such * Foundation, Inc. and its contributors. 191.1Such * 4. Neither the name of The NetBSD Foundation nor the names of its 201.1Such * contributors may be used to endorse or promote products derived 211.1Such * from this software without specific prior written permission. 221.1Such * 231.1Such * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 241.1Such * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 251.1Such * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 261.1Such * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 271.1Such * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 281.1Such * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 291.1Such * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 301.1Such * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 311.1Such * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 321.1Such * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 331.1Such * POSSIBILITY OF SUCH DAMAGE. 341.1Such */ 351.1Such 361.1Such#include "assym.h" 371.1Such 381.1Such#include <sh3/asm.h> 391.1Such#include <sh3/locore.h> 401.1Such 411.1Such/* 421.1Such * Exception vectors. following routines are copied to vector addreses. 431.1Such * sh_vector_generic: VBR + 0x100 441.1Such * sh_vector_tlbmiss: VBR + 0x400 451.1Such * sh_vector_interrupt: VBR + 0x600 461.1Such */ 471.1Such 481.1Such/* 491.1Such * void sh_vector_generic(void) __attribute__((__noreturn__)): 501.1Such * copied to VBR+0x100. This code should be relocatable and max 384 511.1Such * instructions. 521.1Such * 0x40 TLB miss (load) 531.1Such * 0x60 TLB miss (store) 541.1Such * 0xc0 TLB protection (store) 551.1Such * -> tlbmiss_exp() 561.1Such * 0xa0 TLB protection (load) 571.1Such * 0x80 Initial page write. 581.1Such * and other... 591.1Such * -> trap() 601.1Such */ 611.1Such .globl _C_LABEL(sh_vector_generic), _C_LABEL(sh_vector_generic_end) 621.1Such .align 2 631.1Such_C_LABEL(sh_vector_generic): 641.1Such EXCEPTION_ENTRY 651.1Such /* Identify exception cause */ 661.1Such MOV (EXPEVT, r0) 671.1Such mov.l @r0, r0 681.1Such /* 691.1Such * TLB exception. 701.1Such */ 711.1Such cmp/eq #0x40, r0 /* T_TLBINVALIDR */ 721.1Such bf 1f 731.1Such3: 741.1Such __INTR_MASK_r0_r1 751.1Such __EXCEPTION_UNBLOCK_r0_r1 761.1Such mov.l _L.tlb_handler, r0 771.1Such jsr @r0 781.1Such nop 791.1Such bra 4f 801.1Such nop 811.1Such1: 821.1Such cmp/eq #0x60, r0 /* T_TLBINVALIDW */ 831.1Such bt 3b 841.1Such 851.1Such mov.l _L.TLBPROTWR, r1 /* T_TLBPRIVW */ 861.1Such cmp/eq r0, r1 871.1Such bt 3b 881.1Such 891.1Such /* 901.1Such * General exception. 911.1Such */ 921.1Such#ifdef DDB 931.1Such mov #0, r2 941.1Such MOV (BBRA, r1) 951.1Such mov.w r2, @r1 /* disable UBC */ 961.1Such mov.l r2, @(TF_UBC, r15) /* clear trapframe->tf_ubc */ 971.1Such#endif /* DDB */ 981.1Such 991.1Such mov.l r0, @(TF_TRAPNO, r15) /* trapframe->tf_trapno = EXPEVT */ 1001.1Such __INTR_UNMASK_r0_r1 1011.1Such __EXCEPTION_UNBLOCK_r0_r1 1021.1Such mov.l _L.trap, r0 1031.1Such jsr @r0 1041.1Such mov r15, r4 1051.1Such 1061.1Such /* Check for ASTs on exit to user mode. */ 1071.1Such mov.l _L.ast, r0 1081.1Such jsr @r0 1091.1Such mov r15, r4 1101.1Such 1111.1Such#ifdef DDB /* BBRA = trapframe->tf_ubc */ 1121.1Such __EXCEPTION_BLOCK_r0_r1 1131.1Such mov.l @(TF_UBC, r15), r0 1141.1Such MOV (BBRA, r1) 1151.1Such mov.w r0, @r1 1161.1Such#endif /* DDB */ 1171.1Such4: 1181.1Such EXCEPTION_RETURN 1191.1Such /* NOTREACHED */ 1201.1Such .align 2 1211.1SuchREG_SYMBOL(EXPEVT) 1221.1SuchREG_SYMBOL(BBRA) 1231.1Such_L.TLBPROTWR: .long 0x000000c0 1241.1Such_L.trap: .long _C_LABEL(trap) 1251.1Such_L.ast: .long _C_LABEL(ast) 1261.1Such_L.tlb_handler: .long _C_LABEL(tlb_handler) 1271.1Such_C_LABEL(sh_vector_generic_end): 1281.1Such 1291.1Such/* 1301.1Such * void sh_vector_tlbmiss(void) __attribute__((__noreturn__)): 1311.1Such * copied to VBR+0x400. This code should be relocatable and max 256 1321.1Such * instructions. 1331.1Such */ 1341.1Such .globl _C_LABEL(sh_vector_tlbmiss), _C_LABEL(sh_vector_tlbmiss_end) 1351.1Such .align 2 1361.1Such_C_LABEL(sh_vector_tlbmiss): 1371.1Such EXCEPTION_ENTRY 1381.1Such __INTR_MASK_r0_r1 1391.1Such __EXCEPTION_UNBLOCK_r0_r1 1401.1Such mov.l 1f, r0 1411.1Such jsr @r0 1421.1Such nop 1431.1Such EXCEPTION_RETURN 1441.1Such .align 2 1451.1Such1: .long _C_LABEL(tlb_handler) 1461.1Such_C_LABEL(sh_vector_tlbmiss_end): 1471.1Such 1481.1Such 1491.1Such/* 1501.1Such * void sh_vector_interrupt(void) __attribute__((__noreturn__)): 1511.1Such * copied to VBR+0x600. This code should be relocatable. 1521.1Such */ 1531.1Such .globl _C_LABEL(sh_vector_interrupt), _C_LABEL(sh_vector_interrupt_end) 1541.1Such .align 2 1551.1Such_C_LABEL(sh_vector_interrupt): 1561.1Such EXCEPTION_ENTRY 1571.1Such mov.l 1f, r0 1581.1Such jmp @r0 1591.1Such nop 1601.1Such .align 2 1611.1Such1: .long _C_LABEL(interrupt_exp) 1621.1Such_C_LABEL(sh_vector_interrupt_end): 1631.1Such 164