[BACK]Return to vector.S CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / amd64 / amd64

Annotation of src/sys/arch/amd64/amd64/vector.S, Revision 1.63.2.1

1.63.2.1! christos    1: /*     $NetBSD: vector.S,v 1.70 2019/03/07 10:16:07 nonaka Exp $       */
1.1       fvdl        2:
1.53      maxv        3: /*
1.25      ad          4:  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
1.1       fvdl        5:  * All rights reserved.
                      6:  *
1.25      ad          7:  * This code is derived from software contributed to The NetBSD Foundation
                      8:  * by Charles M. Hannum and by Andrew Doran.
1.1       fvdl        9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  *
1.25      ad         19:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     20:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1.1       fvdl       21:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1.25      ad         22:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
1.1       fvdl       23:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     24:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     25:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     26:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     27:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     28:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     29:  * POSSIBILITY OF SUCH DAMAGE.
                     30:  */
                     31:
1.25      ad         32: /*
                     33:  * Copyright (c) 2001 Wasabi Systems, Inc.
1.1       fvdl       34:  * All rights reserved.
                     35:  *
1.25      ad         36:  * Written by Frank van der Linden for Wasabi Systems, Inc.
1.1       fvdl       37:  *
                     38:  * Redistribution and use in source and binary forms, with or without
                     39:  * modification, are permitted provided that the following conditions
                     40:  * are met:
                     41:  * 1. Redistributions of source code must retain the above copyright
                     42:  *    notice, this list of conditions and the following disclaimer.
                     43:  * 2. Redistributions in binary form must reproduce the above copyright
                     44:  *    notice, this list of conditions and the following disclaimer in the
                     45:  *    documentation and/or other materials provided with the distribution.
1.25      ad         46:  * 3. All advertising materials mentioning features or use of this software
                     47:  *    must display the following acknowledgement:
                     48:  *      This product includes software developed for the NetBSD Project by
                     49:  *      Wasabi Systems, Inc.
                     50:  * 4. The name of Wasabi Systems, Inc. may not be used to endorse
                     51:  *    or promote products derived from this software without specific prior
                     52:  *    written permission.
1.1       fvdl       53:  *
1.25      ad         54:  * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
                     55:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1.1       fvdl       56:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1.25      ad         57:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL WASABI SYSTEMS, INC
1.1       fvdl       58:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     59:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     60:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     61:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     62:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     63:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     64:  * POSSIBILITY OF SUCH DAMAGE.
                     65:  */
1.25      ad         66:
1.18      dsl        67: #include <machine/asm.h>
1.1       fvdl       68:
                     69: #include "opt_ddb.h"
                     70: #include "opt_multiprocessor.h"
1.32      cegger     71: #include "opt_xen.h"
1.33      cegger     72: #include "opt_dtrace.h"
1.1       fvdl       73:
                     74: #define ALIGN_TEXT     .align 16,0x90
                     75:
                     76: #include <machine/i8259.h>
                     77: #include <machine/i82093reg.h>
                     78: #include <machine/i82489reg.h>
                     79: #include <machine/frameasm.h>
                     80: #include <machine/segments.h>
                     81: #include <machine/trap.h>
1.11      ad         82: #include <machine/specialreg.h>
1.1       fvdl       83:
                     84: #include "ioapic.h"
                     85: #include "lapic.h"
                     86: #include "assym.h"
1.63.2.1! christos   87: #ifndef XEN
        !            88: #include "hyperv.h"
        !            89: #endif
1.1       fvdl       90:
1.54      maxv       91:        .text
                     92:
1.1       fvdl       93: /*
                     94:  * Macros for interrupt entry, call to handler, and exit.
                     95:  *
                     96:  * XXX
                     97:  * The interrupt frame is set up to look like a trap frame.  This may be a
                     98:  * waste.  The only handler which needs a frame is the clock handler, and it
                     99:  * only needs a few bits.  Xdoreti() needs a trap frame for handling ASTs, but
                    100:  * it could easily convert the frame on demand.
                    101:  *
                    102:  * The direct costs of setting up a trap frame are two pushq's (error code and
                    103:  * trap number), an addl to get rid of these, and pushing and popping the
                    104:  * callee-saved registers %esi, %edi, %ebx, and %ebp twice.
                    105:  *
                    106:  * If the interrupt frame is made more flexible,  INTR can push %eax first and
                    107:  * decide the ipending case with less overhead, e.g., by avoiding loading the
                    108:  * segment registers.
                    109:  */
                    110:
                    111: #if NLAPIC > 0
                    112: #ifdef MULTIPROCESSOR
                    113: IDTVEC(recurse_lapic_ipi)
                    114:        INTR_RECURSE_HWFRAME
1.46      maxv      115:        pushq   $0
1.1       fvdl      116:        pushq   $T_ASTFLT
1.57      maxv      117:        INTR_RECURSE_ENTRY
1.1       fvdl      118:        jmp     1f
1.43      uebayasi  119: IDTVEC_END(recurse_lapic_ipi)
1.61      maxv      120: IDTVEC(handle_x2apic_ipi)
1.49      nonaka    121:        movl    $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
                    122:        xorl    %eax,%eax
                    123:        xorl    %edx,%edx
                    124:        wrmsr
                    125:        movl    CPUVAR(ILEVEL),%ebx
                    126:        cmpl    $IPL_HIGH,%ebx
                    127:        jae     2f
                    128:        jmp     1f
1.61      maxv      129: IDTVEC_END(handle_x2apic_ipi)
                    130: IDTVEC(handle_lapic_ipi)
1.48      maxv      131:        movq    _C_LABEL(local_apic_va),%rbx
                    132:        movl    $0,LAPIC_EOI(%rbx)
