Module Name: src
Committed By: maxv
Date: Sun Aug 7 10:17:32 UTC 2016
Modified Files:
src/sys/arch/amd64/amd64: vector.S
src/sys/arch/i386/i386: vector.S
Log Message:
KNF a little.
To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/i386/i386/vector.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.45 src/sys/arch/amd64/amd64/vector.S:1.46
--- src/sys/arch/amd64/amd64/vector.S:1.45 Sun Nov 22 13:41:24 2015
+++ src/sys/arch/amd64/amd64/vector.S Sun Aug 7 10:17:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.45 2015/11/22 13:41:24 maxv Exp $ */
+/* $NetBSD: vector.S,v 1.46 2016/08/07 10:17:32 maxv Exp $ */
/*-
* Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -107,7 +107,6 @@
* If the interrupt frame is made more flexible, INTR can push %eax first and
* decide the ipending case with less overhead, e.g., by avoiding loading the
* segment registers.
- *
*/
/* XXX See comment in locore.s */
@@ -121,16 +120,16 @@
#ifdef MULTIPROCESSOR
IDTVEC(recurse_lapic_ipi)
INTR_RECURSE_HWFRAME
- pushq $0
+ pushq $0
pushq $T_ASTFLT
- INTRENTRY
+ INTRENTRY
jmp 1f
IDTVEC_END(recurse_lapic_ipi)
IDTVEC(intr_lapic_ipi)
- pushq $0
+ pushq $0
pushq $T_ASTFLT
- INTRENTRY
+ INTRENTRY
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
movl CPUVAR(ILEVEL),%ebx
cmpl $IPL_HIGH,%ebx
@@ -166,22 +165,22 @@ IDTVEC(intrddb)
IDTVEC_END(intrddb)
#endif /* DDB */
#endif /* MULTIPROCESSOR */
-
+
/*
* Interrupt from the local APIC timer.
*/
IDTVEC(recurse_lapic_ltimer)
INTR_RECURSE_HWFRAME
- pushq $0
+ pushq $0
pushq $T_ASTFLT
- INTRENTRY
+ INTRENTRY
jmp 1f
IDTVEC_END(recurse_lapic_ltimer)
IDTVEC(intr_lapic_ltimer)
- pushq $0
+ pushq $0
pushq $T_ASTFLT
- INTRENTRY
+ INTRENTRY
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
movl CPUVAR(ILEVEL),%ebx
cmpl $IPL_CLOCK,%ebx
@@ -211,7 +210,7 @@ IDTVEC(intr_lapic_tlb)
pushq $0
pushq $T_ASTFLT
INTRENTRY
- movl $0, _C_LABEL(local_apic)+LAPIC_EOI
+ movl $0,_C_LABEL(local_apic)+LAPIC_EOI
callq _C_LABEL(pmap_tlb_intr)
INTRFASTEXIT
IDTVEC_END(intr_lapic_tlb)
@@ -236,14 +235,14 @@ IDTVEC(recurse_ ## name ## num) ;\
IDTVEC(resume_ ## name ## num) \
movq $IREENT_MAGIC,TF_ERR(%rsp) ;\
movl %ebx,%r13d ;\
- movq CPUVAR(ISOURCES) + (num) * 8, %r14 ;\
+ movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\
movl IS_MAXLEVEL(%r14),%ebx ;\
jmp 1f ;\
IDTVEC(intr_ ## name ## num) ;\
pushq $0 /* dummy error code */ ;\
pushq $T_ASTFLT /* trap # for doing ASTs */ ;\
INTRENTRY ;\
- movq CPUVAR(ISOURCES) + (num) * 8, %r14 ;\
+ movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\
mask(num) /* mask it in hardware */ ;\
early_ack(num) /* and allow other intrs */ ;\
testq %r14,%r14 ;\
@@ -279,14 +278,14 @@ IDTVEC(intr_ ## name ## num) ;\
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
7: \
cli ;\
- orl $(1 << num),CPUVAR(IPENDING) ;\
+ orl $(1 << 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) ;\
+ orl $(1 << num),CPUVAR(IPENDING) ;\
level_mask(num) ;\
late_ack(num) ;\
INTRFASTEXIT ;\
@@ -581,39 +580,39 @@ END(ioapic_level_stubs)
/* Resume/recurse procedures for spl() */
#define XENINTRSTUB(name, num, early_ack, late_ack, mask, unmask, level_mask) \
IDTVEC(recurse_ ## name ## num) ;\
- INTR_RECURSE_HWFRAME ;\
- subq $8,%rsp ;\
- pushq $T_ASTFLT /* trap # for doing ASTs */ ;\
- INTRENTRY ;\
+ INTR_RECURSE_HWFRAME ;\
+ subq $8,%rsp ;\
+ pushq $T_ASTFLT /* trap # for doing ASTs */ ;\
+ INTRENTRY ;\
IDTVEC(resume_ ## name ## num) \
- movq $IREENT_MAGIC,TF_ERR(%rsp) ;\
- movl %ebx,%r13d ;\
- movq CPUVAR(ISOURCES) + (num) * 8, %r14 ;\
+ movq $IREENT_MAGIC,TF_ERR(%rsp) ;\
+ movl %ebx,%r13d ;\
+ movq CPUVAR(ISOURCES) + (num) * 8,%r14 ;\
1: \
- pushq %r13 ;\
- movl $num,CPUVAR(ILEVEL) ;\
- STI(si) ;\
- incl CPUVAR(IDEPTH) ;\
- movq IS_HANDLERS(%r14),%rbx ;\
+ pushq %r13 ;\
+ movl $num,CPUVAR(ILEVEL) ;\
+ STI(si) ;\
+ incl CPUVAR(IDEPTH) ;\
+ movq IS_HANDLERS(%r14),%rbx ;\
6: \
- movq IH_ARG(%rbx),%rdi ;\
- movq %rsp,%rsi ;\
- call *IH_FUN(%rbx) /* call it */ ;\
- movq IH_IPL_NEXT(%rbx),%rbx /* next handler in chain */ ;\
- testq %rbx,%rbx ;\
- jnz 6b ;\
+ movq IH_ARG(%rbx),%rdi ;\
+ movq %rsp,%rsi ;\
+ call *IH_FUN(%rbx) /* call it */ ;\
+ movq IH_IPL_NEXT(%rbx),%rbx /* next handler in chain */ ;\
+ testq %rbx,%rbx ;\
+ jnz 6b ;\
5: \
- CLI(si) ;\
- unmask(num) /* unmask it in hardware */ ;\
- late_ack(num) ;\
- STI(si) ;\
- jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
-
-# The unmask func for Xen events
+ CLI(si) ;\
+ unmask(num) /* unmask it in hardware */ ;\
+ late_ack(num) ;\
+ STI(si) ;\
+ jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
+
+/* The unmask func for Xen events */
#define hypervisor_asm_unmask(num) \
- movq $num, %rdi ;\
- call _C_LABEL(hypervisor_enable_ipl)
-
+ movq $num,%rdi ;\
+ call _C_LABEL(hypervisor_enable_ipl)
+
XENINTRSTUB(xenev,0,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
XENINTRSTUB(xenev,1,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
XENINTRSTUB(xenev,2,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
@@ -682,19 +681,21 @@ LABEL(xenev_stubs)
.quad _C_LABEL(Xrecurse_xenev31), _C_LABEL(Xresume_xenev31)
END(xenev_stubs)
-# Xen callbacks
+/*
+ * Xen callbacks
+ */
-# Hypervisor callback
+/* Hypervisor callback */
NENTRY(hypervisor_callback)
movq (%rsp),%rcx
movq 8(%rsp),%r11
addq $16,%rsp
- pushq $0 # Dummy error code
+ pushq $0 /* Dummy error code */
pushq $T_ASTFLT
INTRENTRY
- # sti??
- movq %rsp, %rdi
- subq $8, %rdi; /* don't forget if_ppl */
+ /* sti?? */
+ movq %rsp,%rdi
+ subq $8,%rdi; /* don't forget if_ppl */
call do_hypervisor_callback
testb $SEL_RPL,TF_CS(%rsp)
jnz doreti_checkast
@@ -702,7 +703,7 @@ NENTRY(hypervisor_callback)
INTRFASTEXIT
END(hypervisor_callback)
-# Panic?
+/* Panic? */
NENTRY(failsafe_callback)
movq (%rsp),%rcx
movq 8(%rsp),%r11
@@ -710,11 +711,11 @@ NENTRY(failsafe_callback)
pushq $0
pushq $T_ASTFLT
INTRENTRY
- movq %rsp, %rdi
- subq $8, %rdi; /* don't forget if_ppl */
+ movq %rsp,%rdi
+ subq $8,%rdi; /* don't forget if_ppl */
call xen_failsafe_handler
INTRFASTEXIT
-# jmp HYPERVISOR_iret
+/* jmp HYPERVISOR_iret */
END(failsafe_callback)
#endif /* !XEN */
Index: src/sys/arch/i386/i386/vector.S
diff -u src/sys/arch/i386/i386/vector.S:1.64 src/sys/arch/i386/i386/vector.S:1.65
--- src/sys/arch/i386/i386/vector.S:1.64 Sun Jan 26 19:16:17 2014
+++ src/sys/arch/i386/i386/vector.S Sun Aug 7 10:17:32 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: vector.S,v 1.64 2014/01/26 19:16:17 dsl Exp $ */
+/* $NetBSD: vector.S,v 1.65 2016/08/07 10:17:32 maxv Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
*/
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.64 2014/01/26 19:16:17 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.65 2016/08/07 10:17:32 maxv Exp $");
#include "opt_ddb.h"
#include "opt_multiprocessor.h"
@@ -106,7 +106,6 @@ __KERNEL_RCSID(0, "$NetBSD: vector.S,v 1
* If the interrupt frame is made more flexible, INTR can push %eax first and
* decide the ipending case with less overhead, e.g., by avoiding loading the
* segment registers.
- *
*/
/*
@@ -132,13 +131,13 @@ __KERNEL_RCSID(0, "$NetBSD: vector.S,v 1
.globl dtrace_invop_jump_addr
.align 4
.type dtrace_invop_jump_addr, @object
- .size dtrace_invop_jump_addr, 4
+ .size dtrace_invop_jump_addr, 4
dtrace_invop_jump_addr:
.zero 4
.globl dtrace_invop_calltrap_addr
.align 4
.type dtrace_invop_calltrap_addr, @object
- .size dtrace_invop_calltrap_addr, 4
+ .size dtrace_invop_calltrap_addr, 4
dtrace_invop_calltrap_addr:
.zero 8
.text
@@ -154,15 +153,15 @@ IDTVEC(recurse_lapic_ipi)
pushfl
pushl %cs
pushl %esi
- pushl $0
+ pushl $0
pushl $T_ASTFLT
- INTRENTRY
+ INTRENTRY
jmp 1f
IDTVEC_END(recurse_lapic_ipi)
IDTVEC(intr_lapic_ipi)
- pushl $0
+ pushl $0
pushl $T_ASTFLT
- INTRENTRY
+ INTRENTRY
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
movl CPUVAR(ILEVEL),%ebx
cmpl $IPL_HIGH,%ebx
@@ -189,7 +188,7 @@ IDTVEC(intr_lapic_tlb)
pushl $0
pushl $T_ASTFLT
INTRENTRY
- movl $0, _C_LABEL(local_apic)+LAPIC_EOI
+ movl $0,_C_LABEL(local_apic)+LAPIC_EOI
call _C_LABEL(pmap_tlb_intr)
INTRFASTEXIT
IDTVEC_END(intr_lapic_tlb)
@@ -213,7 +212,7 @@ IDTVEC(intrddbipi)
IDTVEC_END(intrddbipi)
#endif /* DDB */
#endif /* MULTIPROCESSOR */
-
+
/*
* Interrupt from the local APIC timer.
*/
@@ -221,15 +220,15 @@ IDTVEC(recurse_lapic_ltimer)
pushfl
pushl %cs
pushl %esi
- pushl $0
+ pushl $0
pushl $T_ASTFLT
- INTRENTRY
+ INTRENTRY
jmp 1f
IDTVEC_END(recurse_lapic_ltimer)
IDTVEC(intr_lapic_ltimer)
- pushl $0
+ pushl $0
pushl $T_ASTFLT
- INTRENTRY
+ INTRENTRY
movl $0,_C_LABEL(local_apic)+LAPIC_EOI
movl CPUVAR(ILEVEL),%ebx
cmpl $IPL_CLOCK,%ebx
@@ -242,7 +241,7 @@ IDTVEC(resume_lapic_ltimer)
sti
pushl $0
call _C_LABEL(lapic_clockintr)
- addl $4,%esp
+ addl $4,%esp
cli
jmp _C_LABEL(Xdoreti)
2:
@@ -272,7 +271,7 @@ IDTVEC_END(recurse_ ## name ## num)
IDTVEC(resume_ ## name ## num) \
movl $IREENT_MAGIC,TF_ERR(%esp) ;\
movl %ebx,%esi ;\
- movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
+ movl CPUVAR(ISOURCES) + (num) * 4,%ebp ;\
movl IS_MAXLEVEL(%ebp),%ebx ;\
jmp 1f ;\
IDTVEC_END(resume_ ## name ## num) ;\
@@ -280,7 +279,7 @@ IDTVEC(intr_ ## name ## num) ;\
pushl $0 /* dummy error code */ ;\
pushl $T_ASTFLT /* trap # for doing ASTs */ ;\
INTRENTRY ;\
- movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
+ movl CPUVAR(ISOURCES) + (num) * 4,%ebp ;\
mask(num) /* mask it in hardware */ ;\
early_ack(num) /* and allow other intrs */ ;\
testl %ebp,%ebp ;\
@@ -318,12 +317,12 @@ IDTVEC(intr_ ## name ## num) ;\
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
7: \
cli ;\
- orl $(1 << num),CPUVAR(IPENDING) ;\
+ orl $(1 << num),CPUVAR(IPENDING) ;\
level_mask(num) ;\
late_ack(num) ;\
jmp _C_LABEL(Xdoreti) /* lower spl and do ASTs */ ;\
10: \
- orl $(1 << num),CPUVAR(IPENDING) ;\
+ orl $(1 << num),CPUVAR(IPENDING) ;\
level_mask(num) ;\
late_ack(num) ;\
INTRFASTEXIT ;\
@@ -631,7 +630,7 @@ IDTVEC(recurse_ ## name ## num) ;\
IDTVEC(resume_ ## name ## num) \
movl $IREENT_MAGIC,TF_ERR(%esp) ;\
pushl %ebx ;\
- movl CPUVAR(ISOURCES) + (num) * 4, %ebp ;\
+ movl CPUVAR(ISOURCES) + (num) * 4,%ebp ;\
movl $num,CPUVAR(ILEVEL) ;\
IDEPTH_INCR /* leaves old %esp on stack */ ;\
STI(%eax) ;\
@@ -657,8 +656,8 @@ IDTVEC(resume_ ## name ## num) \
* the C function doing it, maybe rewrite in inline assembly ?
*/
#define hypervisor_asm_unmask(num) \
- pushl $num ;\
- call _C_LABEL(hypervisor_enable_ipl) ;\
+ pushl $num ;\
+ call _C_LABEL(hypervisor_enable_ipl) ;\
addl $4,%esp
XENINTRSTUB(xenev,0,voidop,voidop,voidop,hypervisor_asm_unmask,voidop)
@@ -753,35 +752,35 @@ END(xenev_stubs)
* activation and restart the handler using the previous one.
*/
NENTRY(hypervisor_callback)
- pushl $0 # dummy error code
+ pushl $0 /* dummy error code */
pushl $T_ASTFLT
INTRENTRY
- movl TF_EIP(%esp),%eax
- cmpl $scrit,%eax
- jb 11f
- cmpl $ecrit,%eax
- jb critical_region_fixup
-11: pushl CPUVAR(ILEVEL)
- push %esp
- call do_hypervisor_callback
- add $8,%esp
- xorl %eax,%eax
- movb TF_CS(%esp),%cl
- test $CHK_UPL,%cl # slow return to ring 2 or 3
- je safesti
- movl CPUVAR(ILEVEL),%ebx
- jmp doreti_checkast
+ movl TF_EIP(%esp),%eax
+ cmpl $scrit,%eax
+ jb 11f
+ cmpl $ecrit,%eax
+ jb critical_region_fixup
+11: pushl CPUVAR(ILEVEL)
+ push %esp
+ call do_hypervisor_callback
+ add $8,%esp
+ xorl %eax,%eax
+ movb TF_CS(%esp),%cl
+ test $CHK_UPL,%cl /* slow return to ring 2 or 3 */
+ je safesti
+ movl CPUVAR(ILEVEL),%ebx
+ jmp doreti_checkast
safesti:
- movl CPUVAR(VCPU),%esi
- XEN_UNBLOCK_EVENTS(%esi) # reenable event callbacks
-scrit: /**** START OF CRITICAL REGION ****/
- XEN_TEST_PENDING(%esi)
- jnz 14f # process more events if necessary...
- INTRFASTEXIT
+ movl CPUVAR(VCPU),%esi
+ XEN_UNBLOCK_EVENTS(%esi) /* reenable event callbacks */
+scrit: /**** START OF CRITICAL REGION ****/
+ XEN_TEST_PENDING(%esi)
+ jnz 14f /* process more events if necessary... */
+ INTRFASTEXIT
critiret:
-14: XEN_BLOCK_EVENTS(%esi)
- jmp 11b
-ecrit: /**** END OF CRITICAL REGION ****/
+14: XEN_BLOCK_EVENTS(%esi)
+ jmp 11b
+ecrit: /**** END OF CRITICAL REGION ****/
/*
* [How we do the fixup]. We want to merge the current stack frame with the
* just-interrupted frame. How we do this depends on where in the critical
@@ -792,27 +791,27 @@ ecrit: /**** END OF CRITICAL REGION ***
* interrupted stack frame.
*/
critical_region_fixup:
- cmpl $(critiret-1),%eax # eip points to iret?
+ cmpl $(critiret-1),%eax /* eip points to iret? */
jne 1f
movl $(TF_PUSHSIZE+0x8),%eax
jmp 2f
1: xorl %eax,%eax
2:
/* %eax contains num bytes popped */
- mov %esp,%esi
- add %eax,%esi # %esi points at end of src region
- mov %esp,%edi
- add $(TF_PUSHSIZE+0x8+0xC),%edi # %edi points at end of dst region
- mov %eax,%ecx
- shr $2,%ecx # convert words to bytes
- je 16f # skip loop if nothing to copy
-15: subl $4,%esi # pre-decrementing copy loop
- subl $4,%edi
- movl (%esi),%eax
- movl %eax,(%edi)
- loop 15b
-16: movl %edi,%esp # final %edi is top of merged stack
- jmp 11b
+ mov %esp,%esi
+ add %eax,%esi /* %esi points at end of src region */
+ mov %esp,%edi
+ add $(TF_PUSHSIZE+0x8+0xC),%edi /* %edi points at end of dst region */
+ mov %eax,%ecx
+ shr $2,%ecx /* convert words to bytes */
+ je 16f /* skip loop if nothing to copy */
+15: subl $4,%esi /* pre-decrementing copy loop */
+ subl $4,%edi
+ movl (%esi),%eax
+ movl %eax,(%edi)
+ loop 15b
+16: movl %edi,%esp /* final %edi is top of merged stack */
+ jmp 11b
END(hypervisor_callback)