1/* $NetBSD: m68k_intr_stubs.s,v 1.5 2024/01/20 00:19:12 thorpej Exp $ */ 2 3/* 4 * Copyright (c) 1980, 1990, 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the Systems Programming Group of the University of Utah Computer 9 * Science Department. 10 * 11 * Redistribution and use in source and binary forms, with or without 12 * modification, are permitted provided that the following conditions 13 * are met: 14 * 1. Redistributions of source code must retain the above copyright 15 * notice, this list of conditions and the following disclaimer. 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in the 18 * documentation and/or other materials provided with the distribution. 19 * 3. Neither the name of the University nor the names of its contributors 20 * may be used to endorse or promote products derived from this software 21 * without specific prior written permission. 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * from: Utah $Hdr: locore.s 1.66 92/12/22$ 36 * @(#)locore.s 8.6 (Berkeley) 5/27/94 37 */ 38 39#include <machine/asm.h> 40 41#include "assym.h" 42 43 .file "m68k_intr_stubs.s" 44 .text 45 46#ifdef __ELF__ 47#define INTRSTUB_ALIGN .align 4 48#else 49#define INTRSTUB_ALIGN .align 2 50#endif 51 52/* 53 * If a platform supports hardware-assisted ASTs, we don't branch to 54 * rei() after the interrupt. Instead, we simply do an rte. Such 55 * platforms will have their own vector stub for dealing with ASTs, 56 * which will in turn call rei(). 57 */ 58#ifdef __HAVE_M68K_HW_AST 59#define INTERRUPT_RETURN rte 60#else 61#define INTERRUPT_RETURN jra _ASM_LABEL(rei) 62#endif /* __HAVE_M68K_HW_AST */ 63 64/* 65 * Vector stub for auto-vectored interrupts. Calls the dispatch 66 * routine with the frame BY VALUE (saves a few instructions). 67 */ 68 INTRSTUB_ALIGN 69ENTRY_NOPROFILE(intrstub_autovec) 70 addql #1,_C_LABEL(intr_depth) 71 INTERRUPT_SAVEREG 72 jbsr _C_LABEL(m68k_intr_autovec) 73 INTERRUPT_RESTOREREG 74 subql #1,_C_LABEL(intr_depth) 75 INTERRUPT_RETURN 76 77#ifdef __HAVE_M68K_INTR_VECTORED 78/* 79 * Vector stub for vectored interrupts. Same stack situation as above. 80 */ 81 INTRSTUB_ALIGN 82ENTRY_NOPROFILE(intrstub_vectored) 83 addql #1,_C_LABEL(intr_depth) 84 INTERRUPT_SAVEREG 85 jbsr _C_LABEL(m68k_intr_vectored) 86 INTERRUPT_RESTOREREG 87 subql #1,_C_LABEL(intr_depth) 88 INTERRUPT_RETURN 89#endif /* __HAVE_M68K_INTR_VECTORED */ 90