PERFORCE change 42076 for review

Peter Wemm peter at FreeBSD.org
Tue Nov 11 18:54:38 PST 2003


http://perforce.freebsd.org/chv.cgi?CH=42076

Change 42076 by peter at peter_daintree on 2003/11/11 18:53:46

	move a bunch of td_intr_nesting_level frobbing to C.

Affected files ...

.. //depot/projects/hammer/sys/amd64/amd64/apic_vector.S#3 edit
.. //depot/projects/hammer/sys/amd64/amd64/local_apic.c#17 edit
.. //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#27 edit

Differences ...

==== //depot/projects/hammer/sys/amd64/amd64/apic_vector.S#3 (text+ko) ====

@@ -105,9 +105,7 @@
 IDTVEC(vec_name) ;							\
 	PUSH_FRAME ;							\
 	movq	lapic, %rdx ;	/* pointer to local APIC */		\
-	movq	PCPU(CURTHREAD), %rbx ;					\
 	movl	LA_ISR + 16 * (index)(%rdx), %eax ;	/* load ISR */	\
-	incl	TD_INTR_NESTING_LEVEL(%rbx) ;				\
 	bsrl	%eax, %eax ;	/* index of highset set bit in ISR */	\
 	jz	2f ;							\
 	addl	$(32 * index),%eax ;					\
@@ -115,7 +113,6 @@
 	FAKE_MCOUNT(13*4(%esp)) ;	/* XXX avoid double count */	\
 	movq	%rax, %rdi ;	/* pass the IRQ */			\
 	call	lapic_handle_intr ;					\
-	decl	TD_INTR_NESTING_LEVEL(%rbx) ;				\
 	MEXITCOUNT ;							\
 	jmp	doreti ;						\
 2:	movl	$-1, %eax ;	/* send a vector of -1 */		\
@@ -223,10 +220,7 @@
 	movq	lapic, %rdx
 	movl	$0, LA_EOI(%rdx)	/* End Of Interrupt to APIC */
 
-	movq	PCPU(CURTHREAD),%rbx
-	incl	TD_INTR_NESTING_LEVEL(%rbx)
 	call	forwarded_hardclock
-	decl	TD_INTR_NESTING_LEVEL(%rbx)
 	MEXITCOUNT
 	jmp	doreti
 
@@ -244,10 +238,7 @@
 
 	FAKE_MCOUNT(13*4(%esp))
 
-	movq	PCPU(CURTHREAD),%rbx
-	incl	TD_INTR_NESTING_LEVEL(%rbx)
 	call	forwarded_statclock
-	decl	TD_INTR_NESTING_LEVEL(%rbx)
 	MEXITCOUNT
 	jmp	doreti
 

==== //depot/projects/hammer/sys/amd64/amd64/local_apic.c#17 (text+ko) ====

@@ -468,14 +468,17 @@
 lapic_handle_intr(void *cookie, struct intrframe frame)
 {
 	struct intsrc *isrc;
+	struct thread *td = curthread;
 	int vec = (uintptr_t)cookie;
 
+	td->td_intr_nesting_level++;
 	if (vec == -1)
 		panic("Couldn't get vector from ISR!");
 	isrc = intr_lookup_source(apic_idt_to_irq(vec));
 	isrc->is_pic->pic_disable_source(isrc);
 	lapic->eoi = 0;
 	intr_execute_handlers(isrc, &frame);
+	td->td_intr_nesting_level--;
 }
 
 /* Translate between IDT vectors and IRQ vectors. */

==== //depot/projects/hammer/sys/amd64/amd64/mp_machdep.c#27 (text+ko) ====

@@ -781,12 +781,15 @@
 void
 forwarded_statclock(struct clockframe frame)
 {
+	struct thread *td = curthread;
 
+	td->td_intr_nesting_level++;
 	CTR0(KTR_SMP, "forwarded_statclock");
 	if (profprocs != 0)
 		profclock(&frame);
 	if (pscnt == psdiv)
 		statclock(&frame);
+	td->td_intr_nesting_level--;
 }
 
 void
@@ -814,9 +817,12 @@
 void
 forwarded_hardclock(struct clockframe frame)
 {
+	struct thread *td = curthread;
 
+	td->td_intr_nesting_level++;
 	CTR0(KTR_SMP, "forwarded_hardclock");
 	hardclock_process(&frame);
+	td->td_intr_nesting_level--;
 }
 
 void 


More information about the p4-projects mailing list