exception_vector.S revision 1.2
11.2Such/* $NetBSD: exception_vector.S,v 1.2 2002/02/28 01:53: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.2Such#include <sh3/trapreg.h> 411.2Such#include <sh3/ubcreg.h> 421.1Such 431.1Such/* 441.1Such * Exception vectors. following routines are copied to vector addreses. 451.1Such * sh_vector_generic: VBR + 0x100 461.1Such * sh_vector_tlbmiss: VBR + 0x400 471.1Such * sh_vector_interrupt: VBR + 0x600 481.1Such */ 491.1Such 501.1Such/* 511.1Such * void sh_vector_generic(void) __attribute__((__noreturn__)): 521.1Such * copied to VBR+0x100. This code should be relocatable and max 384 531.1Such * instructions. 541.1Such * 0x40 TLB miss (load) 551.1Such * 0x60 TLB miss (store) 561.1Such * 0xc0 TLB protection (store) 571.1Such * -> tlbmiss_exp() 581.1Such * 0xa0 TLB protection (load) 591.1Such * 0x80 Initial page write. 601.1Such * and other... 611.1Such * -> trap() 621.1Such */ 631.1Such .globl _C_LABEL(sh_vector_generic), _C_LABEL(sh_vector_generic_end) 641.1Such .align 2 651.1Such_C_LABEL(sh_vector_generic): 661.1Such EXCEPTION_ENTRY 671.1Such /* Identify exception cause */ 681.1Such MOV (EXPEVT, r0) 691.1Such mov.l @r0, r0 701.1Such /* 711.1Such * TLB exception. 721.1Such */ 731.1Such cmp/eq #0x40, r0 /* T_TLBINVALIDR */ 741.1Such bf 1f 751.1Such3: 761.2Such __INTR_MASK(r0, r1) 771.2Such __EXCEPTION_UNBLOCK(r0, r1) 781.1Such mov.l _L.tlb_handler, r0 791.1Such jsr @r0 801.1Such nop 811.1Such bra 4f 821.1Such nop 831.1Such1: 841.1Such cmp/eq #0x60, r0 /* T_TLBINVALIDW */ 851.1Such bt 3b 861.1Such 871.1Such mov.l _L.TLBPROTWR, r1 /* T_TLBPRIVW */ 881.1Such cmp/eq r0, r1 891.1Such bt 3b 901.1Such 911.1Such /* 921.1Such * General exception. 931.1Such */ 941.1Such#ifdef DDB 951.1Such mov #0, r2 961.1Such MOV (BBRA, r1) 971.1Such mov.w r2, @r1 /* disable UBC */ 981.1Such mov.l r2, @(TF_UBC, r15) /* clear trapframe->tf_ubc */ 991.1Such#endif /* DDB */ 1001.1Such 1011.1Such mov.l r0, @(TF_TRAPNO, r15) /* trapframe->tf_trapno = EXPEVT */ 1021.2Such __INTR_UNMASK(r0, r1) 1031.2Such __EXCEPTION_UNBLOCK(r0, r1) 1041.1Such mov.l _L.trap, r0 1051.1Such jsr @r0 1061.1Such mov r15, r4 1071.1Such 1081.1Such /* Check for ASTs on exit to user mode. */ 1091.1Such mov.l _L.ast, r0 1101.1Such jsr @r0 1111.1Such mov r15, r4 1121.1Such 1131.1Such#ifdef DDB /* BBRA = trapframe->tf_ubc */ 1141.2Such __EXCEPTION_BLOCK(r0, r1) 1151.1Such mov.l @(TF_UBC, r15), r0 1161.1Such MOV (BBRA, r1) 1171.1Such mov.w r0, @r1 1181.1Such#endif /* DDB */ 1191.1Such4: 1201.1Such EXCEPTION_RETURN 1211.1Such /* NOTREACHED */ 1221.1Such .align 2 1231.1SuchREG_SYMBOL(EXPEVT) 1241.1SuchREG_SYMBOL(BBRA) 1251.1Such_L.TLBPROTWR: .long 0x000000c0 1261.1Such_L.trap: .long _C_LABEL(trap) 1271.1Such_L.ast: .long _C_LABEL(ast) 1281.1Such_L.tlb_handler: .long _C_LABEL(tlb_handler) 1291.1Such_C_LABEL(sh_vector_generic_end): 1301.1Such 1311.1Such/* 1321.1Such * void sh_vector_tlbmiss(void) __attribute__((__noreturn__)): 1331.1Such * copied to VBR+0x400. This code should be relocatable and max 256 1341.1Such * instructions. 1351.1Such */ 1361.1Such .globl _C_LABEL(sh_vector_tlbmiss), _C_LABEL(sh_vector_tlbmiss_end) 1371.1Such .align 2 1381.1Such_C_LABEL(sh_vector_tlbmiss): 1391.1Such EXCEPTION_ENTRY 1401.2Such __INTR_MASK(r0, r1) 1411.2Such __EXCEPTION_UNBLOCK(r0, r1) 1421.1Such mov.l 1f, r0 1431.1Such jsr @r0 1441.1Such nop 1451.1Such EXCEPTION_RETURN 1461.1Such .align 2 1471.1Such1: .long _C_LABEL(tlb_handler) 1481.1Such_C_LABEL(sh_vector_tlbmiss_end): 1491.1Such 1501.1Such 1511.1Such/* 1521.1Such * void sh_vector_interrupt(void) __attribute__((__noreturn__)): 1531.1Such * copied to VBR+0x600. This code should be relocatable. 1541.1Such */ 1551.1Such .globl _C_LABEL(sh_vector_interrupt), _C_LABEL(sh_vector_interrupt_end) 1561.1Such .align 2 1571.1Such_C_LABEL(sh_vector_interrupt): 1581.1Such EXCEPTION_ENTRY 1591.1Such mov.l 1f, r0 1601.1Such jmp @r0 1611.1Such nop 1621.1Such .align 2 1631.1Such1: .long _C_LABEL(interrupt_exp) 1641.1Such_C_LABEL(sh_vector_interrupt_end): 1651.1Such 166