Author: ian
Date: Thu Dec 25 17:06:58 2014
New Revision: 276206
URL: https://svnweb.freebsd.org/changeset/base/276206

Log:
  For data and instruction prefetch aborts, call the same handler in the C
  code, passing a 0/1 flag that indicates which type of abort it was.  This
  sets the stage for unifying the handling of page faults in a single routine.
  
  Submitted by: Svatopluk Kraus <onw...@gmail.com>,
              Michal Meloun <mel...@miracle.cz

Modified:
  head/sys/arm/arm/exception.S
  head/sys/arm/arm/trap.c
  head/sys/arm/include/machdep.h

Modified: head/sys/arm/arm/exception.S
==============================================================================
--- head/sys/arm/arm/exception.S        Thu Dec 25 16:58:48 2014        
(r276205)
+++ head/sys/arm/arm/exception.S        Thu Dec 25 17:06:58 2014        
(r276206)
@@ -320,7 +320,8 @@ ASENTRY_NP(prefetch_abort_entry)
        PUSHFRAMEINSVC                  /* mode stack, build trapframe there. */
        adr     lr, exception_exit      /* Return from handler via standard */
        mov     r0, sp                  /* exception exit routine.  Pass the */
-       b       prefetch_abort_handler  /* trapframe to the handler. */
+       mov     r1, #1                  /* Type flag */
+       b       _C_LABEL(abort_handler)
 END(prefetch_abort_entry)
 
 /*
@@ -337,9 +338,10 @@ ASENTRY_NP(data_abort_entry)
 #endif
        sub     lr, lr, #8              /* Adjust the lr. Transition to scv32 */
        PUSHFRAMEINSVC                  /* mode stack, build trapframe there. */
-       adr     lr, exception_exit      /* Return from handler via standard */
-       mov     r0, sp                  /* exception exit routine.  Pass the */
-       b       data_abort_handler      /* trapframe to the handler. */
+       adr     lr, exception_exit      /* Exception exit routine */
+       mov     r0, sp                  /* Trapframe to the handler */
+       mov     r1, #0                  /* Type flag */
+       b       _C_LABEL(abort_handler)
 END(data_abort_entry)
 
 /*

Modified: head/sys/arm/arm/trap.c
==============================================================================
--- head/sys/arm/arm/trap.c     Thu Dec 25 16:58:48 2014        (r276205)
+++ head/sys/arm/arm/trap.c     Thu Dec 25 17:06:58 2014        (r276206)
@@ -127,6 +127,7 @@ static int dab_align(struct trapframe *,
     struct ksig *);
 static int dab_buserr(struct trapframe *, u_int, u_int, struct thread *,
     struct ksig *);
+static void prefetch_abort_handler(struct trapframe *);
 
 static const struct data_abort data_aborts[] = {
        {dab_fatal,     "Vector Exception"},
@@ -171,7 +172,7 @@ call_trapsignal(struct thread *td, int s
 }
 
 void
-data_abort_handler(struct trapframe *tf)
+abort_handler(struct trapframe *tf, int type)
 {
        struct vm_map *map;
        struct pcb *pcb;
@@ -184,6 +185,8 @@ data_abort_handler(struct trapframe *tf)
        struct ksig ksig;
        struct proc *p;
 
+       if (type == 1)
+               return (prefetch_abort_handler(tf));
 
        /* Grab FAR/FSR before enabling interrupts */
        far = cpu_faultaddress();
@@ -605,7 +608,7 @@ dab_buserr(struct trapframe *tf, u_int f
  * does no have read permission so send it a signal.
  * Otherwise fault the page in and try again.
  */
-void
+static void
 prefetch_abort_handler(struct trapframe *tf)
 {
        struct thread *td;

Modified: head/sys/arm/include/machdep.h
==============================================================================
--- head/sys/arm/include/machdep.h      Thu Dec 25 16:58:48 2014        
(r276205)
+++ head/sys/arm/include/machdep.h      Thu Dec 25 17:06:58 2014        
(r276206)
@@ -20,8 +20,7 @@ struct trapframe;
 void arm_lock_cache_line(vm_offset_t);
 void init_proc0(vm_offset_t kstack);
 void halt(void);
-void data_abort_handler(struct trapframe *);
-void prefetch_abort_handler(struct trapframe *);
+void abort_handler(struct trapframe *, int );
 void set_stackptrs(int cpu);
 void undefinedinstruction_bounce(struct trapframe *);
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to