1.1       fvdl      133:        movl    CPUVAR(ILEVEL),%ebx
1.16      ad        134:        cmpl    $IPL_HIGH,%ebx
1.1       fvdl      135:        jae     2f
1.53      maxv      136:        jmp     1f
1.61      maxv      137: IDTVEC_END(handle_lapic_ipi)
1.5       fvdl      138: IDTVEC(resume_lapic_ipi)
1.1       fvdl      139: 1:
                    140:        incl    CPUVAR(IDEPTH)
1.16      ad        141:        movl    $IPL_HIGH,CPUVAR(ILEVEL)
1.45      maxv      142:        sti
1.1       fvdl      143:        pushq   %rbx
                    144:        call    _C_LABEL(x86_ipi_handler)
                    145:        jmp     _C_LABEL(Xdoreti)
                    146: 2:
                    147:        orl     $(1 << LIR_IPI),CPUVAR(IPENDING)
                    148:        INTRFASTEXIT
1.43      uebayasi  149: IDTVEC_END(resume_lapic_ipi)
1.1       fvdl      150:
1.56      maxv      151:        TEXT_USER_BEGIN
                    152: IDTVEC(intr_x2apic_ipi)
                    153:        pushq   $0
                    154:        pushq   $T_ASTFLT
                    155:        INTRENTRY
1.61      maxv      156:        jmp     _C_LABEL(Xhandle_x2apic_ipi)
1.56      maxv      157: IDTVEC_END(intr_x2apic_ipi)
                    158: IDTVEC(intr_lapic_ipi)
1.1       fvdl      159:        pushq   $0
1.56      maxv      160:        pushq   $T_ASTFLT
1.1       fvdl      161:        INTRENTRY
1.61      maxv      162:        jmp     _C_LABEL(Xhandle_lapic_ipi)
1.56      maxv      163: IDTVEC_END(intr_lapic_ipi)
                    164:        TEXT_USER_END
                    165:
                    166: #if defined(DDB)
1.62      christos  167: IDTVEC(handle_ddbipi)
1.1       fvdl      168:        movl    $0xf,%eax
                    169:        movq    %rax,%cr8
1.48      maxv      170:        movq    _C_LABEL(local_apic_va),%rbx
                    171:        movl    $0,LAPIC_EOI(%rbx)
1.1       fvdl      172:        sti
                    173:        call    _C_LABEL(ddb_ipi)
                    174:        xorl    %eax,%eax
                    175:        movq    %rax,%cr8
                    176:        INTRFASTEXIT
1.62      christos  177: IDTVEC_END(handle_ddbipi)
                    178: IDTVEC(handle_x2apic_ddbipi)
1.49      nonaka    179:        movl    $0xf,%eax
                    180:        movq    %rax,%cr8
                    181:        movl    $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
                    182:        xorl    %eax,%eax
                    183:        xorl    %edx,%edx
                    184:        wrmsr
                    185:        sti
                    186:        call    _C_LABEL(ddb_ipi)
                    187:        xorl    %eax,%eax
                    188:        movq    %rax,%cr8
                    189:        INTRFASTEXIT
1.62      christos  190: IDTVEC_END(handle_x2apic_ddbipi)
1.56      maxv      191:
                    192:        TEXT_USER_BEGIN
1.62      christos  193: IDTVEC(intr_ddbipi)
1.56      maxv      194:        pushq   $0
                    195:        pushq   $T_BPTFLT
                    196:        INTRENTRY
1.62      christos  197:        jmp     _C_LABEL(Xhandle_ddbipi)
                    198: IDTVEC_END(intr_ddbipi)
                    199: IDTVEC(intr_x2apic_ddbipi)
1.56      maxv      200:        pushq   $0
                    201:        pushq   $T_BPTFLT
                    202:        INTRENTRY
1.62      christos  203:        jmp     _C_LABEL(Xhandle_x2apic_ddbipi)
                    204: IDTVEC_END(intr_x2apic_ddbipi)
1.56      maxv      205:        TEXT_USER_END
                    206:
1.1       fvdl      207: #endif /* DDB */
                    208: #endif /* MULTIPROCESSOR */
1.46      maxv      209:
1.1       fvdl      210:        /*
                    211:         * Interrupt from the local APIC timer.
                    212:         */
                    213: IDTVEC(recurse_lapic_ltimer)
                    214:        INTR_RECURSE_HWFRAME
1.46      maxv      215:        pushq   $0
1.1       fvdl      216:        pushq   $T_ASTFLT
1.57      maxv      217:        INTR_RECURSE_ENTRY
1.1       fvdl      218:        jmp     1f
1.43      uebayasi  219: IDTVEC_END(recurse_lapic_ltimer)
1.61      maxv      220: IDTVEC(handle_x2apic_ltimer)
1.49      nonaka    221:        movl    $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
                    222:        xorl    %eax,%eax
                    223:        xorl    %edx,%edx
                    224:        wrmsr
                    225:        movl    CPUVAR(ILEVEL),%ebx
                    226:        cmpl    $IPL_CLOCK,%ebx
                    227:        jae     2f
                    228:        jmp     1f
1.61      maxv      229: IDTVEC_END(handle_x2apic_ltimer)
                    230: IDTVEC(handle_lapic_ltimer)
1.48      maxv      231:        movq    _C_LABEL(local_apic_va),%rbx
                    232:        movl    $0,LAPIC_EOI(%rbx)
1.1       fvdl      233:        movl    CPUVAR(ILEVEL),%ebx
                    234:        cmpl    $IPL_CLOCK,%ebx
                    235:        jae     2f
1.53      maxv      236:        jmp     1f
1.61      maxv      237: IDTVEC_END(handle_lapic_ltimer)
1.5       fvdl      238: IDTVEC(resume_lapic_ltimer)
1.1       fvdl      239: 1:
                    240:        incl    CPUVAR(IDEPTH)
                    241:        movl    $IPL_CLOCK,CPUVAR(ILEVEL)
                    242:        sti
                    243:        pushq   %rbx
