Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Put the clearing of ci_astpending back in frame...



details:   https://anonhg.NetBSD.org/src/rev/22e51d3de218
branches:  trunk
changeset: 807651:22e51d3de218
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Apr 17 17:28:33 2015 +0000

description:
Put the clearing of ci_astpending back in frame.h while interrupts are
disabled.

diffstat:

 sys/arch/arm/arm/ast.c             |   9 +-----
 sys/arch/arm/include/arm32/frame.h |  48 +++++++++++++++++++++----------------
 2 files changed, 29 insertions(+), 28 deletions(-)

diffs (113 lines):

diff -r 47e72954d5c4 -r 22e51d3de218 sys/arch/arm/arm/ast.c
--- a/sys/arch/arm/arm/ast.c    Fri Apr 17 15:13:47 2015 +0000
+++ b/sys/arch/arm/arm/ast.c    Fri Apr 17 17:28:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ast.c,v 1.27 2015/04/14 22:36:53 jmcneill Exp $        */
+/*     $NetBSD: ast.c,v 1.28 2015/04/17 17:28:33 matt Exp $    */
 
 /*
  * Copyright (c) 1994,1995 Mark Brinicombe
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.27 2015/04/14 22:36:53 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ast.c,v 1.28 2015/04/17 17:28:33 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -131,11 +131,6 @@
        ci->ci_data.cpu_ntrap++;
 
        KDASSERT(ci->ci_cpl == IPL_NONE);
-#ifdef __HAVE_PREEMPTION
-       atomic_and_uint(&ci->ci_astpending, ~__BIT(0));
-#else
-       ci->ci_astpending = 0;
-#endif
        const int want_resched = ci->ci_want_resched;
 #ifdef __HAVE_PREEMPTION
        kpreempt_enable();
diff -r 47e72954d5c4 -r 22e51d3de218 sys/arch/arm/include/arm32/frame.h
--- a/sys/arch/arm/include/arm32/frame.h        Fri Apr 17 15:13:47 2015 +0000
+++ b/sys/arch/arm/include/arm32/frame.h        Fri Apr 17 17:28:33 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frame.h,v 1.41 2015/04/08 18:10:08 matt Exp $  */
+/*     $NetBSD: frame.h,v 1.42 2015/04/17 17:28:33 matt Exp $  */
 
 /*
  * Copyright (c) 1994-1997 Mark Brinicombe.
@@ -150,6 +150,28 @@
        msr     cpsr_c, ra              /* Restore interrupts */
 #endif
 
+#ifdef __HAVE_PREEMPTION
+#define DO_CLEAR_ASTPENDING                                            \
+       mvn     r1, #1                  /* complement of 1 */           ;\
+       add     r0, r4, #CI_ASTPENDING  /* address of astpending */     ;\
+       bl      _C_LABEL(atomic_and_uint) /* clear AST */
+#else
+#define DO_CLEAR_ASTPENDING                                            \
+       mov     r0, #0                                                  ;\
+       str     r0, [r4, #CI_ASTPENDING] /* clear AST */
+#endif
+
+#define DO_PENDING_AST(lbl)                                            ;\
+1:     ldr     r1, [r4, #CI_ASTPENDING] /* Pending AST? */             ;\
+       tst     r1, #0x00000001                                         ;\
+       beq     lbl                     /* Nope. Just bail */           ;\
+       DO_CLEAR_ASTPENDING                                             ;\
+       CPSIE_I(r5, r5)                 /* Restore interrupts */        ;\
+       mov     r0, sp                                                  ;\
+       bl      _C_LABEL(ast)           /* ast(frame) */                ;\
+       CPSID_I(r0, r5)                 /* Disable interrupts */        ;\
+       b       1b                      /* test again */
+
 /*
  * AST_ALIGNMENT_FAULT_LOCALS and ENABLE_ALIGNMENT_FAULTS
  * These are used in order to support dynamic enabling/disabling of
@@ -199,10 +221,8 @@
        CPSID_I(r1, r5)                 /* Disable interrupts */        ;\
        cmp     r7, #(PSR_USR32_MODE)   /* Returning to USR mode? */    ;\
        bne     3f                      /* Nope, get out now */         ;\
-1:     ldr     r1, [r4, #CI_ASTPENDING] /* Pending AST? */             ;\
-       tst     r1, #0x00000001                                         ;\
-       bne     2f                      /* Yup. Go deal with it */      ;\
-       ldr     r1, [r4, #CI_CURLWP]    /* get curlwp from cpu_info */  ;\
+       DO_PENDING_AST(2f)              /* Pending AST? */              ;\
+2:     ldr     r1, [r4, #CI_CURLWP]    /* get curlwp from cpu_info */  ;\
        ldr     r0, [r1, #L_MD_FLAGS]   /* get md_flags from lwp */     ;\
        tst     r0, #MDLWP_NOALIGNFLT                                   ;\
        beq     3f                      /* Keep AFLTs enabled */        ;\
@@ -210,14 +230,7 @@
        ldr     r2, .Laflt_cpufuncs                                     ;\
        mov     r0, #-1                                                 ;\
        bic     r1, r1, #CPU_CONTROL_AFLT_ENABLE  /* Disable AFLTs */   ;\
-       adr     lr, 3f                                                  ;\
-       B_CF_CONTROL(r2)                /* Set new CTRL reg value */    ;\
-       /* NOTREACHED */                                                \
-2:     CPSIE_I(r5, r5)                 /* Restore interrupts */        ;\
-       mov     r0, sp                                                  ;\
-       bl      _C_LABEL(ast)           /* ast(frame) */                ;\
-       CPSID_I(r0, r5)                 /* Disable interrupts */        ;\
-       b       1b                      /* Back around again */         ;\
+       BL_CF_CONTROL(r2)               /* Set new CTRL reg value */    ;\
 3:     /* done */
 
 #else  /* !EXEC_AOUT */
@@ -235,14 +248,7 @@
        CPSID_I(r1, r5)                 /* Disable interrupts */        ;\
        cmp     r7, #(PSR_USR32_MODE)                                   ;\
        bne     2f                      /* Nope, get out now */         ;\
-1:     ldr     r1, [r4, #CI_ASTPENDING] /* Pending AST? */             ;\
-       tst     r1, #0x00000001                                         ;\
-       beq     2f                      /* Nope. Just bail */           ;\
-       CPSIE_I(r5, r5)                 /* Restore interrupts */        ;\
-       mov     r0, sp                                                  ;\
-       bl      _C_LABEL(ast)           /* ast(frame) */                ;\
-       CPSID_I(r0, r5)                 /* Disable interrupts */        ;\
-       b       1b                                                      ;\
+       DO_PENDING_AST(2f)              /* Pending AST? */              ;\
 2:     /* done */
 #endif /* EXEC_AOUT */
 



Home | Main Index | Thread Index | Old Index