1121985Sjhb/*-
2121985Sjhb * Copyright (c) 1989, 1990 William F. Jolitz.
3121985Sjhb * Copyright (c) 1990 The Regents of the University of California.
4121985Sjhb * All rights reserved.
5121985Sjhb *
6121985Sjhb * Redistribution and use in source and binary forms, with or without
7121985Sjhb * modification, are permitted provided that the following conditions
8121985Sjhb * are met:
9121985Sjhb * 1. Redistributions of source code must retain the above copyright
10121985Sjhb *    notice, this list of conditions and the following disclaimer.
11121985Sjhb * 2. Redistributions in binary form must reproduce the above copyright
12121985Sjhb *    notice, this list of conditions and the following disclaimer in the
13121985Sjhb *    documentation and/or other materials provided with the distribution.
14121985Sjhb * 4. Neither the name of the University nor the names of its contributors
15121985Sjhb *    may be used to endorse or promote products derived from this software
16121985Sjhb *    without specific prior written permission.
17121985Sjhb *
18121985Sjhb * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19121985Sjhb * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20121985Sjhb * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21121985Sjhb * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22121985Sjhb * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23121985Sjhb * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24121985Sjhb * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25121985Sjhb * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26121985Sjhb * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27121985Sjhb * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28121985Sjhb * SUCH DAMAGE.
29121985Sjhb *
3026168Sfsmp *	from: vector.s, 386BSD 0.1 unknown origin
3150477Speter * $FreeBSD$
3226168Sfsmp */
3326168Sfsmp
34121985Sjhb/*
35121985Sjhb * Interrupt entry points for external interrupts triggered by the 8259A
36121985Sjhb * master and slave interrupt controllers.
37121985Sjhb */
38121985Sjhb
39121985Sjhb#include <machine/asmacros.h>
40121985Sjhb
41121985Sjhb#include "assym.s"
42121985Sjhb
4326168Sfsmp/*
44162482Swkoszek * Macros for interrupt entry, call to handler, and exit.
4565557Sjasone */
46122572Sjhb#define	INTR(irq_num, vec_name) \
4793265Sdillon	.text ;								\
4893265Sdillon	SUPERALIGN_TEXT ;						\
4993265SdillonIDTVEC(vec_name) ;							\
50153241Sjhb	PUSH_FRAME ;							\
51129618Sbde	FAKE_MCOUNT(TF_RIP(%rsp)) ;					\
52165303Skmacy	movq	%rsp, %rsi	;                                       \
53153241Sjhb	movl	$irq_num, %edi; 	/* pass the IRQ */		\
54122572Sjhb	call	atpic_handle_intr ;					\
5593265Sdillon	MEXITCOUNT ;							\
5693264Sdillon	jmp	doreti
5726168Sfsmp
58122572Sjhb	INTR(0, atpic_intr0)
59122572Sjhb	INTR(1, atpic_intr1)
60122572Sjhb	INTR(2, atpic_intr2)
61122572Sjhb	INTR(3, atpic_intr3)
62122572Sjhb	INTR(4, atpic_intr4)
63122572Sjhb	INTR(5, atpic_intr5)
64122572Sjhb	INTR(6, atpic_intr6)
65122572Sjhb	INTR(7, atpic_intr7)
66122572Sjhb	INTR(8, atpic_intr8)
67122572Sjhb	INTR(9, atpic_intr9)
68122572Sjhb	INTR(10, atpic_intr10)
69122572Sjhb	INTR(11, atpic_intr11)
70122572Sjhb	INTR(12, atpic_intr12)
71122572Sjhb	INTR(13, atpic_intr13)
72122572Sjhb	INTR(14, atpic_intr14)
73122572Sjhb	INTR(15, atpic_intr15)
74