1.9       yamt      244:        movq    %rsp,%rsi
1.1       fvdl      245:        xorq    %rdi,%rdi
                    246:        call    _C_LABEL(lapic_clockintr)
                    247:        jmp     _C_LABEL(Xdoreti)
                    248: 2:
                    249:        orl     $(1 << LIR_TIMER),CPUVAR(IPENDING)
                    250:        INTRFASTEXIT
1.43      uebayasi  251: IDTVEC_END(resume_lapic_ltimer)
1.56      maxv      252:
                    253:        TEXT_USER_BEGIN
                    254: IDTVEC(intr_x2apic_ltimer)
                    255:        pushq   $0
                    256:        pushq   $T_ASTFLT
                    257:        INTRENTRY
1.61      maxv      258:        jmp     _C_LABEL(Xhandle_x2apic_ltimer)
1.56      maxv      259: IDTVEC_END(intr_x2apic_ltimer)
                    260: IDTVEC(intr_lapic_ltimer)
                    261:        pushq   $0
                    262:        pushq   $T_ASTFLT
                    263:        INTRENTRY
1.61      maxv      264:        jmp     _C_LABEL(Xhandle_lapic_ltimer)
1.56      maxv      265: IDTVEC_END(intr_lapic_ltimer)
                    266:        TEXT_USER_END
                    267:
1.63.2.1! christos  268: #if NHYPERV > 0
        !           269:        /*
        !           270:         * Hyper-V event channel upcall interrupt handler.
        !           271:         * Only used when the hypervisor supports direct vector callbacks.
        !           272:         */
        !           273: IDTVEC(recurse_hyperv_hypercall)
        !           274:        INTR_RECURSE_HWFRAME
        !           275:        pushq   $0
        !           276:        pushq   $T_ASTFLT
        !           277:        INTR_RECURSE_ENTRY
        !           278:        jmp     1f
        !           279: IDTVEC_END(recurse_hyperv_hypercall)
        !           280: IDTVEC(handle_hyperv_hypercall)
        !           281:        movl    CPUVAR(ILEVEL),%ebx
        !           282:        cmpl    $IPL_NET,%ebx
        !           283:        jae     2f
        !           284:        jmp     1f
        !           285: IDTVEC_END(handle_hyperv_hypercall)
        !           286: IDTVEC(resume_hyperv_hypercall)
        !           287: 1:
        !           288:        incl    CPUVAR(IDEPTH)
        !           289:        movl    $IPL_NET,CPUVAR(ILEVEL)
        !           290:        sti
        !           291:        pushq   %rbx
        !           292:        movq    %rsp,%rsi
        !           293:        call    _C_LABEL(hyperv_hypercall_intr)
        !           294:        jmp     _C_LABEL(Xdoreti)
        !           295: 2:
        !           296:        orl     $(1 << LIR_HV),CPUVAR(IPENDING)
        !           297:        INTRFASTEXIT
        !           298: IDTVEC_END(resume_hyperv_hypercall)
        !           299:
        !           300:        TEXT_USER_BEGIN
        !           301: IDTVEC(intr_hyperv_hypercall)
        !           302:        pushq   $0
        !           303:        pushq   $T_ASTFLT
        !           304:        INTRENTRY
        !           305:        jmp     _C_LABEL(Xhandle_hyperv_hypercall)
        !           306: IDTVEC_END(intr_hyperv_hypercall)
        !           307:        TEXT_USER_END
        !           308: #endif /* NHYPERV > 0 */
        !           309:
1.1       fvdl      310: #endif /* NLAPIC > 0 */
                    311:
1.63.2.1! christos  312: #ifndef XENPV
1.11      ad        313: /*
1.38      rmind     314:  * TLB shootdown handler.
1.11      ad        315:  */
1.61      maxv      316: IDTVEC(handle_lapic_tlb)
1.48      maxv      317:        movq    _C_LABEL(local_apic_va),%rax
                    318:        movl    $0,LAPIC_EOI(%rax)
1.38      rmind     319:        callq   _C_LABEL(pmap_tlb_intr)
                    320:        INTRFASTEXIT
1.61      maxv      321: IDTVEC_END(handle_lapic_tlb)
                    322: IDTVEC(handle_x2apic_tlb)
1.49      nonaka    323:        movl    $(MSR_X2APIC_BASE + MSR_X2APIC_EOI),%ecx
                    324:        xorl    %eax,%eax
                    325:        xorl    %edx,%edx
                    326:        wrmsr
                    327:        callq   _C_LABEL(pmap_tlb_intr)
                    328:        INTRFASTEXIT
1.61      maxv      329: IDTVEC_END(handle_x2apic_tlb)
1.56      maxv      330:
                    331:        TEXT_USER_BEGIN
                    332: IDTVEC(intr_lapic_tlb)
                    333:        pushq   $0
                    334:        pushq   $T_ASTFLT
                    335:        INTRENTRY
1.61      maxv      336:        jmp     _C_LABEL(Xhandle_lapic_tlb)
1.56      maxv      337: IDTVEC_END(intr_lapic_tlb)
                    338: IDTVEC(intr_x2apic_tlb)
                    339:        pushq   $0
                    340:        pushq   $T_ASTFLT
                    341:        INTRENTRY
1.61      maxv      342:        jmp     _C_LABEL(Xhandle_x2apic_tlb)
1.49      nonaka    343: IDTVEC_END(intr_x2apic_tlb)
1.56      maxv      344:        TEXT_USER_END
1.49      nonaka    345:
1.63.2.1! christos  346: #endif /* !XENPV */
1.15      bouyer    347:
1.1       fvdl      348: #define voidop(num)
                    349:
1.63.2.1! christos  350: #ifndef XENPV
1.1       fvdl      351:
                    352: /*
1.60      maxv      353:  * This macro defines the generic stub code. Its arguments modify it
1.1       fvdl      354:  * for specific PICs.
                    355:  */
                    356:
