Created
September 22, 2019 08:36
-
-
Save nonakap/05fb8d73a58cfe189128bb1f837d8203 to your computer and use it in GitHub Desktop.
NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56. Based on http://mail-index.netbsd.org/port-amd64/2018/12/14/msg002817.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/sys/arch/amd64/amd64/amd64_trap.S b/sys/arch/amd64/amd64/amd64_trap.S | |
| index 3f510e98ab2..2b61e394630 100644 | |
| --- a/sys/arch/amd64/amd64/amd64_trap.S | |
| +++ b/sys/arch/amd64/amd64/amd64_trap.S | |
| @@ -344,7 +344,7 @@ IDTVEC(trap07) | |
| ZTRAP_NJ(T_DNA) | |
| INTRENTRY | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| movq %rsp,%rdi | |
| call _C_LABEL(fpudna) | |
| @@ -436,7 +436,7 @@ IDTVEC(trap15) | |
| ZTRAP_NJ(T_ASTFLT) | |
| INTRENTRY | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| jmp .Lalltraps_checkusr | |
| IDTVEC_END(trap15) | |
| @@ -446,7 +446,7 @@ IDTVEC(trap16) | |
| .Ldo_fputrap: | |
| INTRENTRY | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| movq %rsp,%rdi | |
| call _C_LABEL(fputrap) | |
| @@ -497,7 +497,7 @@ IDTVEC(intrspurious) | |
| ZTRAP_NJ(T_ASTFLT) | |
| INTRENTRY | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| jmp .Lalltraps_checkusr | |
| IDTVEC_END(intrspurious) | |
| @@ -647,7 +647,7 @@ ENTRY(alltraps) | |
| calltrap: | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| movq %rsp,%rdi | |
| incq CPUVAR(NTRAP) | |
| @@ -675,7 +675,7 @@ calltrap: | |
| 6: | |
| #ifdef DIAGNOSTIC | |
| - cmpl CPUVAR(ILEVEL),%ebx | |
| + cmpb CPUVAR(ILEVEL),%bl | |
| jne .Lspl_error | |
| #endif | |
| INTRFASTEXIT | |
| @@ -688,7 +688,7 @@ calltrap: | |
| .Lspl_error: | |
| STI(si) | |
| movabsq $4f,%rdi | |
| - movl CPUVAR(ILEVEL),%esi | |
| + movzbl CPUVAR(ILEVEL),%esi | |
| movl %ebx,%edx | |
| xorq %rax,%rax | |
| call _C_LABEL(printf) | |
| diff --git a/sys/arch/amd64/amd64/genassym.cf b/sys/arch/amd64/amd64/genassym.cf | |
| index 168cae5cb8b..aca4c7af253 100644 | |
| --- a/sys/arch/amd64/amd64/genassym.cf | |
| +++ b/sys/arch/amd64/amd64/genassym.cf | |
| @@ -247,10 +247,10 @@ define CPU_INFO_CURPRIORITY offsetof(struct cpu_info, ci_schedstate.spc_curprior | |
| define CPU_INFO_FPCURLWP offsetof(struct cpu_info, ci_fpcurlwp) | |
| define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt) | |
| -define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel) | |
| +define CPU_INFO_ILEVEL (offsetof(struct cpu_info, ci_istate) + 7) | |
| define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth) | |
| if !defined(XENPV) | |
| -define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending) | |
| +define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_istate) | |
| define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask) | |
| define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask) | |
| define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources) | |
| diff --git a/sys/arch/amd64/amd64/lock_stubs.S b/sys/arch/amd64/amd64/lock_stubs.S | |
| index f303df387bb..1e5dfef4899 100644 | |
| --- a/sys/arch/amd64/amd64/lock_stubs.S | |
| +++ b/sys/arch/amd64/amd64/lock_stubs.S | |
| @@ -91,11 +91,11 @@ END(mutex_exit) | |
| */ | |
| ENTRY(mutex_spin_enter) | |
| movl $1, %eax | |
| - movl CPUVAR(ILEVEL), %esi | |
| + movzbl CPUVAR(ILEVEL), %esi | |
| movzbl MTX_IPL(%rdi), %ecx /* new SPL */ | |
| cmpl %ecx, %esi /* higher? */ | |
| cmovgl %esi, %ecx | |
| - movl %ecx, CPUVAR(ILEVEL) /* splraiseipl() */ | |
| + movb %cl, CPUVAR(ILEVEL) /* splraiseipl() */ | |
| subl %eax, CPUVAR(MTX_COUNT) /* decl doesnt set CF */ | |
| cmovncl CPUVAR(MTX_OLDSPL), %esi | |
| movl %esi, CPUVAR(MTX_OLDSPL) | |
| @@ -124,12 +124,12 @@ ENTRY(mutex_spin_exit) | |
| movl CPU_INFO_MTX_OLDSPL(%r8), %edi | |
| incl CPU_INFO_MTX_COUNT(%r8) | |
| jnz 1f | |
| - cmpl CPU_INFO_ILEVEL(%r8), %edi | |
| + cmpb CPU_INFO_ILEVEL(%r8), %dil | |
| jae 1f | |
| #if !defined(XENPV) | |
| - movl CPU_INFO_IUNMASK(%r8,%rdi,4), %esi | |
| + movq CPU_INFO_IUNMASK(%r8,%rdi,8), %rsi | |
| CLI(ax) | |
| - testl CPU_INFO_IPENDING(%r8), %esi | |
| + testq CPU_INFO_IPENDING(%r8), %rsi | |
| jnz _C_LABEL(Xspllower) | |
| #endif | |
| #if defined(XEN) | |
| @@ -138,29 +138,35 @@ ENTRY(mutex_spin_exit) | |
| testl CPU_INFO_XPENDING(%r8), %esi | |
| jnz _C_LABEL(Xspllower) | |
| #endif | |
| - movl %edi, CPU_INFO_ILEVEL(%r8) | |
| + movb %dil, CPU_INFO_ILEVEL(%r8) | |
| STI(ax) | |
| 1: rep /* double byte ret as branch */ | |
| ret /* target: see AMD docs */ | |
| -#else /* DIAGNOSTIC */ | |
| +#else /* !DIAGNOSTIC */ | |
| movq CPUVAR(SELF), %rsi | |
| movb $0x00, MTX_LOCK(%rdi) | |
| movl CPU_INFO_MTX_OLDSPL(%rsi), %ecx | |
| incl CPU_INFO_MTX_COUNT(%rsi) | |
| - movl CPU_INFO_ILEVEL(%rsi),%edx | |
| + movzbl CPU_INFO_ILEVEL(%rsi),%edx | |
| cmovnzl %edx,%ecx | |
| - pushq %rbx | |
| cmpl %edx,%ecx /* new level is lower? */ | |
| jae 2f | |
| + xorq %rdi,%rdi /* rdi: ci_ipending mask */ | |
| + notq %rdi | |
| + shrq $8,%rdi | |
| + movq %rcx,%r9 /* r9: shifted new level */ | |
| + shlq $56,%r9 | |
| 1: | |
| #if !defined(XENPV) | |
| - movl CPU_INFO_IPENDING(%rsi),%eax | |
| - testl %eax,CPU_INFO_IUNMASK(%rsi,%rcx,4)/* deferred interrupts? */ | |
| + movq CPU_INFO_IPENDING(%rsi),%rax | |
| + testq %rax,CPU_INFO_IUNMASK(%rsi,%rcx,8)/* deferred interrupts? */ | |
| jnz 3f | |
| - movl %eax,%ebx | |
| - cmpxchg8b CPU_INFO_ISTATE(%rsi) /* swap in new ilevel */ | |
| + movq %rax,%r8 | |
| + andq %rdi,%r8 | |
| + orq %r9,%r8 | |
| + cmpxchgq %r8,CPU_INFO_ISTATE(%rsi) /* swap in new ilevel */ | |
| jnz 4f | |
| #endif | |
| #if defined(XEN) | |
| @@ -168,14 +174,12 @@ ENTRY(mutex_spin_exit) | |
| testl %eax,CPU_INFO_XUNMASK(%rsi,%rcx,4)/* deferred interrupts? */ | |
| jnz 3f | |
| movl %edx, %eax | |
| - cmpxchgl %ecx, CPU_INFO_ILEVEL(%rsi) | |
| + cmpxchgb %cl,CPU_INFO_ILEVEL(%rsi) | |
| jnz 4f | |
| #endif | |
| 2: | |
| - popq %rbx | |
| ret | |
| 3: | |
| - popq %rbx | |
| movl %ecx, %edi | |
| jmp _C_LABEL(Xspllower) | |
| 4: | |
| diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S | |
| index 1bae0273068..c6799bc9afd 100644 | |
| --- a/sys/arch/amd64/amd64/locore.S | |
| +++ b/sys/arch/amd64/amd64/locore.S | |
| @@ -1178,7 +1178,7 @@ ENTRY(cpu_switchto) | |
| * IPL_SCHED prevents from FPU interrupt altering the LWP's saved cr0. | |
| */ | |
| #ifndef XENPV | |
| - movl $IPL_HIGH,CPUVAR(ILEVEL) | |
| + movb $IPL_HIGH,CPUVAR(ILEVEL) | |
| movl PCB_CR0(%r14),%ecx /* has CR0_TS clear */ | |
| movq %cr0,%rdx | |
| @@ -1304,7 +1304,7 @@ ENTRY(handle_syscall) | |
| jnz 9f | |
| #ifdef DIAGNOSTIC | |
| - cmpl $IPL_NONE,CPUVAR(ILEVEL) | |
| + cmpb $IPL_NONE,CPUVAR(ILEVEL) | |
| jne .Lspl_error | |
| #endif | |
| @@ -1324,7 +1324,7 @@ ENTRY(handle_syscall) | |
| #ifdef DIAGNOSTIC | |
| .Lspl_error: | |
| movabsq $4f,%rdi | |
| - movl CPUVAR(ILEVEL),%esi | |
| + movzbl CPUVAR(ILEVEL),%esi | |
| call _C_LABEL(panic) | |
| 4: .asciz "spl not lowered on syscall, ilevel=%x" | |
| #endif | |
| diff --git a/sys/arch/amd64/amd64/spl.S b/sys/arch/amd64/amd64/spl.S | |
| index eb4715af052..a0a6e7b77a5 100644 | |
| --- a/sys/arch/amd64/amd64/spl.S | |
| +++ b/sys/arch/amd64/amd64/spl.S | |
| @@ -82,10 +82,10 @@ | |
| * int splraise(int s); | |
| */ | |
| ENTRY(splraise) | |
| - movl CPUVAR(ILEVEL),%eax | |
| + movzbl CPUVAR(ILEVEL),%eax | |
| cmpl %edi,%eax | |
| cmoval %eax,%edi | |
| - movl %edi,CPUVAR(ILEVEL) | |
| + movb %dil,CPUVAR(ILEVEL) | |
| ret | |
| END(splraise) | |
| @@ -110,7 +110,7 @@ IDTVEC(softintr) | |
| pushq %r14 | |
| pushq %r15 | |
| - movl $IPL_HIGH,CPUVAR(ILEVEL) | |
| + movb $IPL_HIGH,CPUVAR(ILEVEL) | |
| movq CPUVAR(CURLWP),%r15 | |
| movq IS_LWP(%rax),%rdi /* switch to handler LWP */ | |
| movq L_PCB(%rdi),%rdx | |
| @@ -173,7 +173,9 @@ END(softintr_ret) | |
| * Software interrupt registration. | |
| */ | |
| ENTRY(softint_trigger) | |
| - orl %edi,CPUVAR(IPENDING) /* atomic on local cpu */ | |
| + shlq $8,%rdi /* clear upper 8 bits */ | |
| + shrq $8,%rdi | |
| + orq %rdi,CPUVAR(IPENDING) /* atomic on local cpu */ | |
| ret | |
| END(softint_trigger) | |
| @@ -184,7 +186,7 @@ END(softint_trigger) | |
| * Handles preemption interrupts via Xspllower(). | |
| */ | |
| IDTVEC(recurse_preempt) | |
| - movl $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| + movb $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| sti | |
| xorq %rdi,%rdi | |
| call _C_LABEL(kpreempt) | |
| @@ -198,7 +200,7 @@ IDTVEC_END(recurse_preempt) | |
| * Handles preemption interrupts via Xdoreti(). | |
| */ | |
| IDTVEC(resume_preempt) | |
| - movl $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| + movb $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| sti | |
| testq $SEL_RPL,TF_CS(%rsp) | |
| jnz 1f | |
| @@ -222,14 +224,14 @@ IDTVEC_END(resume_preempt) | |
| * are disabled via eflags/IE. | |
| */ | |
| ENTRY(spllower) | |
| - cmpl CPUVAR(ILEVEL),%edi | |
| + cmpb CPUVAR(ILEVEL),%dil | |
| jae 1f | |
| - movl CPUVAR(IUNMASK)(,%rdi,4),%edx | |
| + movq CPUVAR(IUNMASK)(,%rdi,8),%rdx | |
| pushf | |
| cli | |
| - testl CPUVAR(IPENDING),%edx | |
| + testq CPUVAR(IPENDING),%rdx | |
| jnz 2f | |
| - movl %edi,CPUVAR(ILEVEL) | |
| + movb %dil,CPUVAR(ILEVEL) | |
| popf | |
| 1: | |
| ret | |
| @@ -238,41 +240,39 @@ ENTRY(spllower) | |
| popf | |
| jmp _C_LABEL(Xspllower) | |
| 3: | |
| - .space 16 | |
| + .space 24 | |
| .align 16 | |
| END(spllower) | |
| LABEL(spllower_end) | |
| /* | |
| * void cx8_spllower(int s); | |
| - * | |
| - * For cmpxchg8b, edx/ecx are the high words and eax/ebx the low. | |
| - * | |
| - * edx : eax = old level / old ipending | |
| - * ecx : ebx = new level / old ipending | |
| */ | |
| ENTRY(cx8_spllower) | |
| - movl CPUVAR(ILEVEL),%edx | |
| - movq %rbx,%r8 | |
| + movzbl CPUVAR(ILEVEL),%edx | |
| cmpl %edx,%edi /* new level is lower? */ | |
| jae 1f | |
| + xorq %rcx,%rcx /* rcx: ci_ipending mask */ | |
| + notq %rcx | |
| + shrq $8,%rcx | |
| + movq %rdi,%r9 /* r9: shifted new level */ | |
| + shlq $56,%r9 | |
| 0: | |
| - movl CPUVAR(IPENDING),%eax | |
| - movl %edi,%ecx | |
| - testl %eax,CPUVAR(IUNMASK)(,%rcx,4)/* deferred interrupts? */ | |
| - movl %eax,%ebx | |
| + movq CPUVAR(IPENDING),%rax | |
| + testq %rax,CPUVAR(IUNMASK)(,%rdi,8) /* deferred interrupts? */ | |
| /* | |
| * On the P4 this jump is cheaper than patching in junk | |
| * using cmov. Is cmpxchg expensive if it fails? | |
| */ | |
| jnz 2f | |
| - cmpxchg8b CPUVAR(ISTATE) /* swap in new ilevel */ | |
| + movq %rax,%r8 | |
| + andq %rcx,%r8 | |
| + orq %r9,%r8 | |
| + cmpxchgq %r8,CPUVAR(ISTATE) /* swap in new ilevel */ | |
| jnz 0b | |
| 1: | |
| - movq %r8,%rbx | |
| ret | |
| 2: | |
| - movq %r8,%rbx | |
| .type _C_LABEL(cx8_spllower_patch), @function | |
| LABEL(cx8_spllower_patch) | |
| jmp _C_LABEL(Xspllower) | |
| @@ -311,12 +311,12 @@ IDTVEC(spllower) | |
| leaq 1f(%rip),%r13 /* address to resume loop at */ | |
| 1: movl %ebx,%eax /* get cpl */ | |
| #if !defined(XENPV) | |
| - movl CPUVAR(IUNMASK)(,%rax,4),%eax | |
| + movq CPUVAR(IUNMASK)(,%rax,8),%rax | |
| CLI(si) | |
| - andl CPUVAR(IPENDING),%eax /* any non-masked bits left? */ | |
| + andq CPUVAR(IPENDING),%rax /* any non-masked bits left? */ | |
| jz 2f | |
| - bsrl %eax,%eax | |
| - btrl %eax,CPUVAR(IPENDING) | |
| + bsrq %rax,%rax | |
| + btrq %rax,CPUVAR(IPENDING) | |
| movq CPUVAR(ISOURCES)(,%rax,8),%rax | |
| jmp *IS_RECURSE(%rax) | |
| #endif | |
| @@ -332,7 +332,7 @@ IDTVEC(spllower) | |
| jmp *IS_RECURSE(%rax) | |
| #endif | |
| 3: | |
| - movl %ebx,CPUVAR(ILEVEL) | |
| + movb %bl,CPUVAR(ILEVEL) | |
| STI(si) | |
| popq %r12 | |
| popq %r13 | |
| @@ -355,12 +355,12 @@ IDTVEC(doreti) | |
| leaq 1f(%rip),%r13 | |
| 1: movl %ebx,%eax | |
| #if !defined(XENPV) | |
| - movl CPUVAR(IUNMASK)(,%rax,4),%eax | |
| + movq CPUVAR(IUNMASK)(,%rax,8),%rax | |
| CLI(si) | |
| - andl CPUVAR(IPENDING),%eax | |
| + andq CPUVAR(IPENDING),%rax | |
| jz 2f | |
| - bsrl %eax,%eax /* slow, but not worth optimizing */ | |
| - btrl %eax,CPUVAR(IPENDING) | |
| + bsrq %rax,%rax /* slow, but not worth optimizing */ | |
| + btrq %rax,CPUVAR(IPENDING) | |
| movq CPUVAR(ISOURCES)(,%rax,8),%rax | |
| jmp *IS_RESUME(%rax) | |
| #endif | |
| @@ -376,7 +376,7 @@ IDTVEC(doreti) | |
| jmp *IS_RESUME(%rax) | |
| #endif | |
| 3: /* Check for ASTs on exit to user mode. */ | |
| - movl %ebx,CPUVAR(ILEVEL) | |
| + movb %bl,CPUVAR(ILEVEL) | |
| 5: | |
| testb $SEL_RPL,TF_CS(%rsp) | |
| jz 6f | |
| diff --git a/sys/arch/amd64/amd64/vector.S b/sys/arch/amd64/amd64/vector.S | |
| index 2ef3a7ba3b0..2c0fe556d11 100644 | |
| --- a/sys/arch/amd64/amd64/vector.S | |
| +++ b/sys/arch/amd64/amd64/vector.S | |
| @@ -122,7 +122,7 @@ IDTVEC(handle_x2apic_ipi) | |
| xorl %eax,%eax | |
| xorl %edx,%edx | |
| wrmsr | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_HIGH,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -130,7 +130,7 @@ IDTVEC_END(handle_x2apic_ipi) | |
| IDTVEC(handle_lapic_ipi) | |
| movq _C_LABEL(local_apic_va),%rbx | |
| movl $0,LAPIC_EOI(%rbx) | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_HIGH,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -138,13 +138,13 @@ IDTVEC_END(handle_lapic_ipi) | |
| IDTVEC(resume_lapic_ipi) | |
| 1: | |
| incl CPUVAR(IDEPTH) | |
| - movl $IPL_HIGH,CPUVAR(ILEVEL) | |
| + movb $IPL_HIGH,CPUVAR(ILEVEL) | |
| sti | |
| pushq %rbx | |
| call _C_LABEL(x86_ipi_handler) | |
| jmp _C_LABEL(Xdoreti) | |
| 2: | |
| - orl $(1 << LIR_IPI),CPUVAR(IPENDING) | |
| + btsq $LIR_IPI,CPUVAR(IPENDING) | |
| INTRFASTEXIT | |
| IDTVEC_END(resume_lapic_ipi) | |
| @@ -222,7 +222,7 @@ IDTVEC(handle_x2apic_ltimer) | |
| xorl %eax,%eax | |
| xorl %edx,%edx | |
| wrmsr | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_CLOCK,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -230,7 +230,7 @@ IDTVEC_END(handle_x2apic_ltimer) | |
| IDTVEC(handle_lapic_ltimer) | |
| movq _C_LABEL(local_apic_va),%rbx | |
| movl $0,LAPIC_EOI(%rbx) | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_CLOCK,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -238,7 +238,7 @@ IDTVEC_END(handle_lapic_ltimer) | |
| IDTVEC(resume_lapic_ltimer) | |
| 1: | |
| incl CPUVAR(IDEPTH) | |
| - movl $IPL_CLOCK,CPUVAR(ILEVEL) | |
| + movb $IPL_CLOCK,CPUVAR(ILEVEL) | |
| sti | |
| pushq %rbx | |
| movq %rsp,%rsi | |
| @@ -246,7 +246,7 @@ IDTVEC(resume_lapic_ltimer) | |
| call _C_LABEL(lapic_clockintr) | |
| jmp _C_LABEL(Xdoreti) | |
| 2: | |
| - orl $(1 << LIR_TIMER),CPUVAR(IPENDING) | |
| + btsq $LIR_TIMER,CPUVAR(IPENDING) | |
| INTRFASTEXIT | |
| IDTVEC_END(resume_lapic_ltimer) | |
| @@ -278,7 +278,7 @@ IDTVEC(recurse_hyperv_hypercall) | |
| jmp 1f | |
| IDTVEC_END(recurse_hyperv_hypercall) | |
| IDTVEC(handle_hyperv_hypercall) | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_NET,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -286,14 +286,14 @@ IDTVEC_END(handle_hyperv_hypercall) | |
| IDTVEC(resume_hyperv_hypercall) | |
| 1: | |
| incl CPUVAR(IDEPTH) | |
| - movl $IPL_NET,CPUVAR(ILEVEL) | |
| + movb $IPL_NET,CPUVAR(ILEVEL) | |
| sti | |
| pushq %rbx | |
| movq %rsp,%rsi | |
| call _C_LABEL(hyperv_hypercall_intr) | |
| jmp _C_LABEL(Xdoreti) | |
| 2: | |
| - orl $(1 << LIR_HV),CPUVAR(IPENDING) | |
| + btsq $LIR_HV,CPUVAR(IPENDING) | |
| INTRFASTEXIT | |
| IDTVEC_END(resume_hyperv_hypercall) | |
| @@ -376,14 +376,14 @@ IDTVEC(handle_ ## name ## num) ;\ | |
| testq %r14,%r14 ;\ | |
| jz 9f /* stray */ ;\ | |
| movl IS_MAXLEVEL(%r14),%ebx ;\ | |
| - movl CPUVAR(ILEVEL),%r13d ;\ | |
| + movzbl CPUVAR(ILEVEL),%r13d ;\ | |
| cmpl %ebx,%r13d ;\ | |
| jae 10f /* currently masked; hold it */ ;\ | |
| incq CPUVAR(NINTR) /* statistical info */ ;\ | |
| incq IS_EVCNT(%r14) ;\ | |
| 1: \ | |
| pushq %r13 /* save for Xdoreti */ ;\ | |
| - movl %ebx,CPUVAR(ILEVEL) ;\ | |
| + movb %bl,CPUVAR(ILEVEL) ;\ | |
| sti ;\ | |
| incl CPUVAR(IDEPTH) ;\ | |
| movq IS_HANDLERS(%r14),%rbx ;\ | |
| @@ -393,7 +393,7 @@ IDTVEC(handle_ ## name ## num) ;\ | |
| jle 7f ;\ | |
| movq %rsp,%rsi ;\ | |
| movq IH_ARG(%rbx),%rdi ;\ | |
| - movl %r12d,CPUVAR(ILEVEL) ;\ | |
| + movb %r12b,CPUVAR(ILEVEL) ;\ | |
| call *IH_FUN(%rbx) /* call it */ ;\ | |
| movq IH_NEXT(%rbx),%rbx /* next handler in chain */ ;\ | |
| testq %rbx,%rbx ;\ | |
| @@ -406,14 +406,14 @@ IDTVEC(handle_ ## name ## num) ;\ | |
| jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ | |
| 7: \ | |
| cli ;\ | |
| - orl $(1 << num),CPUVAR(IPENDING) ;\ | |
| + btsq $num,CPUVAR(IPENDING) ;\ | |
| level_mask(num) ;\ | |
| late_ack(num) ;\ | |
| sti ;\ | |
| jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ | |
| 10: \ | |
| cli ;\ | |
| - orl $(1 << num),CPUVAR(IPENDING) ;\ | |
| + btsq $num,CPUVAR(IPENDING) ;\ | |
| level_mask(num) ;\ | |
| late_ack(num) ;\ | |
| INTRFASTEXIT ;\ | |
| @@ -471,137 +471,69 @@ INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, | |
| #if NIOAPIC > 0 | |
| -INTRSTUB(ioapic_edge,0,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,1,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,2,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,3,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,4,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,5,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,6,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,7,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,8,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,9,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,10,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,11,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,12,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,13,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,14,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,15,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,16,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,17,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,18,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,19,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,20,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,21,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,22,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,23,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,24,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,25,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,26,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,27,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,28,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,29,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,30,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,31,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| - | |
| -INTRSTUB(ioapic_level,0,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,1,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,2,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,3,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,4,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,5,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,6,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,7,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,8,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,9,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,10,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,11,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,12,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,13,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,14,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,15,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,16,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,17,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,18,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,19,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,20,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,21,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,22,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,23,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,24,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,25,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,26,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,27,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,28,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,29,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,30,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,31,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| - | |
| -INTRSTUB(x2apic_edge,0,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,1,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,2,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,3,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,4,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,5,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,6,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,7,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,8,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,9,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,10,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,11,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,12,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,13,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,14,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,15,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,16,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,17,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,18,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,19,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,20,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,21,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,22,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,23,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,24,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,25,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,26,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,27,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,28,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,29,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,30,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,31,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| - | |
| -INTRSTUB(x2apic_level,0,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,1,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,2,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,3,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,4,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,5,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,6,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,7,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,8,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,9,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,10,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,11,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,12,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,13,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,14,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,15,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,16,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,17,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,18,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,19,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,20,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,21,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,22,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,23,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,24,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,25,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,26,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,27,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,28,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,29,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,30,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,31,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| +#define INTRSTUB_56(name,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,0,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,1,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,2,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,3,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,4,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,5,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,6,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,7,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,8,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,9,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,10,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,11,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,12,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,13,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,14,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,15,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,16,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,17,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,18,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,19,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,20,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,21,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,22,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,23,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,24,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,25,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,26,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,27,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,28,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,29,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,30,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,31,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,32,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,33,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,34,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,35,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,36,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,37,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,38,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,39,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,40,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,41,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,42,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,43,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,44,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,45,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,46,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,47,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,48,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,49,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,50,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,51,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,52,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,53,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,54,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,55,early_ack,late_ack,mask,unmask,level_mask) | |
| + | |
| +INTRSTUB_56(ioapic_edge,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| +INTRSTUB_56(ioapic_level,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| + | |
| +INTRSTUB_56(x2apic_edge,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| +INTRSTUB_56(x2apic_level,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| #endif | |
| @@ -637,9 +569,9 @@ LABEL(name ## _stubs) ; \ | |
| END(name ## _stubs) | |
| /* | |
| - * Create an array of structs intrstub (32 entries). | |
| + * Create an array of structs intrstub (56 entries). | |
| */ | |
| -#define INTRSTUB_ARRAY_32(name) ; \ | |
| +#define INTRSTUB_ARRAY_56(name) ; \ | |
| .type _C_LABEL(name ## _stubs), @object ; \ | |
| LABEL(name ## _stubs) ; \ | |
| INTRSTUB_ENTRY(name ## 0) ; \ | |
| @@ -674,6 +606,30 @@ LABEL(name ## _stubs) ; \ | |
| INTRSTUB_ENTRY(name ## 29) ; \ | |
| INTRSTUB_ENTRY(name ## 30) ; \ | |
| INTRSTUB_ENTRY(name ## 31) ; \ | |
| + INTRSTUB_ENTRY(name ## 32) ; \ | |
| + INTRSTUB_ENTRY(name ## 33) ; \ | |
| + INTRSTUB_ENTRY(name ## 34) ; \ | |
| + INTRSTUB_ENTRY(name ## 35) ; \ | |
| + INTRSTUB_ENTRY(name ## 36) ; \ | |
| + INTRSTUB_ENTRY(name ## 37) ; \ | |
| + INTRSTUB_ENTRY(name ## 38) ; \ | |
| + INTRSTUB_ENTRY(name ## 39) ; \ | |
| + INTRSTUB_ENTRY(name ## 40) ; \ | |
| + INTRSTUB_ENTRY(name ## 41) ; \ | |
| + INTRSTUB_ENTRY(name ## 42) ; \ | |
| + INTRSTUB_ENTRY(name ## 43) ; \ | |
| + INTRSTUB_ENTRY(name ## 44) ; \ | |
| + INTRSTUB_ENTRY(name ## 45) ; \ | |
| + INTRSTUB_ENTRY(name ## 46) ; \ | |
| + INTRSTUB_ENTRY(name ## 47) ; \ | |
| + INTRSTUB_ENTRY(name ## 48) ; \ | |
| + INTRSTUB_ENTRY(name ## 49) ; \ | |
| + INTRSTUB_ENTRY(name ## 50) ; \ | |
| + INTRSTUB_ENTRY(name ## 51) ; \ | |
| + INTRSTUB_ENTRY(name ## 52) ; \ | |
| + INTRSTUB_ENTRY(name ## 53) ; \ | |
| + INTRSTUB_ENTRY(name ## 54) ; \ | |
| + INTRSTUB_ENTRY(name ## 55) ; \ | |
| END(name ## _stubs) | |
| #endif /* !XENPV */ | |
| @@ -692,7 +648,7 @@ IDTVEC(resume_ ## name ## num) \ | |
| movq CPUVAR(XSOURCES) + (num) * 8,%r14 ;\ | |
| 1: \ | |
| pushq %r13 ;\ | |
| - movl $num,CPUVAR(ILEVEL) ;\ | |
| + movb $num,CPUVAR(ILEVEL) ;\ | |
| STI(si) ;\ | |
| incl CPUVAR(IDEPTH) ;\ | |
| movq IS_HANDLERS(%r14),%rbx ;\ | |
| @@ -841,10 +797,10 @@ END(failsafe_callback) | |
| INTRSTUB_ARRAY_16(legacy) | |
| #if NIOAPIC > 0 | |
| -INTRSTUB_ARRAY_32(ioapic_edge) | |
| -INTRSTUB_ARRAY_32(ioapic_level) | |
| +INTRSTUB_ARRAY_56(ioapic_edge) | |
| +INTRSTUB_ARRAY_56(ioapic_level) | |
| -INTRSTUB_ARRAY_32(x2apic_edge) | |
| -INTRSTUB_ARRAY_32(x2apic_level) | |
| +INTRSTUB_ARRAY_56(x2apic_edge) | |
| +INTRSTUB_ARRAY_56(x2apic_level) | |
| #endif | |
| #endif /* !XENPV */ | |
| diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf | |
| index 479c5319fc2..0316d647279 100644 | |
| --- a/sys/arch/i386/i386/genassym.cf | |
| +++ b/sys/arch/i386/i386/genassym.cf | |
| @@ -270,12 +270,12 @@ define CPU_INFO_SIGNATURE offsetof(struct cpu_info, ci_signature) | |
| define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt) | |
| if !defined(XENPV) | |
| -define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending) | |
| +define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_istate) | |
| define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask) | |
| define CPU_INFO_ISOURCES offsetof(struct cpu_info, ci_isources) | |
| define CPU_INFO_IUNMASK offsetof(struct cpu_info, ci_iunmask) | |
| endif | |
| -define CPU_INFO_ILEVEL offsetof(struct cpu_info, ci_ilevel) | |
| +define CPU_INFO_ILEVEL (offsetof(struct cpu_info, ci_istate) + 7) | |
| define CPU_INFO_IDEPTH offsetof(struct cpu_info, ci_idepth) | |
| define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) | |
| define CPU_INFO_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl) | |
| diff --git a/sys/arch/i386/i386/i386_trap.S b/sys/arch/i386/i386/i386_trap.S | |
| index 70e8f118ef6..628815c98e5 100644 | |
| --- a/sys/arch/i386/i386/i386_trap.S | |
| +++ b/sys/arch/i386/i386/i386_trap.S | |
| @@ -215,7 +215,7 @@ IDTVEC(trap07) | |
| pushl $T_DNA | |
| INTRENTRY | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| pushl %esp | |
| call _C_LABEL(fpudna) | |
| @@ -280,7 +280,7 @@ IDTVEC(trap0f) | |
| INTRENTRY | |
| STI(%eax) | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| jmp _C_LABEL(trapreturn) | |
| IDTVEC_END(trap0f) | |
| @@ -296,7 +296,7 @@ IDTVEC(trap10) | |
| pushl $T_ARITHTRAP | |
| .Ldo_fputrap: | |
| INTRENTRY | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| pushl %esp | |
| addl $1,CPUVAR(NTRAP) /* statistical info */ | |
| adcl $0,CPUVAR(NTRAP)+4 | |
| @@ -403,7 +403,7 @@ ENTRY(alltraps) | |
| STI(%eax) | |
| calltrap: | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| #endif | |
| addl $1,CPUVAR(NTRAP) /* statistical info */ | |
| adcl $0,CPUVAR(NTRAP)+4 | |
| @@ -438,7 +438,7 @@ _C_LABEL(trapreturn): .globl trapreturn | |
| jz 6f | |
| /* process pending interrupts */ | |
| CLI(%eax) | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| movl $.Lalltraps_resume,%esi /* address to resume loop at */ | |
| .Lalltraps_resume: | |
| movl %ebx,%eax /* get cpl */ | |
| @@ -449,13 +449,13 @@ _C_LABEL(trapreturn): .globl trapreturn | |
| btrl %eax,CPUVAR(XPENDING) | |
| movl CPUVAR(XSOURCES)(,%eax,4),%eax | |
| jmp *IS_RESUME(%eax) | |
| -7: movl %ebx,CPUVAR(ILEVEL) /* restore cpl */ | |
| +7: movb %bl,CPUVAR(ILEVEL) /* restore cpl */ | |
| jmp _C_LABEL(trapreturn) | |
| #endif /* XEN */ | |
| #ifndef DIAGNOSTIC | |
| 6: INTRFASTEXIT | |
| #else | |
| -6: cmpl CPUVAR(ILEVEL),%ebx | |
| +6: cmpb CPUVAR(ILEVEL),%bl | |
| jne 3f | |
| INTRFASTEXIT | |
| 3: STI(%eax) | |
| diff --git a/sys/arch/i386/i386/lock_stubs.S b/sys/arch/i386/i386/lock_stubs.S | |
| index 80fa3c87f0b..c5f46c11ce4 100644 | |
| --- a/sys/arch/i386/i386/lock_stubs.S | |
| +++ b/sys/arch/i386/i386/lock_stubs.S | |
| @@ -263,12 +263,15 @@ ENTRY(mutex_spin_exit) | |
| incl CPUVAR(MTX_COUNT) | |
| movb $0, MTX_LOCK(%edx) /* zero */ | |
| jnz 1f | |
| - movl %fs:CPU_INFO_IUNMASK(,%ecx,4), %edx | |
| + movl CPUVAR(IUNMASK)(,%ecx,8), %edx | |
| + movl CPUVAR(IUNMASK)+4(,%ecx,8), %eax | |
| cli | |
| testl CPUVAR(IPENDING), %edx | |
| movl %ecx, 4(%esp) | |
| jnz _C_LABEL(Xspllower) /* does sti */ | |
| - movl %ecx, CPUVAR(ILEVEL) | |
| + testl CPUVAR(IPENDING)+4, %eax | |
| + jnz _C_LABEL(Xspllower) /* does sti */ | |
| + movb %cl, CPUVAR(ILEVEL) | |
| sti | |
| 1: ret | |
| .space 32 | |
| @@ -284,20 +287,36 @@ ENTRY(i686_mutex_spin_exit) | |
| mov 4(%esp),%edx | |
| movl CPUVAR(MTX_OLDSPL), %ecx | |
| incl CPUVAR(MTX_COUNT) | |
| - movb %ch, MTX_LOCK(%edx) /* zero */ | |
| + movb $0, MTX_LOCK(%edx) /* zero */ | |
| jnz 1f | |
| pushl %ebx | |
| + pushl %esi | |
| + pushl %edi | |
| + movl %ecx, %esi | |
| + movl %ecx, %edi | |
| + shll $24, %edi | |
| 0: | |
| movl CPUVAR(IPENDING), %eax | |
| - testl %eax, %fs:CPU_INFO_IUNMASK(,%ecx,4) | |
| + testl %eax, CPUVAR(IUNMASK)(,%esi,8) | |
| + jnz 2f | |
| + movl CPUVAR(IPENDING)+4, %edx | |
| + testl %edx, CPUVAR(IUNMASK)+4(,%esi,8) | |
| jnz 2f | |
| movl %eax, %ebx | |
| + movl %edx, %ecx | |
| + andl $0x00ffffff, %ecx | |
| + orl %edi, %ecx | |
| cmpxchg8b CPUVAR(ISTATE) /* swap in new ilevel */ | |
| jnz 0b | |
| + popl %edi | |
| + popl %esi | |
| popl %ebx | |
| 1: | |
| ret | |
| 2: | |
| + movl %esi,%ecx | |
| + popl %edi | |
| + popl %esi | |
| popl %ebx | |
| movl %ecx,4(%esp) | |
| LABEL(i686_mutex_spin_exit_patch) | |
| diff --git a/sys/arch/i386/i386/locore.S b/sys/arch/i386/i386/locore.S | |
| index d687efd851b..1c3495f8c62 100644 | |
| --- a/sys/arch/i386/i386/locore.S | |
| +++ b/sys/arch/i386/i386/locore.S | |
| @@ -1081,9 +1081,10 @@ ENTRY(cpu_switchto) | |
| pushl %edi | |
| #if defined(DIAGNOSTIC) && !defined(XENPV) | |
| - cmpl $IPL_SCHED,CPUVAR(ILEVEL) | |
| + movzbl CPUVAR(ILEVEL),%eax | |
| + cmpl $IPL_SCHED,%eax | |
| jbe 0f | |
| - pushl CPUVAR(ILEVEL) | |
| + pushl %eax | |
| pushl $.Lstr | |
| call _C_LABEL(panic) | |
| addl $8,%esp | |
| @@ -1200,7 +1201,7 @@ no_RAS: | |
| call _C_LABEL(i386_tls_switch) | |
| addl $4,%esp | |
| #else | |
| - movl $IPL_HIGH,CPUVAR(ILEVEL) | |
| + movb $IPL_HIGH,CPUVAR(ILEVEL) | |
| movl PCB_CR0(%ebx),%ecx /* has CR0_TS clear */ | |
| movl %cr0,%edx | |
| @@ -1268,7 +1269,7 @@ IDTVEC(syscall) | |
| INTRENTRY | |
| STI(%eax) | |
| #ifdef DIAGNOSTIC | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| testl %ebx,%ebx | |
| jz 1f | |
| pushl $5f | |
| @@ -1301,7 +1302,7 @@ IDTVEC(syscall) | |
| jz 14f | |
| /* process pending interrupts */ | |
| CLI(%eax) | |
| - movl CPUVAR(ILEVEL), %ebx | |
| + movzbl CPUVAR(ILEVEL), %ebx | |
| movl $.Lsyscall_resume, %esi /* address to resume loop at */ | |
| .Lsyscall_resume: | |
| movl %ebx,%eax /* get cpl */ | |
| @@ -1312,14 +1313,14 @@ IDTVEC(syscall) | |
| btrl %eax,CPUVAR(XPENDING) | |
| movl CPUVAR(XSOURCES)(,%eax,4),%eax | |
| jmp *IS_RESUME(%eax) | |
| -17: movl %ebx, CPUVAR(ILEVEL) /* restore cpl */ | |
| +17: movb %bl, CPUVAR(ILEVEL) /* restore cpl */ | |
| jmp .Lsyscall_checkast | |
| 14: | |
| #endif /* XEN */ | |
| #ifndef DIAGNOSTIC | |
| INTRFASTEXIT | |
| #else /* DIAGNOSTIC */ | |
| - cmpl $IPL_NONE,CPUVAR(ILEVEL) | |
| + cmpb $IPL_NONE,CPUVAR(ILEVEL) | |
| jne 3f | |
| INTRFASTEXIT | |
| 3: STI(%eax) | |
| diff --git a/sys/arch/i386/i386/spl.S b/sys/arch/i386/i386/spl.S | |
| index 7c675d01b92..78a03e155b9 100644 | |
| --- a/sys/arch/i386/i386/spl.S | |
| +++ b/sys/arch/i386/i386/spl.S | |
| @@ -49,10 +49,10 @@ __KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.47 2019/02/11 14:59:32 cherry Exp $"); | |
| */ | |
| ENTRY(splraise) | |
| movl 4(%esp),%edx | |
| - movl CPUVAR(ILEVEL),%eax | |
| + movzbl CPUVAR(ILEVEL),%eax | |
| cmpl %edx,%eax | |
| ja 1f | |
| - movl %edx,CPUVAR(ILEVEL) | |
| + movb %dl,CPUVAR(ILEVEL) | |
| 1: | |
| #ifdef SPLDEBUG | |
| pushl %ebp | |
| @@ -87,20 +87,25 @@ ENTRY(spllower) | |
| popl %ebp | |
| #endif /* SPLDEBUG */ | |
| movl 4(%esp),%ecx | |
| - cmpl CPUVAR(ILEVEL),%ecx | |
| + cmpb CPUVAR(ILEVEL),%cl | |
| jae 1f | |
| - movl CPUVAR(IUNMASK)(,%ecx,4),%edx | |
| + movl CPUVAR(IUNMASK)(,%ecx,8),%edx | |
| + movl CPUVAR(IUNMASK)+4(,%ecx,8),%eax | |
| pushf | |
| cli | |
| testl CPUVAR(IPENDING),%edx | |
| jnz 2f | |
| - movl %ecx,CPUVAR(ILEVEL) | |
| + testl CPUVAR(IPENDING)+4,%eax | |
| + jnz 2f | |
| + movb %cl,CPUVAR(ILEVEL) | |
| popf | |
| 1: | |
| ret | |
| 2: | |
| popf | |
| jmp _C_LABEL(Xspllower) | |
| + | |
| + .space 32 | |
| .align 32 | |
| LABEL(spllower_end) | |
| END(spllower) | |
| @@ -115,26 +120,41 @@ END(spllower) | |
| * | |
| * For cmpxchg8b, edx/ecx are the high words and eax/ebx the low. | |
| * | |
| - * edx : eax = old level / old ipending | |
| - * ecx : ebx = new level / old ipending | |
| + * edx : eax = old level + high 24 bit old ipending / low 32 bit old ipending | |
| + * ecx : ebx = new level + high 24 bit old ipending / low 32 bit old ipending | |
| */ | |
| ENTRY(cx8_spllower) | |
| movl 4(%esp),%ecx | |
| - movl CPUVAR(ILEVEL),%edx | |
| + movzbl CPUVAR(ILEVEL),%edx | |
| cmpl %edx,%ecx /* new level is lower? */ | |
| - pushl %ebx | |
| jae 1f | |
| + pushl %ebx | |
| + pushl %esi | |
| + pushl %edi | |
| + movl %ecx,%esi | |
| + movl %ecx,%edi | |
| + shll $24,%edi | |
| 0: | |
| movl CPUVAR(IPENDING),%eax | |
| - testl %eax,CPUVAR(IUNMASK)(,%ecx,4) /* deferred interrupts? */ | |
| - movl %eax,%ebx | |
| + testl %eax,CPUVAR(IUNMASK)(,%esi,8) /* deferred interrupts? */ | |
| + jnz 2f | |
| + movl CPUVAR(IPENDING)+4,%edx | |
| + testl %edx,CPUVAR(IUNMASK)+4(,%esi,8) | |
| jnz 2f | |
| + movl %eax,%ebx | |
| + movl %edx,%ecx | |
| + andl $0x00ffffff,%ecx | |
| + orl %edi,%ecx | |
| cmpxchg8b CPUVAR(ISTATE) /* swap in new ilevel */ | |
| jnz 0b | |
| -1: | |
| + popl %edi | |
| + popl %esi | |
| popl %ebx | |
| +1: | |
| ret | |
| 2: | |
| + popl %edi | |
| + popl %esi | |
| popl %ebx | |
| .type _C_LABEL(cx8_spllower_patch), @function | |
| @@ -203,7 +223,17 @@ IDTVEC(spllower) | |
| #endif /* defined(DEBUG) */ | |
| #if !defined(XENPV) | |
| movl %ebx,%eax /* get cpl */ | |
| - movl CPUVAR(IUNMASK)(,%eax,4),%eax | |
| + movl CPUVAR(IUNMASK)+4(,%eax,8),%eax | |
| + andl CPUVAR(IPENDING)+4,%eax /* any non-masked bits left? */ | |
| + jz 10f | |
| + bsrl %eax,%eax | |
| + btrl %eax,CPUVAR(IPENDING)+4 | |
| + addl $32,%eax | |
| + movl CPUVAR(ISOURCES)(,%eax,4),%eax | |
| + jmp *IS_RECURSE(%eax) | |
| +10: | |
| + movl %ebx,%eax /* get cpl */ | |
| + movl CPUVAR(IUNMASK)(,%eax,8),%eax | |
| andl CPUVAR(IPENDING),%eax /* any non-masked bits left? */ | |
| jz 2f | |
| bsrl %eax,%eax | |
| @@ -223,7 +253,7 @@ IDTVEC(spllower) | |
| jmp *IS_RECURSE(%eax) | |
| #endif | |
| 3: | |
| - movl %ebx,CPUVAR(ILEVEL) | |
| + movb %bl,CPUVAR(ILEVEL) | |
| #ifdef XEN | |
| STIC(%eax) | |
| jz 4f | |
| @@ -280,7 +310,17 @@ IDTVEC(doreti) | |
| #endif /* defined(DEBUG) */ | |
| #if !defined(XENPV) | |
| movl %ebx,%eax | |
| - movl CPUVAR(IUNMASK)(,%eax,4),%eax | |
| + movl CPUVAR(IUNMASK)+4(,%eax,8),%eax | |
| + andl CPUVAR(IPENDING)+4,%eax | |
| + jz 10f | |
| + bsrl %eax,%eax /* slow, but not worth optimizing */ | |
| + btrl %eax,CPUVAR(IPENDING)+4 | |
| + addl $32,%eax | |
| + movl CPUVAR(ISOURCES)(,%eax, 4),%eax | |
| + jmp *IS_RESUME(%eax) | |
| +10: | |
| + movl %ebx,%eax | |
| + movl CPUVAR(IUNMASK)(,%eax,8),%eax | |
| andl CPUVAR(IPENDING),%eax | |
| jz 2f | |
| bsrl %eax,%eax /* slow, but not worth optimizing */ | |
| @@ -300,7 +340,7 @@ IDTVEC(doreti) | |
| jmp *IS_RESUME(%eax) | |
| #endif | |
| 3: | |
| - movl %ebx,CPUVAR(ILEVEL) | |
| + movb %bl,CPUVAR(ILEVEL) | |
| 5: | |
| testb $CHK_UPL,TF_CS(%esp) | |
| jnz doreti_checkast | |
| @@ -365,7 +405,7 @@ IDTVEC(softintr) | |
| pushl %ebx | |
| pushl %esi | |
| pushl %edi | |
| - movl $IPL_HIGH,CPUVAR(ILEVEL) | |
| + movb $IPL_HIGH,CPUVAR(ILEVEL) | |
| movl CPUVAR(CURLWP),%esi | |
| movl IS_LWP(%eax),%edi /* switch to handler LWP */ | |
| movl %edi,CPUVAR(CURLWP) | |
| @@ -421,7 +461,7 @@ END(softint_trigger) | |
| * Handles preemption interrupts via Xspllower(). | |
| */ | |
| IDTVEC(recurse_preempt) | |
| - movl $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| + movb $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| sti | |
| pushl $0 | |
| call _C_LABEL(kpreempt) | |
| @@ -436,7 +476,7 @@ IDTVEC_END(recurse_preempt) | |
| * Handles preemption interrupts via Xdoreti(). | |
| */ | |
| IDTVEC(resume_preempt) | |
| - movl $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| + movb $IPL_PREEMPT,CPUVAR(ILEVEL) | |
| sti | |
| testb $CHK_UPL,TF_CS(%esp) | |
| jnz 1f | |
| diff --git a/sys/arch/i386/i386/vector.S b/sys/arch/i386/i386/vector.S | |
| index 5ef99df2713..a8ca62ab654 100644 | |
| --- a/sys/arch/i386/i386/vector.S | |
| +++ b/sys/arch/i386/i386/vector.S | |
| @@ -165,7 +165,7 @@ IDTVEC(intr_x2apic_ipi) | |
| xorl %eax,%eax | |
| xorl %edx,%edx | |
| wrmsr | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_HIGH,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -176,7 +176,7 @@ IDTVEC(intr_lapic_ipi) | |
| INTRENTRY | |
| movl _C_LABEL(local_apic_va),%ebx | |
| movl $0,LAPIC_EOI(%ebx) | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_HIGH,%ebx | |
| jae 2f | |
| IDTVEC_END(intr_lapic_ipi) | |
| @@ -184,13 +184,13 @@ IDTVEC(resume_lapic_ipi) | |
| 1: | |
| pushl %ebx | |
| IDEPTH_INCR | |
| - movl $IPL_HIGH,CPUVAR(ILEVEL) | |
| + movb $IPL_HIGH,CPUVAR(ILEVEL) | |
| sti | |
| call _C_LABEL(x86_ipi_handler) | |
| cli | |
| jmp _C_LABEL(Xdoreti) | |
| 2: | |
| - orl $(1 << LIR_IPI),CPUVAR(IPENDING) | |
| + btsl $(LIR_IPI - 32),CPUVAR(IPENDING)+4 | |
| INTRFASTEXIT | |
| IDTVEC_END(resume_lapic_ipi) | |
| @@ -290,7 +290,7 @@ IDTVEC(intr_x2apic_ltimer) | |
| xorl %eax,%eax | |
| xorl %edx,%edx | |
| wrmsr | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_CLOCK,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -301,7 +301,7 @@ IDTVEC(intr_lapic_ltimer) | |
| INTRENTRY | |
| movl _C_LABEL(local_apic_va),%ebx | |
| movl $0,LAPIC_EOI(%ebx) | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_CLOCK,%ebx | |
| jae 2f | |
| IDTVEC_END(intr_lapic_ltimer) | |
| @@ -309,7 +309,7 @@ IDTVEC(resume_lapic_ltimer) | |
| 1: | |
| pushl %ebx | |
| IDEPTH_INCR | |
| - movl $IPL_CLOCK,CPUVAR(ILEVEL) | |
| + movb $IPL_CLOCK,CPUVAR(ILEVEL) | |
| sti | |
| pushl $0 | |
| call _C_LABEL(lapic_clockintr) | |
| @@ -317,7 +317,7 @@ IDTVEC(resume_lapic_ltimer) | |
| cli | |
| jmp _C_LABEL(Xdoreti) | |
| 2: | |
| - orl $(1 << LIR_TIMER),CPUVAR(IPENDING) | |
| + btsl $(LIR_TIMER - 32),CPUVAR(IPENDING)+4 | |
| INTRFASTEXIT | |
| IDTVEC_END(resume_lapic_ltimer) | |
| @@ -337,7 +337,7 @@ IDTVEC(intr_hyperv_hypercall) | |
| pushl $0 | |
| pushl $T_ASTFLT | |
| INTRENTRY | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| cmpl $IPL_NET,%ebx | |
| jae 2f | |
| jmp 1f | |
| @@ -346,7 +346,7 @@ IDTVEC(resume_hyperv_hypercall) | |
| 1: | |
| pushl %ebx | |
| IDEPTH_INCR | |
| - movl $IPL_NET,CPUVAR(ILEVEL) | |
| + movb $IPL_NET,CPUVAR(ILEVEL) | |
| sti | |
| pushl %esp | |
| call _C_LABEL(hyperv_hypercall_intr) | |
| @@ -354,7 +354,7 @@ IDTVEC(resume_hyperv_hypercall) | |
| cli | |
| jmp _C_LABEL(Xdoreti) | |
| 2: | |
| - orl $(1 << LIR_HV),CPUVAR(IPENDING) | |
| + btsl $(LIR_HV - 32),CPUVAR(IPENDING)+4 | |
| INTRFASTEXIT | |
| IDTVEC_END(resume_hyperv_hypercall) | |
| #endif /* NHYPERV > 0 */ | |
| @@ -370,7 +370,7 @@ IDTVEC_END(resume_hyperv_hypercall) | |
| * for specific PICs. | |
| */ | |
| -#define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \ | |
| +#define INTRSTUB1(name, num, sub, off, early_ack, late_ack, mask, unmask, level_mask) \ | |
| IDTVEC(recurse_ ## name ## num) ;\ | |
| INTR_RECURSE_HWFRAME ;\ | |
| subl $4,%esp ;\ | |
| @@ -394,7 +394,7 @@ IDTVEC(intr_ ## name ## num) ;\ | |
| testl %ebp,%ebp ;\ | |
| jz 9f /* stray */ ;\ | |
| movl IS_MAXLEVEL(%ebp),%ebx ;\ | |
| - movl CPUVAR(ILEVEL),%esi ;\ | |
| + movzbl CPUVAR(ILEVEL),%esi ;\ | |
| cmpl %ebx,%esi ;\ | |
| jae 10f /* currently masked; hold it */ ;\ | |
| addl $1,CPUVAR(NINTR) /* statistical info */ ;\ | |
| @@ -403,20 +403,20 @@ IDTVEC(intr_ ## name ## num) ;\ | |
| adcl $0,IS_EVCNTHI(%ebp) ;\ | |
| 1: \ | |
| pushl %esi /* if_ppi */ ;\ | |
| - movl %ebx,CPUVAR(ILEVEL) ;\ | |
| + movb %bl,CPUVAR(ILEVEL) ;\ | |
| /* switch stack if necessary, and push a ptr to our intrframe */ \ | |
| IDEPTH_INCR ;\ | |
| sti ;\ | |
| movl IS_HANDLERS(%ebp),%ebx ;\ | |
| 6: \ | |
| - movl IH_LEVEL(%ebx),%edi ;\ | |
| - cmpl %esi,%edi ;\ | |
| + movl IH_LEVEL(%ebx),%eax ;\ | |
| + cmpl %esi,%eax ;\ | |
| jle 7f ;\ | |
| pushl IH_ARG(%ebx) ;\ | |
| - movl IH_FUN(%ebx),%eax ;\ | |
| - movl %edi,CPUVAR(ILEVEL) ;\ | |
| + movl IH_FUN(%ebx),%edi ;\ | |
| + movb %al,CPUVAR(ILEVEL) ;\ | |
| movl IH_NEXT(%ebx),%ebx /* next handler in chain */ ;\ | |
| - call *%eax /* call it */ ;\ | |
| + call *%edi /* call it */ ;\ | |
| addl $4,%esp /* toss the arg */ ;\ | |
| testl %ebx,%ebx ;\ | |
| jnz 6b ;\ | |
| @@ -426,12 +426,12 @@ IDTVEC(intr_ ## name ## num) ;\ | |
| jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ | |
| 7: \ | |
| cli ;\ | |
| - orl $(1 << num),CPUVAR(IPENDING) ;\ | |
| + btsl $(num - sub),CPUVAR(IPENDING) + off ;\ | |
| level_mask(num) ;\ | |
| late_ack(num) ;\ | |
| jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\ | |
| 10: \ | |
| - orl $(1 << num),CPUVAR(IPENDING) ;\ | |
| + btsl $(num - sub),CPUVAR(IPENDING) + off ;\ | |
| level_mask(num) ;\ | |
| late_ack(num) ;\ | |
| INTRFASTEXIT ;\ | |
| @@ -443,6 +443,11 @@ IDTVEC(intr_ ## name ## num) ;\ | |
| INTRFASTEXIT ;\ | |
| IDTVEC_END(intr_ ## name ## num) | |
| +#define INTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \ | |
| + INTRSTUB1(name, num, 0, 0, early_ack, late_ack, mask, unmask, level_mask) | |
| +#define INTRSTUB32(name, num, early_ack, late_ack, mask, unmask, level_mask) \ | |
| + INTRSTUB1(name, num, 32, 4, early_ack, late_ack, mask, unmask, level_mask) | |
| + | |
| #define ICUADDR IO_ICU1 | |
| INTRSTUB(legacy,0,i8259_asm_ack1,voidop,i8259_asm_mask,i8259_asm_unmask, | |
| @@ -483,449 +488,167 @@ INTRSTUB(legacy,15,i8259_asm_ack2,voidop,i8259_asm_mask,i8259_asm_unmask, | |
| #if NIOAPIC > 0 | |
| -INTRSTUB(ioapic_edge,0,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,1,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,2,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,3,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,4,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,5,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,6,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,7,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,8,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,9,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,10,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,11,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,12,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,13,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,14,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,15,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,16,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,17,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,18,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,19,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,20,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,21,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,22,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,23,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,24,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,25,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,26,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,27,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,28,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,29,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,30,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(ioapic_edge,31,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| - | |
| -INTRSTUB(ioapic_level,0,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,1,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,2,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,3,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,4,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,5,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,6,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,7,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,8,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,9,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,10,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,11,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,12,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,13,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,14,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,15,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,16,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,17,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,18,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,19,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,20,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,21,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,22,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,23,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,24,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,25,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,26,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,27,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,28,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,29,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,30,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(ioapic_level,31,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| - | |
| -INTRSTUB(x2apic_edge,0,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,1,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,2,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,3,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,4,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,5,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,6,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,7,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,8,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,9,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,10,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,11,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,12,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,13,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,14,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,15,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,16,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,17,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,18,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,19,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,20,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,21,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,22,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,23,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,24,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,25,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,26,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,27,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,28,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,29,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,30,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| -INTRSTUB(x2apic_edge,31,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| - | |
| -INTRSTUB(x2apic_level,0,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,1,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,2,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,3,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,4,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,5,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,6,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,7,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,8,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,9,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,10,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,11,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,12,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,13,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,14,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,15,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,16,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,17,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,18,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,19,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,20,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,21,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,22,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,23,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,24,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,25,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,26,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,27,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,28,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,29,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,30,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| -INTRSTUB(x2apic_level,31,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| +#define INTRSTUB_56(name,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,0,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,1,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,2,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,3,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,4,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,5,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,6,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,7,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,8,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,9,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,10,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,11,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,12,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,13,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,14,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,15,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,16,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,17,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,18,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,19,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,20,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,21,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,22,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,23,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,24,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,25,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,26,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,27,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,28,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,29,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,30,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB(name,31,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,32,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,33,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,34,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,35,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,36,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,37,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,38,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,39,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,40,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,41,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,42,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,43,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,44,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,45,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,46,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,47,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,48,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,49,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,50,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,51,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,52,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,53,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,54,early_ack,late_ack,mask,unmask,level_mask) ;\ | |
| + INTRSTUB32(name,55,early_ack,late_ack,mask,unmask,level_mask) | |
| + | |
| +INTRSTUB_56(ioapic_edge,voidop,ioapic_asm_ack,voidop,voidop,voidop) | |
| +INTRSTUB_56(ioapic_level,voidop,ioapic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| + | |
| +INTRSTUB_56(x2apic_edge,voidop,x2apic_asm_ack,voidop,voidop,voidop) | |
| +INTRSTUB_56(x2apic_level,voidop,x2apic_asm_ack,voidop,ioapic_unmask,ioapic_mask) | |
| #endif | |
| - .type _C_LABEL(legacy_stubs), @object | |
| -LABEL(legacy_stubs) | |
| - .long _C_LABEL(Xintr_legacy0), _C_LABEL(Xrecurse_legacy0) | |
| - .long _C_LABEL(Xresume_legacy0) | |
| - .long _C_LABEL(Xintr_legacy1), _C_LABEL(Xrecurse_legacy1) | |
| - .long _C_LABEL(Xresume_legacy1) | |
| - .long _C_LABEL(Xintr_legacy2), _C_LABEL(Xrecurse_legacy2) | |
| - .long _C_LABEL(Xresume_legacy2) | |
| - .long _C_LABEL(Xintr_legacy3), _C_LABEL(Xrecurse_legacy3) | |
| - .long _C_LABEL(Xresume_legacy3) | |
| - .long _C_LABEL(Xintr_legacy4), _C_LABEL(Xrecurse_legacy4) | |
| - .long _C_LABEL(Xresume_legacy4) | |
| - .long _C_LABEL(Xintr_legacy5), _C_LABEL(Xrecurse_legacy5) | |
| - .long _C_LABEL(Xresume_legacy5) | |
| - .long _C_LABEL(Xintr_legacy6), _C_LABEL(Xrecurse_legacy6) | |
| - .long _C_LABEL(Xresume_legacy6) | |
| - .long _C_LABEL(Xintr_legacy7), _C_LABEL(Xrecurse_legacy7) | |
| - .long _C_LABEL(Xresume_legacy7) | |
| - .long _C_LABEL(Xintr_legacy8), _C_LABEL(Xrecurse_legacy8) | |
| - .long _C_LABEL(Xresume_legacy8) | |
| - .long _C_LABEL(Xintr_legacy9), _C_LABEL(Xrecurse_legacy9) | |
| - .long _C_LABEL(Xresume_legacy9) | |
| - .long _C_LABEL(Xintr_legacy10), _C_LABEL(Xrecurse_legacy10) | |
| - .long _C_LABEL(Xresume_legacy10) | |
| - .long _C_LABEL(Xintr_legacy11), _C_LABEL(Xrecurse_legacy11) | |
| - .long _C_LABEL(Xresume_legacy11) | |
| - .long _C_LABEL(Xintr_legacy12), _C_LABEL(Xrecurse_legacy12) | |
| - .long _C_LABEL(Xresume_legacy12) | |
| - .long _C_LABEL(Xintr_legacy13), _C_LABEL(Xrecurse_legacy13) | |
| - .long _C_LABEL(Xresume_legacy13) | |
| - .long _C_LABEL(Xintr_legacy14), _C_LABEL(Xrecurse_legacy14) | |
| - .long _C_LABEL(Xresume_legacy14) | |
| - .long _C_LABEL(Xintr_legacy15), _C_LABEL(Xrecurse_legacy15) | |
| - .long _C_LABEL(Xresume_legacy15) | |
| -END(legacy_stubs) | |
| - | |
| -#if NIOAPIC > 0 | |
| - .type _C_LABEL(ioapic_edge_stubs), @object | |
| -LABEL(ioapic_edge_stubs) | |
| - .long _C_LABEL(Xintr_ioapic_edge0), _C_LABEL(Xrecurse_ioapic_edge0) | |
| - .long _C_LABEL(Xresume_ioapic_edge0) | |
| - .long _C_LABEL(Xintr_ioapic_edge1), _C_LABEL(Xrecurse_ioapic_edge1) | |
| - .long _C_LABEL(Xresume_ioapic_edge1) | |
| - .long _C_LABEL(Xintr_ioapic_edge2), _C_LABEL(Xrecurse_ioapic_edge2) | |
| - .long _C_LABEL(Xresume_ioapic_edge2) | |
| - .long _C_LABEL(Xintr_ioapic_edge3), _C_LABEL(Xrecurse_ioapic_edge3) | |
| - .long _C_LABEL(Xresume_ioapic_edge3) | |
| - .long _C_LABEL(Xintr_ioapic_edge4), _C_LABEL(Xrecurse_ioapic_edge4) | |
| - .long _C_LABEL(Xresume_ioapic_edge4) | |
| - .long _C_LABEL(Xintr_ioapic_edge5), _C_LABEL(Xrecurse_ioapic_edge5) | |
| - .long _C_LABEL(Xresume_ioapic_edge5) | |
| - .long _C_LABEL(Xintr_ioapic_edge6), _C_LABEL(Xrecurse_ioapic_edge6) | |
| - .long _C_LABEL(Xresume_ioapic_edge6) | |
| - .long _C_LABEL(Xintr_ioapic_edge7), _C_LABEL(Xrecurse_ioapic_edge7) | |
| - .long _C_LABEL(Xresume_ioapic_edge7) | |
| - .long _C_LABEL(Xintr_ioapic_edge8), _C_LABEL(Xrecurse_ioapic_edge8) | |
| - .long _C_LABEL(Xresume_ioapic_edge8) | |
| - .long _C_LABEL(Xintr_ioapic_edge9), _C_LABEL(Xrecurse_ioapic_edge9) | |
| - .long _C_LABEL(Xresume_ioapic_edge9) | |
| - .long _C_LABEL(Xintr_ioapic_edge10), _C_LABEL(Xrecurse_ioapic_edge10) | |
| - .long _C_LABEL(Xresume_ioapic_edge10) | |
| - .long _C_LABEL(Xintr_ioapic_edge11), _C_LABEL(Xrecurse_ioapic_edge11) | |
| - .long _C_LABEL(Xresume_ioapic_edge11) | |
| - .long _C_LABEL(Xintr_ioapic_edge12), _C_LABEL(Xrecurse_ioapic_edge12) | |
| - .long _C_LABEL(Xresume_ioapic_edge12) | |
| - .long _C_LABEL(Xintr_ioapic_edge13), _C_LABEL(Xrecurse_ioapic_edge13) | |
| - .long _C_LABEL(Xresume_ioapic_edge13) | |
| - .long _C_LABEL(Xintr_ioapic_edge14), _C_LABEL(Xrecurse_ioapic_edge14) | |
| - .long _C_LABEL(Xresume_ioapic_edge14) | |
| - .long _C_LABEL(Xintr_ioapic_edge15), _C_LABEL(Xrecurse_ioapic_edge15) | |
| - .long _C_LABEL(Xresume_ioapic_edge15) | |
| - .long _C_LABEL(Xintr_ioapic_edge16), _C_LABEL(Xrecurse_ioapic_edge16) | |
| - .long _C_LABEL(Xresume_ioapic_edge16) | |
| - .long _C_LABEL(Xintr_ioapic_edge17), _C_LABEL(Xrecurse_ioapic_edge17) | |
| - .long _C_LABEL(Xresume_ioapic_edge17) | |
| - .long _C_LABEL(Xintr_ioapic_edge18), _C_LABEL(Xrecurse_ioapic_edge18) | |
| - .long _C_LABEL(Xresume_ioapic_edge18) | |
| - .long _C_LABEL(Xintr_ioapic_edge19), _C_LABEL(Xrecurse_ioapic_edge19) | |
| - .long _C_LABEL(Xresume_ioapic_edge19) | |
| - .long _C_LABEL(Xintr_ioapic_edge20), _C_LABEL(Xrecurse_ioapic_edge20) | |
| - .long _C_LABEL(Xresume_ioapic_edge20) | |
| - .long _C_LABEL(Xintr_ioapic_edge21), _C_LABEL(Xrecurse_ioapic_edge21) | |
| - .long _C_LABEL(Xresume_ioapic_edge21) | |
| - .long _C_LABEL(Xintr_ioapic_edge22), _C_LABEL(Xrecurse_ioapic_edge22) | |
| - .long _C_LABEL(Xresume_ioapic_edge22) | |
| - .long _C_LABEL(Xintr_ioapic_edge23), _C_LABEL(Xrecurse_ioapic_edge23) | |
| - .long _C_LABEL(Xresume_ioapic_edge23) | |
| - .long _C_LABEL(Xintr_ioapic_edge24), _C_LABEL(Xrecurse_ioapic_edge24) | |
| - .long _C_LABEL(Xresume_ioapic_edge24) | |
| - .long _C_LABEL(Xintr_ioapic_edge25), _C_LABEL(Xrecurse_ioapic_edge25) | |
| - .long _C_LABEL(Xresume_ioapic_edge25) | |
| - .long _C_LABEL(Xintr_ioapic_edge26), _C_LABEL(Xrecurse_ioapic_edge26) | |
| - .long _C_LABEL(Xresume_ioapic_edge26) | |
| - .long _C_LABEL(Xintr_ioapic_edge27), _C_LABEL(Xrecurse_ioapic_edge27) | |
| - .long _C_LABEL(Xresume_ioapic_edge27) | |
| - .long _C_LABEL(Xintr_ioapic_edge28), _C_LABEL(Xrecurse_ioapic_edge28) | |
| - .long _C_LABEL(Xresume_ioapic_edge28) | |
| - .long _C_LABEL(Xintr_ioapic_edge29), _C_LABEL(Xrecurse_ioapic_edge29) | |
| - .long _C_LABEL(Xresume_ioapic_edge29) | |
| - .long _C_LABEL(Xintr_ioapic_edge30), _C_LABEL(Xrecurse_ioapic_edge30) | |
| - .long _C_LABEL(Xresume_ioapic_edge30) | |
| - .long _C_LABEL(Xintr_ioapic_edge31), _C_LABEL(Xrecurse_ioapic_edge31) | |
| - .long _C_LABEL(Xresume_ioapic_edge31) | |
| -END(ioapic_edge_stubs) | |
| +/* | |
| + * Create a struct intrstub. | |
| + */ | |
| +#define INTRSTUB_ENTRY(name) \ | |
| + .long _C_LABEL(Xintr_ ## name ), _C_LABEL(Xrecurse_ ## name ) ; \ | |
| + .long _C_LABEL(Xresume_ ## name ) ; | |
| - .type _C_LABEL(ioapic_level_stubs), @object | |
| -LABEL(ioapic_level_stubs) | |
| - .long _C_LABEL(Xintr_ioapic_level0), _C_LABEL(Xrecurse_ioapic_level0) | |
| - .long _C_LABEL(Xresume_ioapic_level0) | |
| - .long _C_LABEL(Xintr_ioapic_level1), _C_LABEL(Xrecurse_ioapic_level1) | |
| - .long _C_LABEL(Xresume_ioapic_level1) | |
| - .long _C_LABEL(Xintr_ioapic_level2), _C_LABEL(Xrecurse_ioapic_level2) | |
| - .long _C_LABEL(Xresume_ioapic_level2) | |
| - .long _C_LABEL(Xintr_ioapic_level3), _C_LABEL(Xrecurse_ioapic_level3) | |
| - .long _C_LABEL(Xresume_ioapic_level3) | |
| - .long _C_LABEL(Xintr_ioapic_level4), _C_LABEL(Xrecurse_ioapic_level4) | |
| - .long _C_LABEL(Xresume_ioapic_level4) | |
| - .long _C_LABEL(Xintr_ioapic_level5), _C_LABEL(Xrecurse_ioapic_level5) | |
| - .long _C_LABEL(Xresume_ioapic_level5) | |
| - .long _C_LABEL(Xintr_ioapic_level6), _C_LABEL(Xrecurse_ioapic_level6) | |
| - .long _C_LABEL(Xresume_ioapic_level6) | |
| - .long _C_LABEL(Xintr_ioapic_level7), _C_LABEL(Xrecurse_ioapic_level7) | |
| - .long _C_LABEL(Xresume_ioapic_level7) | |
| - .long _C_LABEL(Xintr_ioapic_level8), _C_LABEL(Xrecurse_ioapic_level8) | |
| - .long _C_LABEL(Xresume_ioapic_level8) | |
| - .long _C_LABEL(Xintr_ioapic_level9), _C_LABEL(Xrecurse_ioapic_level9) | |
| - .long _C_LABEL(Xresume_ioapic_level9) | |
| - .long _C_LABEL(Xintr_ioapic_level10), _C_LABEL(Xrecurse_ioapic_level10) | |
| - .long _C_LABEL(Xresume_ioapic_level10) | |
| - .long _C_LABEL(Xintr_ioapic_level11), _C_LABEL(Xrecurse_ioapic_level11) | |
| - .long _C_LABEL(Xresume_ioapic_level11) | |
| - .long _C_LABEL(Xintr_ioapic_level12), _C_LABEL(Xrecurse_ioapic_level12) | |
| - .long _C_LABEL(Xresume_ioapic_level12) | |
| - .long _C_LABEL(Xintr_ioapic_level13), _C_LABEL(Xrecurse_ioapic_level13) | |
| - .long _C_LABEL(Xresume_ioapic_level13) | |
| - .long _C_LABEL(Xintr_ioapic_level14), _C_LABEL(Xrecurse_ioapic_level14) | |
| - .long _C_LABEL(Xresume_ioapic_level14) | |
| - .long _C_LABEL(Xintr_ioapic_level15), _C_LABEL(Xrecurse_ioapic_level15) | |
| - .long _C_LABEL(Xresume_ioapic_level15) | |
| - .long _C_LABEL(Xintr_ioapic_level16), _C_LABEL(Xrecurse_ioapic_level16) | |
| - .long _C_LABEL(Xresume_ioapic_level16) | |
| - .long _C_LABEL(Xintr_ioapic_level17), _C_LABEL(Xrecurse_ioapic_level17) | |
| - .long _C_LABEL(Xresume_ioapic_level17) | |
| - .long _C_LABEL(Xintr_ioapic_level18), _C_LABEL(Xrecurse_ioapic_level18) | |
| - .long _C_LABEL(Xresume_ioapic_level18) | |
| - .long _C_LABEL(Xintr_ioapic_level19), _C_LABEL(Xrecurse_ioapic_level19) | |
| - .long _C_LABEL(Xresume_ioapic_level19) | |
| - .long _C_LABEL(Xintr_ioapic_level20), _C_LABEL(Xrecurse_ioapic_level20) | |
| - .long _C_LABEL(Xresume_ioapic_level20) | |
| - .long _C_LABEL(Xintr_ioapic_level21), _C_LABEL(Xrecurse_ioapic_level21) | |
| - .long _C_LABEL(Xresume_ioapic_level21) | |
| - .long _C_LABEL(Xintr_ioapic_level22), _C_LABEL(Xrecurse_ioapic_level22) | |
| - .long _C_LABEL(Xresume_ioapic_level22) | |
| - .long _C_LABEL(Xintr_ioapic_level23), _C_LABEL(Xrecurse_ioapic_level23) | |
| - .long _C_LABEL(Xresume_ioapic_level23) | |
| - .long _C_LABEL(Xintr_ioapic_level24), _C_LABEL(Xrecurse_ioapic_level24) | |
| - .long _C_LABEL(Xresume_ioapic_level24) | |
| - .long _C_LABEL(Xintr_ioapic_level25), _C_LABEL(Xrecurse_ioapic_level25) | |
| - .long _C_LABEL(Xresume_ioapic_level25) | |
| - .long _C_LABEL(Xintr_ioapic_level26), _C_LABEL(Xrecurse_ioapic_level26) | |
| - .long _C_LABEL(Xresume_ioapic_level26) | |
| - .long _C_LABEL(Xintr_ioapic_level27), _C_LABEL(Xrecurse_ioapic_level27) | |
| - .long _C_LABEL(Xresume_ioapic_level27) | |
| - .long _C_LABEL(Xintr_ioapic_level28), _C_LABEL(Xrecurse_ioapic_level28) | |
| - .long _C_LABEL(Xresume_ioapic_level28) | |
| - .long _C_LABEL(Xintr_ioapic_level29), _C_LABEL(Xrecurse_ioapic_level29) | |
| - .long _C_LABEL(Xresume_ioapic_level29) | |
| - .long _C_LABEL(Xintr_ioapic_level30), _C_LABEL(Xrecurse_ioapic_level30) | |
| - .long _C_LABEL(Xresume_ioapic_level30) | |
| - .long _C_LABEL(Xintr_ioapic_level31), _C_LABEL(Xrecurse_ioapic_level31) | |
| - .long _C_LABEL(Xresume_ioapic_level31) | |
| -END(ioapic_level_stubs) | |
| +/* | |
| + * Create an array of structs intrstub (16 entries). | |
| + */ | |
| +#define INTRSTUB_ARRAY_16(name) ; \ | |
| + .type _C_LABEL(name ## _stubs), @object ; \ | |
| +LABEL(name ## _stubs) ; \ | |
| + INTRSTUB_ENTRY(name ## 0) ; \ | |
| + INTRSTUB_ENTRY(name ## 1) ; \ | |
| + INTRSTUB_ENTRY(name ## 2) ; \ | |
| + INTRSTUB_ENTRY(name ## 3) ; \ | |
| + INTRSTUB_ENTRY(name ## 4) ; \ | |
| + INTRSTUB_ENTRY(name ## 5) ; \ | |
| + INTRSTUB_ENTRY(name ## 6) ; \ | |
| + INTRSTUB_ENTRY(name ## 7) ; \ | |
| + INTRSTUB_ENTRY(name ## 8) ; \ | |
| + INTRSTUB_ENTRY(name ## 9) ; \ | |
| + INTRSTUB_ENTRY(name ## 10) ; \ | |
| + INTRSTUB_ENTRY(name ## 11) ; \ | |
| + INTRSTUB_ENTRY(name ## 12) ; \ | |
| + INTRSTUB_ENTRY(name ## 13) ; \ | |
| + INTRSTUB_ENTRY(name ## 14) ; \ | |
| + INTRSTUB_ENTRY(name ## 15) ; \ | |
| +END(name ## _stubs) | |
| - .type _C_LABEL(x2apic_edge_stubs), @object | |
| -LABEL(x2apic_edge_stubs) | |
| - .long _C_LABEL(Xintr_x2apic_edge0), _C_LABEL(Xrecurse_x2apic_edge0) | |
| - .long _C_LABEL(Xresume_x2apic_edge0) | |
| - .long _C_LABEL(Xintr_x2apic_edge1), _C_LABEL(Xrecurse_x2apic_edge1) | |
| - .long _C_LABEL(Xresume_x2apic_edge1) | |
| - .long _C_LABEL(Xintr_x2apic_edge2), _C_LABEL(Xrecurse_x2apic_edge2) | |
| - .long _C_LABEL(Xresume_x2apic_edge2) | |
| - .long _C_LABEL(Xintr_x2apic_edge3), _C_LABEL(Xrecurse_x2apic_edge3) | |
| - .long _C_LABEL(Xresume_x2apic_edge3) | |
| - .long _C_LABEL(Xintr_x2apic_edge4), _C_LABEL(Xrecurse_x2apic_edge4) | |
| - .long _C_LABEL(Xresume_x2apic_edge4) | |
| - .long _C_LABEL(Xintr_x2apic_edge5), _C_LABEL(Xrecurse_x2apic_edge5) | |
| - .long _C_LABEL(Xresume_x2apic_edge5) | |
| - .long _C_LABEL(Xintr_x2apic_edge6), _C_LABEL(Xrecurse_x2apic_edge6) | |
| - .long _C_LABEL(Xresume_x2apic_edge6) | |
| - .long _C_LABEL(Xintr_x2apic_edge7), _C_LABEL(Xrecurse_x2apic_edge7) | |
| - .long _C_LABEL(Xresume_x2apic_edge7) | |
| - .long _C_LABEL(Xintr_x2apic_edge8), _C_LABEL(Xrecurse_x2apic_edge8) | |
| - .long _C_LABEL(Xresume_x2apic_edge8) | |
| - .long _C_LABEL(Xintr_x2apic_edge9), _C_LABEL(Xrecurse_x2apic_edge9) | |
| - .long _C_LABEL(Xresume_x2apic_edge9) | |
| - .long _C_LABEL(Xintr_x2apic_edge10), _C_LABEL(Xrecurse_x2apic_edge10) | |
| - .long _C_LABEL(Xresume_x2apic_edge10) | |
| - .long _C_LABEL(Xintr_x2apic_edge11), _C_LABEL(Xrecurse_x2apic_edge11) | |
| - .long _C_LABEL(Xresume_x2apic_edge11) | |
| - .long _C_LABEL(Xintr_x2apic_edge12), _C_LABEL(Xrecurse_x2apic_edge12) | |
| - .long _C_LABEL(Xresume_x2apic_edge12) | |
| - .long _C_LABEL(Xintr_x2apic_edge13), _C_LABEL(Xrecurse_x2apic_edge13) | |
| - .long _C_LABEL(Xresume_x2apic_edge13) | |
| - .long _C_LABEL(Xintr_x2apic_edge14), _C_LABEL(Xrecurse_x2apic_edge14) | |
| - .long _C_LABEL(Xresume_x2apic_edge14) | |
| - .long _C_LABEL(Xintr_x2apic_edge15), _C_LABEL(Xrecurse_x2apic_edge15) | |
| - .long _C_LABEL(Xresume_x2apic_edge15) | |
| - .long _C_LABEL(Xintr_x2apic_edge16), _C_LABEL(Xrecurse_x2apic_edge16) | |
| - .long _C_LABEL(Xresume_x2apic_edge16) | |
| - .long _C_LABEL(Xintr_x2apic_edge17), _C_LABEL(Xrecurse_x2apic_edge17) | |
| - .long _C_LABEL(Xresume_x2apic_edge17) | |
| - .long _C_LABEL(Xintr_x2apic_edge18), _C_LABEL(Xrecurse_x2apic_edge18) | |
| - .long _C_LABEL(Xresume_x2apic_edge18) | |
| - .long _C_LABEL(Xintr_x2apic_edge19), _C_LABEL(Xrecurse_x2apic_edge19) | |
| - .long _C_LABEL(Xresume_x2apic_edge19) | |
| - .long _C_LABEL(Xintr_x2apic_edge20), _C_LABEL(Xrecurse_x2apic_edge20) | |
| - .long _C_LABEL(Xresume_x2apic_edge20) | |
| - .long _C_LABEL(Xintr_x2apic_edge21), _C_LABEL(Xrecurse_x2apic_edge21) | |
| - .long _C_LABEL(Xresume_x2apic_edge21) | |
| - .long _C_LABEL(Xintr_x2apic_edge22), _C_LABEL(Xrecurse_x2apic_edge22) | |
| - .long _C_LABEL(Xresume_x2apic_edge22) | |
| - .long _C_LABEL(Xintr_x2apic_edge23), _C_LABEL(Xrecurse_x2apic_edge23) | |
| - .long _C_LABEL(Xresume_x2apic_edge23) | |
| - .long _C_LABEL(Xintr_x2apic_edge24), _C_LABEL(Xrecurse_x2apic_edge24) | |
| - .long _C_LABEL(Xresume_x2apic_edge24) | |
| - .long _C_LABEL(Xintr_x2apic_edge25), _C_LABEL(Xrecurse_x2apic_edge25) | |
| - .long _C_LABEL(Xresume_x2apic_edge25) | |
| - .long _C_LABEL(Xintr_x2apic_edge26), _C_LABEL(Xrecurse_x2apic_edge26) | |
| - .long _C_LABEL(Xresume_x2apic_edge26) | |
| - .long _C_LABEL(Xintr_x2apic_edge27), _C_LABEL(Xrecurse_x2apic_edge27) | |
| - .long _C_LABEL(Xresume_x2apic_edge27) | |
| - .long _C_LABEL(Xintr_x2apic_edge28), _C_LABEL(Xrecurse_x2apic_edge28) | |
| - .long _C_LABEL(Xresume_x2apic_edge28) | |
| - .long _C_LABEL(Xintr_x2apic_edge29), _C_LABEL(Xrecurse_x2apic_edge29) | |
| - .long _C_LABEL(Xresume_x2apic_edge29) | |
| - .long _C_LABEL(Xintr_x2apic_edge30), _C_LABEL(Xrecurse_x2apic_edge30) | |
| - .long _C_LABEL(Xresume_x2apic_edge30) | |
| - .long _C_LABEL(Xintr_x2apic_edge31), _C_LABEL(Xrecurse_x2apic_edge31) | |
| - .long _C_LABEL(Xresume_x2apic_edge31) | |
| -END(x2apic_edge_stubs) | |
| +/* | |
| + * Create an array of structs intrstub (56 entries). | |
| + */ | |
| +#define INTRSTUB_ARRAY_56(name) ; \ | |
| + .type _C_LABEL(name ## _stubs), @object ; \ | |
| +LABEL(name ## _stubs) ; \ | |
| + INTRSTUB_ENTRY(name ## 0) ; \ | |
| + INTRSTUB_ENTRY(name ## 1) ; \ | |
| + INTRSTUB_ENTRY(name ## 2) ; \ | |
| + INTRSTUB_ENTRY(name ## 3) ; \ | |
| + INTRSTUB_ENTRY(name ## 4) ; \ | |
| + INTRSTUB_ENTRY(name ## 5) ; \ | |
| + INTRSTUB_ENTRY(name ## 6) ; \ | |
| + INTRSTUB_ENTRY(name ## 7) ; \ | |
| + INTRSTUB_ENTRY(name ## 8) ; \ | |
| + INTRSTUB_ENTRY(name ## 9) ; \ | |
| + INTRSTUB_ENTRY(name ## 10) ; \ | |
| + INTRSTUB_ENTRY(name ## 11) ; \ | |
| + INTRSTUB_ENTRY(name ## 12) ; \ | |
| + INTRSTUB_ENTRY(name ## 13) ; \ | |
| + INTRSTUB_ENTRY(name ## 14) ; \ | |
| + INTRSTUB_ENTRY(name ## 15) ; \ | |
| + INTRSTUB_ENTRY(name ## 16) ; \ | |
| + INTRSTUB_ENTRY(name ## 17) ; \ | |
| + INTRSTUB_ENTRY(name ## 18) ; \ | |
| + INTRSTUB_ENTRY(name ## 19) ; \ | |
| + INTRSTUB_ENTRY(name ## 20) ; \ | |
| + INTRSTUB_ENTRY(name ## 21) ; \ | |
| + INTRSTUB_ENTRY(name ## 22) ; \ | |
| + INTRSTUB_ENTRY(name ## 23) ; \ | |
| + INTRSTUB_ENTRY(name ## 24) ; \ | |
| + INTRSTUB_ENTRY(name ## 25) ; \ | |
| + INTRSTUB_ENTRY(name ## 26) ; \ | |
| + INTRSTUB_ENTRY(name ## 27) ; \ | |
| + INTRSTUB_ENTRY(name ## 28) ; \ | |
| + INTRSTUB_ENTRY(name ## 29) ; \ | |
| + INTRSTUB_ENTRY(name ## 30) ; \ | |
| + INTRSTUB_ENTRY(name ## 31) ; \ | |
| + INTRSTUB_ENTRY(name ## 32) ; \ | |
| + INTRSTUB_ENTRY(name ## 33) ; \ | |
| + INTRSTUB_ENTRY(name ## 34) ; \ | |
| + INTRSTUB_ENTRY(name ## 35) ; \ | |
| + INTRSTUB_ENTRY(name ## 36) ; \ | |
| + INTRSTUB_ENTRY(name ## 37) ; \ | |
| + INTRSTUB_ENTRY(name ## 38) ; \ | |
| + INTRSTUB_ENTRY(name ## 39) ; \ | |
| + INTRSTUB_ENTRY(name ## 40) ; \ | |
| + INTRSTUB_ENTRY(name ## 41) ; \ | |
| + INTRSTUB_ENTRY(name ## 42) ; \ | |
| + INTRSTUB_ENTRY(name ## 43) ; \ | |
| + INTRSTUB_ENTRY(name ## 44) ; \ | |
| + INTRSTUB_ENTRY(name ## 45) ; \ | |
| + INTRSTUB_ENTRY(name ## 46) ; \ | |
| + INTRSTUB_ENTRY(name ## 47) ; \ | |
| + INTRSTUB_ENTRY(name ## 48) ; \ | |
| + INTRSTUB_ENTRY(name ## 49) ; \ | |
| + INTRSTUB_ENTRY(name ## 50) ; \ | |
| + INTRSTUB_ENTRY(name ## 51) ; \ | |
| + INTRSTUB_ENTRY(name ## 52) ; \ | |
| + INTRSTUB_ENTRY(name ## 53) ; \ | |
| + INTRSTUB_ENTRY(name ## 54) ; \ | |
| + INTRSTUB_ENTRY(name ## 55) ; \ | |
| +END(name ## _stubs) | |
| - .type _C_LABEL(x2apic_level_stubs), @object | |
| -LABEL(x2apic_level_stubs) | |
| - .long _C_LABEL(Xintr_x2apic_level0), _C_LABEL(Xrecurse_x2apic_level0) | |
| - .long _C_LABEL(Xresume_x2apic_level0) | |
| - .long _C_LABEL(Xintr_x2apic_level1), _C_LABEL(Xrecurse_x2apic_level1) | |
| - .long _C_LABEL(Xresume_x2apic_level1) | |
| - .long _C_LABEL(Xintr_x2apic_level2), _C_LABEL(Xrecurse_x2apic_level2) | |
| - .long _C_LABEL(Xresume_x2apic_level2) | |
| - .long _C_LABEL(Xintr_x2apic_level3), _C_LABEL(Xrecurse_x2apic_level3) | |
| - .long _C_LABEL(Xresume_x2apic_level3) | |
| - .long _C_LABEL(Xintr_x2apic_level4), _C_LABEL(Xrecurse_x2apic_level4) | |
| - .long _C_LABEL(Xresume_x2apic_level4) | |
| - .long _C_LABEL(Xintr_x2apic_level5), _C_LABEL(Xrecurse_x2apic_level5) | |
| - .long _C_LABEL(Xresume_x2apic_level5) | |
| - .long _C_LABEL(Xintr_x2apic_level6), _C_LABEL(Xrecurse_x2apic_level6) | |
| - .long _C_LABEL(Xresume_x2apic_level6) | |
| - .long _C_LABEL(Xintr_x2apic_level7), _C_LABEL(Xrecurse_x2apic_level7) | |
| - .long _C_LABEL(Xresume_x2apic_level7) | |
| - .long _C_LABEL(Xintr_x2apic_level8), _C_LABEL(Xrecurse_x2apic_level8) | |
| - .long _C_LABEL(Xresume_x2apic_level8) | |
| - .long _C_LABEL(Xintr_x2apic_level9), _C_LABEL(Xrecurse_x2apic_level9) | |
| - .long _C_LABEL(Xresume_x2apic_level9) | |
| - .long _C_LABEL(Xintr_x2apic_level10), _C_LABEL(Xrecurse_x2apic_level10) | |
| - .long _C_LABEL(Xresume_x2apic_level10) | |
| - .long _C_LABEL(Xintr_x2apic_level11), _C_LABEL(Xrecurse_x2apic_level11) | |
| - .long _C_LABEL(Xresume_x2apic_level11) | |
| - .long _C_LABEL(Xintr_x2apic_level12), _C_LABEL(Xrecurse_x2apic_level12) | |
| - .long _C_LABEL(Xresume_x2apic_level12) | |
| - .long _C_LABEL(Xintr_x2apic_level13), _C_LABEL(Xrecurse_x2apic_level13) | |
| - .long _C_LABEL(Xresume_x2apic_level13) | |
| - .long _C_LABEL(Xintr_x2apic_level14), _C_LABEL(Xrecurse_x2apic_level14) | |
| - .long _C_LABEL(Xresume_x2apic_level14) | |
| - .long _C_LABEL(Xintr_x2apic_level15), _C_LABEL(Xrecurse_x2apic_level15) | |
| - .long _C_LABEL(Xresume_x2apic_level15) | |
| - .long _C_LABEL(Xintr_x2apic_level16), _C_LABEL(Xrecurse_x2apic_level16) | |
| - .long _C_LABEL(Xresume_x2apic_level16) | |
| - .long _C_LABEL(Xintr_x2apic_level17), _C_LABEL(Xrecurse_x2apic_level17) | |
| - .long _C_LABEL(Xresume_x2apic_level17) | |
| - .long _C_LABEL(Xintr_x2apic_level18), _C_LABEL(Xrecurse_x2apic_level18) | |
| - .long _C_LABEL(Xresume_x2apic_level18) | |
| - .long _C_LABEL(Xintr_x2apic_level19), _C_LABEL(Xrecurse_x2apic_level19) | |
| - .long _C_LABEL(Xresume_x2apic_level19) | |
| - .long _C_LABEL(Xintr_x2apic_level20), _C_LABEL(Xrecurse_x2apic_level20) | |
| - .long _C_LABEL(Xresume_x2apic_level20) | |
| - .long _C_LABEL(Xintr_x2apic_level21), _C_LABEL(Xrecurse_x2apic_level21) | |
| - .long _C_LABEL(Xresume_x2apic_level21) | |
| - .long _C_LABEL(Xintr_x2apic_level22), _C_LABEL(Xrecurse_x2apic_level22) | |
| - .long _C_LABEL(Xresume_x2apic_level22) | |
| - .long _C_LABEL(Xintr_x2apic_level23), _C_LABEL(Xrecurse_x2apic_level23) | |
| - .long _C_LABEL(Xresume_x2apic_level23) | |
| - .long _C_LABEL(Xintr_x2apic_level24), _C_LABEL(Xrecurse_x2apic_level24) | |
| - .long _C_LABEL(Xresume_x2apic_level24) | |
| - .long _C_LABEL(Xintr_x2apic_level25), _C_LABEL(Xrecurse_x2apic_level25) | |
| - .long _C_LABEL(Xresume_x2apic_level25) | |
| - .long _C_LABEL(Xintr_x2apic_level26), _C_LABEL(Xrecurse_x2apic_level26) | |
| - .long _C_LABEL(Xresume_x2apic_level26) | |
| - .long _C_LABEL(Xintr_x2apic_level27), _C_LABEL(Xrecurse_x2apic_level27) | |
| - .long _C_LABEL(Xresume_x2apic_level27) | |
| - .long _C_LABEL(Xintr_x2apic_level28), _C_LABEL(Xrecurse_x2apic_level28) | |
| - .long _C_LABEL(Xresume_x2apic_level28) | |
| - .long _C_LABEL(Xintr_x2apic_level29), _C_LABEL(Xrecurse_x2apic_level29) | |
| - .long _C_LABEL(Xresume_x2apic_level29) | |
| - .long _C_LABEL(Xintr_x2apic_level30), _C_LABEL(Xrecurse_x2apic_level30) | |
| - .long _C_LABEL(Xresume_x2apic_level30) | |
| - .long _C_LABEL(Xintr_x2apic_level31), _C_LABEL(Xrecurse_x2apic_level31) | |
| - .long _C_LABEL(Xresume_x2apic_level31) | |
| -END(x2apic_level_stubs) | |
| -#endif | |
| #endif /* XENPV */ | |
| #if defined(XEN) | |
| @@ -942,7 +665,7 @@ IDTVEC(resume_ ## name ## num) \ | |
| movl $IREENT_MAGIC,TF_ERR(%esp) ;\ | |
| pushl %ebx ;\ | |
| movl CPUVAR(XSOURCES) + (num) * 4,%ebp ;\ | |
| - movl $num,CPUVAR(ILEVEL) ;\ | |
| + movb $num,CPUVAR(ILEVEL) ;\ | |
| IDEPTH_INCR /* leaves old %esp on stack */ ;\ | |
| STI(%eax) ;\ | |
| movl IS_HANDLERS(%ebp),%ebx ;\ | |
| @@ -1079,7 +802,8 @@ IDTVEC(hypervisor_pvhvm_callback) | |
| jb 11f | |
| cmpl $ecrit,%eax | |
| jb critical_region_fixup | |
| -11: pushl CPUVAR(ILEVEL) | |
| +11: movzbl CPUVAR(ILEVEL),%eax | |
| + pushl %eax | |
| push %esp | |
| call do_hypervisor_callback | |
| add $8,%esp | |
| @@ -1087,7 +811,7 @@ IDTVEC(hypervisor_pvhvm_callback) | |
| movb TF_CS(%esp),%cl | |
| test $CHK_UPL,%cl /* slow return to ring 2 or 3 */ | |
| je safesti | |
| - movl CPUVAR(ILEVEL),%ebx | |
| + movzbl CPUVAR(ILEVEL),%ebx | |
| jmp doreti_checkast | |
| safesti: | |
| movl CPUVAR(VCPU),%esi | |
| @@ -1148,4 +872,18 @@ ENTRY(failsafe_callback) | |
| iret | |
| END(failsafe_callback) | |
| +#else /* XENPV */ | |
| + | |
| + .section .rodata | |
| + | |
| +INTRSTUB_ARRAY_16(legacy) | |
| + | |
| +#if NIOAPIC > 0 | |
| +INTRSTUB_ARRAY_56(ioapic_edge) | |
| +INTRSTUB_ARRAY_56(ioapic_level) | |
| + | |
| +INTRSTUB_ARRAY_56(x2apic_edge) | |
| +INTRSTUB_ARRAY_56(x2apic_level) | |
| +#endif | |
| + | |
| #endif /* XENPV */ | |
| diff --git a/sys/arch/x86/include/cpu.h b/sys/arch/x86/include/cpu.h | |
| index 3180f0b6637..cf181d665ec 100644 | |
| --- a/sys/arch/x86/include/cpu.h | |
| +++ b/sys/arch/x86/include/cpu.h | |
| @@ -152,16 +152,17 @@ struct cpu_info { | |
| volatile int ci_mtx_oldspl; /* Old SPL at this ci_idepth */ | |
| /* The following must be aligned for cmpxchg8b. */ | |
| - struct { | |
| - uint32_t ipending; | |
| - int ilevel; | |
| - } ci_istate __aligned(8); | |
| -#define ci_ipending ci_istate.ipending | |
| -#define ci_ilevel ci_istate.ilevel | |
| + union { | |
| + uint64_t ci_istate; | |
| + struct { | |
| + uint64_t ci_ipending:56; | |
| + uint64_t ci_ilevel:8; | |
| + }; | |
| + } __aligned(8); | |
| int ci_idepth; | |
| void * ci_intrstack; | |
| - uint32_t ci_imask[NIPL]; | |
| - uint32_t ci_iunmask[NIPL]; | |
| + uint64_t ci_imask[NIPL]; | |
| + uint64_t ci_iunmask[NIPL]; | |
| uint32_t ci_flags; /* flags; see below */ | |
| uint32_t ci_ipis; /* interprocessor interrupts pending */ | |
| diff --git a/sys/arch/x86/include/intr.h b/sys/arch/x86/include/intr.h | |
| index 6fb4e954533..204b92390f8 100644 | |
| --- a/sys/arch/x86/include/intr.h | |
| +++ b/sys/arch/x86/include/intr.h | |
| @@ -145,9 +145,6 @@ struct intrhand { | |
| struct cpu_info *ih_cpu; | |
| }; | |
| -#define IMASK(ci,level) (ci)->ci_imask[(level)] | |
| -#define IUNMASK(ci,level) (ci)->ci_iunmask[(level)] | |
| - | |
| #ifdef _KERNEL | |
| void Xspllower(int); | |
| diff --git a/sys/arch/x86/include/intrdefs.h b/sys/arch/x86/include/intrdefs.h | |
| index 2a5040cb7cf..a4b845bc269 100644 | |
| --- a/sys/arch/x86/include/intrdefs.h | |
| +++ b/sys/arch/x86/include/intrdefs.h | |
| @@ -25,9 +25,9 @@ | |
| * Local APIC masks and software interrupt masks, in order | |
| * of priority. Must not conflict with SIR_* below. | |
| */ | |
| -#define LIR_IPI 31 | |
| -#define LIR_TIMER 30 | |
| -#define LIR_HV 29 | |
| +#define LIR_IPI 55 | |
| +#define LIR_TIMER 54 | |
| +#define LIR_HV 53 | |
| /* | |
| * XXX These should be lowest numbered, but right now would | |
| @@ -42,12 +42,12 @@ | |
| #define SIR_PREEMPT 24 | |
| /* | |
| - * Maximum # of interrupt sources per CPU. 32 to fit in one word. | |
| + * Maximum # of interrupt sources per CPU. Bitmask must still fit in one quad. | |
| * ioapics can theoretically produce more, but it's not likely to | |
| * happen. For multiple ioapics, things can be routed to different | |
| * CPUs. | |
| */ | |
| -#define MAX_INTR_SOURCES 32 | |
| +#define MAX_INTR_SOURCES 56 | |
| #define NUM_LEGACY_IRQS 16 | |
| /* | |
| diff --git a/sys/arch/x86/x86/intr.c b/sys/arch/x86/x86/intr.c | |
| index 3722436e588..579561f2a8e 100644 | |
| --- a/sys/arch/x86/x86/intr.c | |
| +++ b/sys/arch/x86/x86/intr.c | |
| @@ -149,7 +149,6 @@ __KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.146 2019/06/17 06:38:30 msaitoh Exp $"); | |
| #include <sys/errno.h> | |
| #include <sys/intr.h> | |
| #include <sys/cpu.h> | |
| -#include <sys/atomic.h> | |
| #include <sys/xcall.h> | |
| #include <sys/interrupt.h> | |
| #include <sys/reboot.h> /* for AB_VERBOSE */ | |
| @@ -304,11 +303,12 @@ x86_nmi(void) | |
| static void | |
| intr_calculatemasks(struct cpu_info *ci) | |
| { | |
| - int irq, level, unusedirqs, intrlevel[MAX_INTR_SOURCES]; | |
| + uint64_t unusedirqs, intrlevel[MAX_INTR_SOURCES]; | |
| + int irq, level; | |
| struct intrhand *q; | |
| /* First, figure out which levels each IRQ uses. */ | |
| - unusedirqs = 0xffffffff; | |
| + unusedirqs = UINT64_MAX; | |
| for (irq = 0; irq < MAX_INTR_SOURCES; irq++) { | |
| int levels = 0; | |
| @@ -317,18 +317,18 @@ intr_calculatemasks(struct cpu_info *ci) | |
| continue; | |
| } | |
| for (q = ci->ci_isources[irq]->is_handlers; q; q = q->ih_next) | |
| - levels |= 1U << q->ih_level; | |
| + levels |= 1 << q->ih_level; | |
| intrlevel[irq] = levels; | |
| if (levels) | |
| - unusedirqs &= ~(1U << irq); | |
| + unusedirqs &= ~(1ULL << irq); | |
| } | |
| /* Then figure out which IRQs use each level. */ | |
| for (level = 0; level < NIPL; level++) { | |
| - int irqs = 0; | |
| + uint64_t irqs = 0; | |
| for (irq = 0; irq < MAX_INTR_SOURCES; irq++) | |
| - if (intrlevel[irq] & (1U << level)) | |
| - irqs |= 1U << irq; | |
| + if (intrlevel[irq] & (1ULL << level)) | |
| + irqs |= 1ULL << irq; | |
| ci->ci_imask[level] = irqs | unusedirqs; | |
| } | |
| @@ -1008,7 +1008,9 @@ intr_disestablish_xcall(void *arg1, void *arg2) | |
| idtvec = source->is_idtvec; | |
| (*pic->pic_hwmask)(pic, ih->ih_pin); | |
| - atomic_and_32(&ci->ci_ipending, ~(1 << ih->ih_slot)); | |
| + membar_sync(); | |
| + ci->ci_ipending &= ~(1ULL << ih->ih_slot); | |
| + membar_sync(); | |
| /* | |
| * Remove the handler from the chain. | |
| @@ -1330,8 +1332,8 @@ intr_printconfig(void) | |
| for (CPU_INFO_FOREACH(cii, ci)) { | |
| (*pr)("%s: interrupt masks:\n", device_xname(ci->ci_dev)); | |
| for (i = 0; i < NIPL; i++) | |
| - (*pr)("IPL %d mask %08lx unmask %08lx\n", i, | |
| - (u_long)ci->ci_imask[i], (u_long)ci->ci_iunmask[i]); | |
| + (*pr)("IPL %d mask %016"PRIx64" unmask %016"PRIx64"\n", | |
| + i, ci->ci_imask[i], ci->ci_iunmask[i]); | |
| for (i = 0; i < MAX_INTR_SOURCES; i++) { | |
| isp = ci->ci_isources[i]; | |
| if (isp == NULL) | |
| @@ -1853,8 +1855,11 @@ intr_set_affinity(struct intrsource *isp, const kcpuset_t *cpuset) | |
| pin = isp->is_pin; | |
| (*pic->pic_hwmask)(pic, pin); /* for ci_ipending check */ | |
| - while (oldci->ci_ipending & (1 << oldslot)) | |
| + membar_sync(); | |
| + while (oldci->ci_ipending & (1ULL << oldslot)) { | |
| (void)kpause("intrdist", false, 1, &cpu_lock); | |
| + membar_sync(); | |
| + } | |
| kpreempt_disable(); | |
| diff --git a/sys/arch/x86/x86/lapic.c b/sys/arch/x86/x86/lapic.c | |
| index 518e0b20075..cea82618a00 100644 | |
| --- a/sys/arch/x86/x86/lapic.c | |
| +++ b/sys/arch/x86/x86/lapic.c | |
| @@ -543,7 +543,7 @@ lapic_get_timecount(struct timecounter *tc) | |
| if (lapic_readreg(reg) & (1 << (LAPIC_TIMER_VECTOR % 32))) { | |
| cur_timer -= lapic_tval; | |
| } | |
| - } else if (ci->ci_ipending & (1 << LIR_TIMER)) | |
| + } else if (ci->ci_ipending & (1ULL << LIR_TIMER)) | |
| cur_timer = lapic_gettick() - lapic_tval; | |
| cur_timer = ci->ci_lapic_counter - cur_timer; | |
| splx(s); | |
| diff --git a/sys/arch/x86/x86/patch.c b/sys/arch/x86/x86/patch.c | |
| index 59cb0208f61..67763688a86 100644 | |
| --- a/sys/arch/x86/x86/patch.c | |
| +++ b/sys/arch/x86/x86/patch.c | |
| @@ -114,7 +114,10 @@ patchfunc(void *from_s, void *from_e, void *to_s, void *to_e, | |
| if ((uintptr_t)from_e - (uintptr_t)from_s != | |
| (uintptr_t)to_e - (uintptr_t)to_s) | |
| - panic("patchfunc: sizes do not match (from=%p)", from_s); | |
| + panic("patchfunc: sizes do not match " | |
| + "(from=%p, from size=%td, to size=%td)",from_s, | |
| + (char *)from_e - (char *)from_s, | |
| + (char *)to_e - (char *)to_s); | |
| memcpy(to_s, from_s, (uintptr_t)to_e - (uintptr_t)to_s); | |
| if (pcrel != NULL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment