Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/arm32 Give the idle loop a non-profiled entry, ...



details:   https://anonhg.NetBSD.org/src/rev/8318f65c6011
branches:  trunk
changeset: 517818:8318f65c6011
user:      chris <chris%NetBSD.org@localhost>
date:      Mon Nov 19 20:38:58 2001 +0000

description:
Give the idle loop a non-profiled entry, means it appears in profile info correctly (rather than all it's time being under remrunqueue)
switch_exit only needs to take 1 parameter, it loads the value of proc0 into R1 itself
Fixup some comments to reflect the real state of things.
Tweak a couple of bits of asm to avoid a load delay.
remove excess code for setting curpcb and curproc.

diffstat:

 sys/arch/arm/arm32/cpuswitch.S  |  35 ++++++++++++-----------------------
 sys/arch/arm/arm32/vm_machdep.c |   6 +++---
 2 files changed, 15 insertions(+), 26 deletions(-)

diffs (163 lines):

diff -r 2b7830f26981 -r 8318f65c6011 sys/arch/arm/arm32/cpuswitch.S
--- a/sys/arch/arm/arm32/cpuswitch.S    Mon Nov 19 19:08:33 2001 +0000
+++ b/sys/arch/arm/arm32/cpuswitch.S    Mon Nov 19 20:38:58 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuswitch.S,v 1.3 2001/11/11 22:07:41 chris Exp $      */
+/*     $NetBSD: cpuswitch.S,v 1.4 2001/11/19 20:38:58 chris Exp $      */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -231,8 +231,7 @@
 /*
  * Idle loop, exercised while waiting for a process to wake up.
  */
-
-idle:
+ASENTRY_NP(idle)
        /* Enable interrupts */
        IRQenable
 
@@ -254,7 +253,7 @@
        bne     sw1
 
        /* All processes are still asleep so idle a while longer */
-       b       idle
+       b       _ASM_LABEL(idle)
 
 
 /*
@@ -316,7 +315,7 @@
 
        /* If not we must idle until we do. */
        teq     r3, #0x00000000
-       beq     idle
+       beq     _ASM_LABEL(idle)
 
 sw1:
        /* rem: r1 = old proc */
@@ -328,7 +327,7 @@
         * Is this overkill ? If we are not in SVC mode then things are
         * very sick and will probably have already died.
         */
-#ifdef DIAGNOSTIC
+#if 0
        mrs     r4, cpsr_all
        and     r4, r4, #(PSR_MODE)
        teq     r4, #(PSR_SVC32_MODE)
@@ -415,15 +414,14 @@
        /* rem: interrupts are disabled */
 
        /* Clear the want_resched flag */
+       ldr     r7, Lwant_resched
        mov     r0, #0x00000000
-       ldr     r7, Lwant_resched
        str     r0, [r7]
 
        /*
         * Clear the back pointer of the process we have removed from
         * the head of the queue. The new process is isolated now.
         */
-       mov     r0, #0x00000000
        str     r0, [r6, #(P_BACK)]
 
        /* p->p_cpu initialized in fork1() for single-processor */
@@ -446,7 +444,7 @@
 
        /* rem: r1 = old proc */
        /* rem: r6 = new process */
-       /* rem: interrupts are disabled */
+       /* rem: interrupts are enabled */
 
        /*
         * If the new process is the same as the process that called
@@ -469,7 +467,7 @@
 
        /* rem: r1 = old proc */
        /* rem: r6 = new process */
-       /* rem: interrupts are disabled */
+       /* rem: interrupts are enabled */
 
        /* Stage two : Save old context */
 
@@ -497,9 +495,9 @@
         msr    cpsr_all, r3            /* Restore the old mode */
 
        /* rem: r0 = old proc */
-       /* rem: r0 = old pcb */
+       /* rem: r1 = old pcb */
        /* rem: r6 = new process */
-       /* rem: interrupts are disabled */
+       /* rem: interrupts are enabled */
 
        /* What else needs to be saved  Only FPA stuff when that is supported */
 
@@ -558,10 +556,6 @@
        add     r7, r1, #PCB_R8
        ldmia   r7, {r8-r13}
 
-       /* Remember the pcb currently in use */
-       ldr     r7, Lcurpcb
-       str     r1, [r7]
-
 #ifdef ARMFPE
        add     r0, r1, #(USER_SIZE) & 0x00ff
        add     r0, r0, #(USER_SIZE) & 0xff00 
@@ -572,11 +566,6 @@
        IRQenable
 
 switch_return:
-       /* We have a new curproc now so make a note it */
-/*
-       ldr     r7, Lcurproc
-       str     r6, [r7]
-*/
 
        /* Get the spl level from the stack and update the current spl level */
        ldr     r0, [sp], #0x0004
@@ -608,8 +597,8 @@
        ldr     r1, Lproc0
 
        /* In case we fault */
+       ldr     r0, Lcurproc
        mov     r2, #0x00000000
-       ldr     r0, Lcurproc
        str     r2, [r0]
 
 /*     ldr     r0, Lcurpcb
@@ -657,8 +646,8 @@
        bl      _C_LABEL(exit2)
 
        /* Paranoia */
+       ldr     r1, Lcurproc
        mov     r0, #0x00000000
-       ldr     r1, Lcurproc
        str     r0, [r1]
 
         ldr     r1, Lproc0
diff -r 2b7830f26981 -r 8318f65c6011 sys/arch/arm/arm32/vm_machdep.c
--- a/sys/arch/arm/arm32/vm_machdep.c   Mon Nov 19 19:08:33 2001 +0000
+++ b/sys/arch/arm/arm32/vm_machdep.c   Mon Nov 19 20:38:58 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.8 2001/10/18 09:26:08 rearnsha Exp $  */
+/*     $NetBSD: vm_machdep.c,v 1.9 2001/11/19 20:38:58 chris Exp $     */
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -72,7 +72,7 @@
 int process_read_regs  __P((struct proc *p, struct reg *regs));
 int process_read_fpregs        __P((struct proc *p, struct fpreg *regs));
 
-void   switch_exit     __P((struct proc *p, struct proc *proc0));
+void   switch_exit     __P((struct proc *p));
 extern void proc_trampoline    __P((void));
 
 /*
@@ -218,7 +218,7 @@
        }
 #endif /* STACKCHECKS */
        uvmexp.swtch++;
-       switch_exit(p, &proc0);
+       switch_exit(p);
 }
 
 



Home | Main Index | Thread Index | Old Index