1.2       fvdl      357: #define        INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
1.36      joerg     358: IDTVEC(recurse_ ## name ## num)                                                ;\
1.1       fvdl      359:        INTR_RECURSE_HWFRAME                                            ;\
1.2       fvdl      360:        subq    $8,%rsp                                                 ;\
1.1       fvdl      361:        pushq   $T_ASTFLT               /* trap # for doing ASTs */     ;\
1.57      maxv      362:        INTR_RECURSE_ENTRY                                              ;\
1.52      maxv      363:        jmp     1f                                                      ;\
                    364: IDTVEC_END(recurse_ ## name ## num)                                    ;\
1.36      joerg     365: IDTVEC(resume_ ## name ## num)                                         \
1.52      maxv      366: 1:     movq    $IREENT_MAGIC,TF_ERR(%rsp)                              ;\
1.1       fvdl      367:        movl    %ebx,%r13d                                              ;\
1.46      maxv      368:        movq    CPUVAR(ISOURCES) + (num) * 8,%r14                       ;\
1.1       fvdl      369:        movl    IS_MAXLEVEL(%r14),%ebx                                  ;\
                    370:        jmp     1f                                                      ;\
1.52      maxv      371: IDTVEC_END(resume_ ## name ## num)                                     ;\
1.61      maxv      372: IDTVEC(handle_ ## name ## num)                                         ;\
1.46      maxv      373:        movq    CPUVAR(ISOURCES) + (num) * 8,%r14                       ;\
1.40      dsl       374:        mask(num)                       /* mask it in hardware */       ;\
1.1       fvdl      375:        early_ack(num)                  /* and allow other intrs */     ;\
                    376:        testq   %r14,%r14                                               ;\
                    377:        jz      9f                      /* stray */                     ;\
                    378:        movl    IS_MAXLEVEL(%r14),%ebx                                  ;\
                    379:        movl    CPUVAR(ILEVEL),%r13d                                    ;\
                    380:        cmpl    %ebx,%r13d                                              ;\
                    381:        jae     10f                     /* currently masked; hold it */ ;\
1.35      matt      382:        incq    CPUVAR(NINTR)           /* statistical info */          ;\
1.1       fvdl      383:        incq    IS_EVCNT(%r14)                                          ;\
                    384: 1:                                                                     \
1.42      yamt      385:        pushq   %r13                    /* save for Xdoreti */          ;\
1.1       fvdl      386:        movl    %ebx,CPUVAR(ILEVEL)                                     ;\
                    387:        sti                                                             ;\
                    388:        incl    CPUVAR(IDEPTH)                                          ;\
                    389:        movq    IS_HANDLERS(%r14),%rbx                                  ;\
                    390: 6:                                                                     \
                    391:        movl    IH_LEVEL(%rbx),%r12d                                    ;\
                    392:        cmpl    %r13d,%r12d                                             ;\
                    393:        jle     7f                                                      ;\
1.9       yamt      394:        movq    %rsp,%rsi                                               ;\
1.1       fvdl      395:        movq    IH_ARG(%rbx),%rdi                                       ;\
                    396:        movl    %r12d,CPUVAR(ILEVEL)                                    ;\
                    397:        call    *IH_FUN(%rbx)           /* call it */                   ;\
                    398:        movq    IH_NEXT(%rbx),%rbx      /* next handler in chain */     ;\
                    399:        testq   %rbx,%rbx                                               ;\
                    400:        jnz     6b                                                      ;\
                    401: 5:                                                                     \
1.2       fvdl      402:        cli                                                             ;\
1.1       fvdl      403:        unmask(num)                     /* unmask it in hardware */     ;\
                    404:        late_ack(num)                                                   ;\
                    405:        sti                                                             ;\
                    406:        jmp     _C_LABEL(Xdoreti)       /* lower spl and do ASTs */     ;\
                    407: 7:                                                                     \
1.2       fvdl      408:        cli                                                             ;\
1.46      maxv      409:        orl     $(1 << num),CPUVAR(IPENDING)                            ;\
1.2       fvdl      410:        level_mask(num)                                                 ;\
1.1       fvdl      411:        late_ack(num)                                                   ;\
                    412:        sti                                                             ;\
                    413:        jmp     _C_LABEL(Xdoreti)       /* lower spl and do ASTs */     ;\
                    414: 10:                                                                    \
1.2       fvdl      415:        cli                                                             ;\
1.46      maxv      416:        orl     $(1 << num),CPUVAR(IPENDING)                            ;\
1.2       fvdl      417:        level_mask(num)                                                 ;\
1.1       fvdl      418:        late_ack(num)                                                   ;\
                    419:        INTRFASTEXIT                                                    ;\
                    420: 9:                                                                     \
                    421:        unmask(num)                                                     ;\
                    422:        late_ack(num)                                                   ;\
1.52      maxv      423:        INTRFASTEXIT                                                    ;\
1.61      maxv      424: IDTVEC_END(handle_ ## name ## num)                                     ;\
1.56      maxv      425:        TEXT_USER_BEGIN                                                 ;\
                    426: IDTVEC(intr_ ## name ## num)                                           ;\
                    427:        pushq   $0                      /* dummy error code */          ;\
                    428:        pushq   $T_ASTFLT               /* trap # for doing ASTs */     ;\
                    429:        INTRENTRY                                                       ;\
1.61      maxv      430:        jmp     _C_LABEL(Xhandle_ ## name ## num)                       ;\
1.56      maxv      431: IDTVEC_END(intr_ ## name ## num)                                       ;\
                    432:        TEXT_USER_END
1.1       fvdl      433:
                    434: #define ICUADDR IO_ICU1
                    435:
                    436: INTRSTUB(legacy,0,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    437:     voidop)
                    438: INTRSTUB(legacy,1,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    439:     voidop)
                    440: INTRSTUB(legacy,2,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    441:     voidop)
                    442: INTRSTUB(legacy,3,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    443:     voidop)
                    444: INTRSTUB(legacy,4,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    445:     voidop)
                    446: INTRSTUB(legacy,5,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    447:     voidop)
                    448: INTRSTUB(legacy,6,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    449:     voidop)
                    450: INTRSTUB(legacy,7,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask,
                    451:     voidop)
                    452: #undef ICUADDR
                    453: #define ICUADDR IO_ICU2
                    454:
                    455: INTRSTUB(legacy,8,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    456:     voidop)
                    457: INTRSTUB(legacy,9,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    458:     voidop)
                    459: INTRSTUB(legacy,10,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    460:     voidop)
                    461: INTRSTUB(legacy,11,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    462:     voidop)
                    463: INTRSTUB(legacy,12,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    464:     voidop)
                    465: INTRSTUB(legacy,13,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    466:     voidop)
                    467: INTRSTUB(legacy,14,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    468:     voidop)
                    469: INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask,
                    470:     voidop)
                    471:
                    472: #if NIOAPIC > 0
1.2       fvdl      473:
                    474: INTRSTUB(ioapic_edge,0,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    475: INTRSTUB(ioapic_edge,1,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    476: INTRSTUB(ioapic_edge,2,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    477: INTRSTUB(ioapic_edge,3,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    478: INTRSTUB(ioapic_edge,4,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    479: INTRSTUB(ioapic_edge,5,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    480: INTRSTUB(ioapic_edge,6,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    481: INTRSTUB(ioapic_edge,7,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    482: INTRSTUB(ioapic_edge,8,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    483: INTRSTUB(ioapic_edge,9,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    484: INTRSTUB(ioapic_edge,10,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    485: INTRSTUB(ioapic_edge,11,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    486: INTRSTUB(ioapic_edge,12,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    487: INTRSTUB(ioapic_edge,13,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    488: INTRSTUB(ioapic_edge,14,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    489: INTRSTUB(ioapic_edge,15,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    490: INTRSTUB(ioapic_edge,16,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    491: INTRSTUB(ioapic_edge,17,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    492: INTRSTUB(ioapic_edge,18,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    493: INTRSTUB(ioapic_edge,19,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    494: INTRSTUB(ioapic_edge,20,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    495: INTRSTUB(ioapic_edge,21,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    496: INTRSTUB(ioapic_edge,22,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    497: INTRSTUB(ioapic_edge,23,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    498: INTRSTUB(ioapic_edge,24,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    499: INTRSTUB(ioapic_edge,25,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    500: INTRSTUB(ioapic_edge,26,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    501: INTRSTUB(ioapic_edge,27,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    502: INTRSTUB(ioapic_edge,28,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    503: INTRSTUB(ioapic_edge,29,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    504: INTRSTUB(ioapic_edge,30,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    505: INTRSTUB(ioapic_edge,31,voidop,ioapic_asm_ack,voidop,voidop,voidop)
                    506:
                    507: INTRSTUB(ioapic_level,0,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    508: INTRSTUB(ioapic_level,1,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    509: INTRSTUB(ioapic_level,2,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    510: INTRSTUB(ioapic_level,3,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    511: INTRSTUB(ioapic_level,4,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    512: INTRSTUB(ioapic_level,5,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    513: INTRSTUB(ioapic_level,6,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    514: INTRSTUB(ioapic_level,7,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    515: INTRSTUB(ioapic_level,8,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    516: INTRSTUB(ioapic_level,9,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    517: INTRSTUB(ioapic_level,10,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    518: INTRSTUB(ioapic_level,11,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    519: INTRSTUB(ioapic_level,12,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    520: INTRSTUB(ioapic_level,13,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    521: INTRSTUB(ioapic_level,14,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    522: INTRSTUB(ioapic_level,15,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    523: INTRSTUB(ioapic_level,16,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    524: INTRSTUB(ioapic_level,17,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    525: INTRSTUB(ioapic_level,18,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    526: INTRSTUB(ioapic_level,19,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    527: INTRSTUB(ioapic_level,20,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    528: INTRSTUB(ioapic_level,21,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    529: INTRSTUB(ioapic_level,22,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    530: INTRSTUB(ioapic_level,23,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    531: INTRSTUB(ioapic_level,24,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    532: INTRSTUB(ioapic_level,25,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    533: INTRSTUB(ioapic_level,26,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    534: INTRSTUB(ioapic_level,27,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    535: INTRSTUB(ioapic_level,28,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    536: INTRSTUB(ioapic_level,29,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    537: INTRSTUB(ioapic_level,30,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    538: INTRSTUB(ioapic_level,31,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    539:
1.49      nonaka    540: INTRSTUB(x2apic_edge,0,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    541: INTRSTUB(x2apic_edge,1,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    542: INTRSTUB(x2apic_edge,2,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    543: INTRSTUB(x2apic_edge,3,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    544: INTRSTUB(x2apic_edge,4,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    545: INTRSTUB(x2apic_edge,5,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    546: INTRSTUB(x2apic_edge,6,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    547: INTRSTUB(x2apic_edge,7,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    548: INTRSTUB(x2apic_edge,8,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    549: INTRSTUB(x2apic_edge,9,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    550: INTRSTUB(x2apic_edge,10,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    551: INTRSTUB(x2apic_edge,11,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    552: INTRSTUB(x2apic_edge,12,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    553: INTRSTUB(x2apic_edge,13,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    554: INTRSTUB(x2apic_edge,14,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    555: INTRSTUB(x2apic_edge,15,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    556: INTRSTUB(x2apic_edge,16,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    557: INTRSTUB(x2apic_edge,17,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    558: INTRSTUB(x2apic_edge,18,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    559: INTRSTUB(x2apic_edge,19,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    560: INTRSTUB(x2apic_edge,20,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    561: INTRSTUB(x2apic_edge,21,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    562: INTRSTUB(x2apic_edge,22,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    563: INTRSTUB(x2apic_edge,23,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    564: INTRSTUB(x2apic_edge,24,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    565: INTRSTUB(x2apic_edge,25,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    566: INTRSTUB(x2apic_edge,26,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    567: INTRSTUB(x2apic_edge,27,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    568: INTRSTUB(x2apic_edge,28,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    569: INTRSTUB(x2apic_edge,29,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    570: INTRSTUB(x2apic_edge,30,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    571: INTRSTUB(x2apic_edge,31,voidop,x2apic_asm_ack,voidop,voidop,voidop)
                    572:
                    573: INTRSTUB(x2apic_level,0,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    574: INTRSTUB(x2apic_level,1,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    575: INTRSTUB(x2apic_level,2,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    576: INTRSTUB(x2apic_level,3,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    577: INTRSTUB(x2apic_level,4,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    578: INTRSTUB(x2apic_level,5,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    579: INTRSTUB(x2apic_level,6,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    580: INTRSTUB(x2apic_level,7,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    581: INTRSTUB(x2apic_level,8,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    582: INTRSTUB(x2apic_level,9,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    583: INTRSTUB(x2apic_level,10,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    584: INTRSTUB(x2apic_level,11,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    585: INTRSTUB(x2apic_level,12,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    586: INTRSTUB(x2apic_level,13,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    587: INTRSTUB(x2apic_level,14,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    588: INTRSTUB(x2apic_level,15,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    589: INTRSTUB(x2apic_level,16,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    590: INTRSTUB(x2apic_level,17,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    591: INTRSTUB(x2apic_level,18,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    592: INTRSTUB(x2apic_level,19,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    593: INTRSTUB(x2apic_level,20,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    594: INTRSTUB(x2apic_level,21,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    595: INTRSTUB(x2apic_level,22,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    596: INTRSTUB(x2apic_level,23,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    597: INTRSTUB(x2apic_level,24,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    598: INTRSTUB(x2apic_level,25,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    599: INTRSTUB(x2apic_level,26,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    600: INTRSTUB(x2apic_level,27,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    601: INTRSTUB(x2apic_level,28,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    602: INTRSTUB(x2apic_level,29,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    603: INTRSTUB(x2apic_level,30,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    604: INTRSTUB(x2apic_level,31,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask)
                    605:
1.1       fvdl      606: #endif
                    607:
1.58      maxv      608: /*
                    609:  * Create a struct intrstub.
                    610:  */
                    611: #define INTRSTUB_ENTRY(name) \
                    612:        .quad _C_LABEL(Xintr_ ## name ), _C_LABEL(Xrecurse_ ## name ) ; \
                    613:        .quad _C_LABEL(Xresume_ ## name ) ;
                    614:
                    615: /*
1.60      maxv      616:  * Create an array of structs intrstub (16 entries).
                    617:  */
                    618: #define INTRSTUB_ARRAY_16(name)                ; \
                    619:        .type _C_LABEL(name ## _stubs), @object ; \
                    620: LABEL(name ## _stubs)                          ; \
                    621:        INTRSTUB_ENTRY(name ## 0)               ; \
                    622:        INTRSTUB_ENTRY(name ## 1)               ; \
                    623:        INTRSTUB_ENTRY(name ## 2)               ; \
                    624:        INTRSTUB_ENTRY(name ## 3)               ; \
                    625:        INTRSTUB_ENTRY(name ## 4)               ; \
                    626:        INTRSTUB_ENTRY(name ## 5)               ; \
                    627:        INTRSTUB_ENTRY(name ## 6)               ; \
                    628:        INTRSTUB_ENTRY(name ## 7)               ; \
                    629:        INTRSTUB_ENTRY(name ## 8)               ; \
                    630:        INTRSTUB_ENTRY(name ## 9)               ; \
                    631:        INTRSTUB_ENTRY(name ## 10)              ; \
                    632:        INTRSTUB_ENTRY(name ## 11)              ; \
                    633:        INTRSTUB_ENTRY(name ## 12)              ; \
                    634:        INTRSTUB_ENTRY(name ## 13)              ; \
                    635:        INTRSTUB_ENTRY(name ## 14)              ; \
                    636:        INTRSTUB_ENTRY(name ## 15)              ; \
                    637: END(name ## _stubs)
                    638:
                    639: /*
                    640:  * Create an array of structs intrstub (32 entries).
1.58      maxv      641:  */
1.60      maxv      642: #define INTRSTUB_ARRAY_32(name)                ; \
1.58      maxv      643:        .type _C_LABEL(name ## _stubs), @object ; \
                    644: LABEL(name ## _stubs)                          ; \
                    645:        INTRSTUB_ENTRY(name ## 0)               ; \
                    646:        INTRSTUB_ENTRY(name ## 1)               ; \
                    647:        INTRSTUB_ENTRY(name ## 2)               ; \
                    648:        INTRSTUB_ENTRY(name ## 3)               ; \
                    649:        INTRSTUB_ENTRY(name ## 4)               ; \
                    650:        INTRSTUB_ENTRY(name ## 5)               ; \
                    651:        INTRSTUB_ENTRY(name ## 6)               ; \
                    652:        INTRSTUB_ENTRY(name ## 7)               ; \
                    653:        INTRSTUB_ENTRY(name ## 8)               ; \
                    654:        INTRSTUB_ENTRY(name ## 9)               ; \
                    655:        INTRSTUB_ENTRY(name ## 10)              ; \
                    656:        INTRSTUB_ENTRY(name ## 11)              ; \
                    657:        INTRSTUB_ENTRY(name ## 12)              ; \
                    658:        INTRSTUB_ENTRY(name ## 13)              ; \
                    659:        INTRSTUB_ENTRY(name ## 14)              ; \
                    660:        INTRSTUB_ENTRY(name ## 15)              ; \
                    661:        INTRSTUB_ENTRY(name ## 16)              ; \
                    662:        INTRSTUB_ENTRY(name ## 17)              ; \
                    663:        INTRSTUB_ENTRY(name ## 18)              ; \
                    664:        INTRSTUB_ENTRY(name ## 19)              ; \
                    665:        INTRSTUB_ENTRY(name ## 20)              ; \
                    666:        INTRSTUB_ENTRY(name ## 21)              ; \
                    667:        INTRSTUB_ENTRY(name ## 22)              ; \
                    668:        INTRSTUB_ENTRY(name ## 23)              ; \
                    669:        INTRSTUB_ENTRY(name ## 24)              ; \
                    670:        INTRSTUB_ENTRY(name ## 25)              ; \
                    671:        INTRSTUB_ENTRY(name ## 26)              ; \
                    672:        INTRSTUB_ENTRY(name ## 27)              ; \
                    673:        INTRSTUB_ENTRY(name ## 28)              ; \
                    674:        INTRSTUB_ENTRY(name ## 29)              ; \
                    675:        INTRSTUB_ENTRY(name ## 30)              ; \
                    676:        INTRSTUB_ENTRY(name ## 31)              ; \
                    677: END(name ## _stubs)
                    678:
1.63.2.1! christos  679: #endif /* !XENPV */
1.50      cherry    680:
                    681: #if defined(XEN)
1.15      bouyer    682: /* Resume/recurse procedures for spl() */
                    683: #define        XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
1.36      joerg     684: IDTVEC(recurse_ ## name ## num)                                                ;\
1.46      maxv      685:        INTR_RECURSE_HWFRAME                                            ;\
                    686:        subq    $8,%rsp                                                 ;\
                    687:        pushq   $T_ASTFLT               /* trap # for doing ASTs */     ;\
1.57      maxv      688:        INTR_RECURSE_ENTRY                                              ;\
1.36      joerg     689: IDTVEC(resume_ ## name ## num)                                         \
1.46      maxv      690:        movq    $IREENT_MAGIC,TF_ERR(%rsp)                              ;\
                    691:        movl    %ebx,%r13d                                              ;\
1.63.2.1! christos  692:        movq    CPUVAR(XSOURCES) + (num) * 8,%r14                       ;\
1.15      bouyer    693: 1:                                                                     \
1.46      maxv      694:        pushq   %r13                                                    ;\
                    695:        movl    $num,CPUVAR(ILEVEL)                                     ;\
                    696:        STI(si)                                                         ;\
                    697:        incl    CPUVAR(IDEPTH)                                          ;\
                    698:        movq    IS_HANDLERS(%r14),%rbx                                  ;\
1.15      bouyer    699: 6:                                                                     \
1.46      maxv      700:        movq    IH_ARG(%rbx),%rdi                                       ;\
                    701:        movq    %rsp,%rsi                                               ;\
                    702:        call    *IH_FUN(%rbx)           /* call it */                   ;\
1.50      cherry    703:        movq    IH_NEXT(%rbx),%rbx      /* next handler in chain */     ;\
1.46      maxv      704:        testq   %rbx,%rbx                                               ;\
                    705:        jnz     6b                                                      ;\
1.15      bouyer    706: 5:                                                                     \
1.46      maxv      707:        CLI(si)                                                         ;\
                    708:        unmask(num)                     /* unmask it in hardware */     ;\
                    709:        late_ack(num)                                                   ;\
                    710:        STI(si)                                                         ;\
                    711:        jmp     _C_LABEL(Xdoreti)       /* lower spl and do ASTs */     ;\
                    712:
                    713: /* The unmask func for Xen events */
1.15      bouyer    714: #define hypervisor_asm_unmask(num)                     \
1.46      maxv      715:        movq    $num,%rdi                               ;\
                    716:        call    _C_LABEL(hypervisor_enable_ipl)
                    717:
1.15      bouyer    718: XENINTRSTUB(xenev,0,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    719: XENINTRSTUB(xenev,1,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    720: XENINTRSTUB(xenev,2,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    721: XENINTRSTUB(xenev,3,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    722: XENINTRSTUB(xenev,4,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    723: XENINTRSTUB(xenev,5,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    724: XENINTRSTUB(xenev,6,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    725: XENINTRSTUB(xenev,7,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    726: XENINTRSTUB(xenev,8,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    727: XENINTRSTUB(xenev,9,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    728: XENINTRSTUB(xenev,10,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    729: XENINTRSTUB(xenev,11,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    730: XENINTRSTUB(xenev,12,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    731: XENINTRSTUB(xenev,13,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    732: XENINTRSTUB(xenev,14,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    733: XENINTRSTUB(xenev,15,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    734: XENINTRSTUB(xenev,16,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    735: XENINTRSTUB(xenev,17,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    736: XENINTRSTUB(xenev,18,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    737: XENINTRSTUB(xenev,19,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    738: XENINTRSTUB(xenev,20,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    739: XENINTRSTUB(xenev,21,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    740: XENINTRSTUB(xenev,22,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    741: XENINTRSTUB(xenev,23,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    742: XENINTRSTUB(xenev,24,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    743: XENINTRSTUB(xenev,25,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    744: XENINTRSTUB(xenev,26,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    745: XENINTRSTUB(xenev,27,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    746: XENINTRSTUB(xenev,28,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    747: XENINTRSTUB(xenev,29,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    748: XENINTRSTUB(xenev,30,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
                    749: XENINTRSTUB(xenev,31,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
1.45      maxv      750:
1.63.2.1! christos  751: /* On Xen, the xenev_stubs are purely for spl entry, since there is no
        !           752:  * vector based mechanism. We however provide the entrypoint to ensure
        !           753:  * that native and Xen struct intrstub ; definitions are uniform.
        !           754:  */
        !           755: panicmsg:      .ascii "vector Xen event entry path entered."
        !           756: LABEL(entry_xenev)
        !           757:        movq $panicmsg, %rdi
        !           758:        callq _C_LABEL(panic)
        !           759: END(entry_xenev)
        !           760:
1.43      uebayasi  761: LABEL(xenev_stubs)
1.63.2.1! christos  762:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev0), _C_LABEL(Xresume_xenev0)
        !           763:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev1) ,_C_LABEL(Xresume_xenev1)
        !           764:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev2) ,_C_LABEL(Xresume_xenev2)
        !           765:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev3) ,_C_LABEL(Xresume_xenev3)
        !           766:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev4) ,_C_LABEL(Xresume_xenev4)
        !           767:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev5) ,_C_LABEL(Xresume_xenev5)
        !           768:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev6) ,_C_LABEL(Xresume_xenev6)
        !           769:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev7) ,_C_LABEL(Xresume_xenev7)
        !           770:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev8) ,_C_LABEL(Xresume_xenev8)
        !           771:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev9) ,_C_LABEL(Xresume_xenev9)
        !           772:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev10), _C_LABEL(Xresume_xenev10)
        !           773:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev11), _C_LABEL(Xresume_xenev11)
        !           774:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev12), _C_LABEL(Xresume_xenev12)
        !           775:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev13), _C_LABEL(Xresume_xenev13)
        !           776:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev14), _C_LABEL(Xresume_xenev14)
        !           777:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev15), _C_LABEL(Xresume_xenev15)
        !           778:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev16), _C_LABEL(Xresume_xenev16)
        !           779:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev17), _C_LABEL(Xresume_xenev17)
        !           780:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev18), _C_LABEL(Xresume_xenev18)
        !           781:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev19), _C_LABEL(Xresume_xenev19)
        !           782:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev20), _C_LABEL(Xresume_xenev20)
        !           783:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev21), _C_LABEL(Xresume_xenev21)
        !           784:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev22), _C_LABEL(Xresume_xenev22)
        !           785:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev23), _C_LABEL(Xresume_xenev23)
        !           786:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev24), _C_LABEL(Xresume_xenev24)
        !           787:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev25), _C_LABEL(Xresume_xenev25)
        !           788:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev26), _C_LABEL(Xresume_xenev26)
        !           789:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev27), _C_LABEL(Xresume_xenev27)
        !           790:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev28), _C_LABEL(Xresume_xenev28)
        !           791:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev29), _C_LABEL(Xresume_xenev29)
        !           792:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev30), _C_LABEL(Xresume_xenev30)
        !           793:        .quad entry_xenev, _C_LABEL(Xrecurse_xenev31), _C_LABEL(Xresume_xenev31)
1.43      uebayasi  794: END(xenev_stubs)
1.15      bouyer    795:
1.46      maxv      796: /*
                    797:  * Xen callbacks
                    798:  */
1.15      bouyer    799:
1.46      maxv      800: /* Hypervisor callback */
1.63.2.1! christos  801: ENTRY(hypervisor_callback)
1.45      maxv      802:        movq    (%rsp),%rcx
                    803:        movq    8(%rsp),%r11
                    804:        addq    $16,%rsp
1.63.2.1! christos  805: IDTVEC(hypervisor_pvhvm_callback)
1.46      maxv      806:        pushq   $0              /* Dummy error code */
1.15      bouyer    807:        pushq   $T_ASTFLT
                    808:        INTRENTRY
1.46      maxv      809:        /* sti?? */
                    810:        movq    %rsp,%rdi
                    811:        subq    $8,%rdi;        /* don't forget if_ppl */
1.15      bouyer    812:        call    do_hypervisor_callback
1.45      maxv      813:        testb   $SEL_RPL,TF_CS(%rsp)
1.24      ad        814:        jnz     doreti_checkast
1.15      bouyer    815: 1:
                    816:        INTRFASTEXIT
1.63.2.1! christos  817: IDTVEC_END(hypervisor_pvhvm_callback)
1.43      uebayasi  818: END(hypervisor_callback)
1.63.2.1! christos  819: #endif /* XEN */
1.15      bouyer    820:
1.63.2.1! christos  821: #ifdef XENPV
1.46      maxv      822: /* Panic? */
1.63.2.1! christos  823: ENTRY(failsafe_callback)
1.45      maxv      824:        movq    (%rsp),%rcx
                    825:        movq    8(%rsp),%r11
                    826:        addq    $16,%rsp
1.15      bouyer    827:        pushq   $0
                    828:        pushq   $T_ASTFLT
                    829:        INTRENTRY
1.46      maxv      830:        movq    %rsp,%rdi
                    831:        subq    $8,%rdi;        /* don't forget if_ppl */
1.45      maxv      832:        call    xen_failsafe_handler
1.15      bouyer    833:        INTRFASTEXIT
1.46      maxv      834: /*     jmp     HYPERVISOR_iret */
1.43      uebayasi  835: END(failsafe_callback)
1.15      bouyer    836:
1.63.2.1! christos  837: #else  /* XENPV */
        !           838:
        !           839:        .section .rodata
        !           840:
        !           841: INTRSTUB_ARRAY_16(legacy)
        !           842:
        !           843: #if NIOAPIC > 0
        !           844: INTRSTUB_ARRAY_32(ioapic_edge)
        !           845: INTRSTUB_ARRAY_32(ioapic_level)
        !           846:
        !           847: INTRSTUB_ARRAY_32(x2apic_edge)
        !           848: INTRSTUB_ARRAY_32(x2apic_level)
        !           849: #endif
        !           850: #endif /* !XENPV */

CVSweb <webmaster@jp.NetBSD.org>