Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/powerpc * On the 601, obliterate all BAT en...



details:   https://anonhg.NetBSD.org/src/rev/4a0ae05b4306
branches:  trunk
changeset: 526347:4a0ae05b4306
user:      kleink <kleink%NetBSD.org@localhost>
date:      Thu May 02 16:47:49 2002 +0000

description:
* On the 601, obliterate all BAT entries when returning from kernel to
  userlevel; this is necessary due to the 601, unlike other 6xx, having
  no concept of separated Valid_user vs. Valid_supervisor for BATs.
* When crossing the kernel/userlevel boundary, have platform-provided
  hooks set up the two fixed BAT entries, and possibly additional
  segment registers to redeem the 601's BAT limitations.

Both of the above are only built if the $MACHINE provides these hooks,
sparing others the pain.

diffstat:

 sys/arch/powerpc/powerpc/trap_subr.S |  39 +++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 3 deletions(-)

diffs (81 lines):

diff -r 74a2dc883369 -r 4a0ae05b4306 sys/arch/powerpc/powerpc/trap_subr.S
--- a/sys/arch/powerpc/powerpc/trap_subr.S      Thu May 02 16:47:12 2002 +0000
+++ b/sys/arch/powerpc/powerpc/trap_subr.S      Thu May 02 16:47:49 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $    */
+/*     $NetBSD: trap_subr.S,v 1.21 2002/05/02 16:47:49 kleink Exp $    */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -552,6 +552,35 @@
 _C_LABEL(ipkdbsize) = .-_C_LABEL(ipkdblow)
 #endif /* IPKDB */
 
+#ifdef CPU601_KERN_ENTRY_HOOK
+#define        CPU601_KERN_ENTRY(_s1_,_s2_)                                    \
+       mfpvr   _s1_;                                                   \
+       srwi    _s1_,_s1_,16;                                           \
+       cmpi    0,_s1_,MPC601;                                          \
+       bne     98f;                    /* skip if not 601 */           \
+       CPU601_KERN_ENTRY_HOOK(_s1_,_s2_);                              \
+98:
+#else
+#define        CPU601_KERN_ENTRY(_s1_,_s2_)    /* nothing */
+#endif
+
+#ifdef CPU601_KERN_LEAVE_HOOK
+#define        CPU601_KERN_LEAVE(_pmap_,_s1_)                                  \
+       mfpvr   _s1_;                                                   \
+       srwi    _s1_,_s1_,16;                                           \
+       cmpi    0,_s1_,MPC601;                                          \
+       bne     99f;                    /* skip if not 601 */           \
+       CPU601_KERN_LEAVE_HOOK(_pmap_,_s1_);                            \
+       xor     _s1_,_s1_,_s1_;                                         \
+       mtibatl 0,_s1_;                 /* obliterate BATs */           \
+       mtibatl 1,_s1_;                                                 \
+       mtibatl 2,_s1_;                                                 \
+       mtibatl 3,_s1_;                                                 \
+99:
+#else
+#define        CPU601_KERN_LEAVE(_pmap_,_s1_)  /* nothing */
+#endif
+
 /*
  * FRAME_SETUP assumes:
  *     SPRG1           SP (1)
@@ -643,6 +672,7 @@
        mtsr    USER_SR,3;                                              \
        lwz     3,PM_KERNELSR(2);                                       \
        mtsr    KERNEL_SR,3;                                            \
+       CPU601_KERN_LEAVE(2,3);                                         \
 1:     mfsprg  2,1;                    /* restore cr */                \
        mtcr    2;                                                      \
        lwz     2,savearea(0);                                          \
@@ -682,6 +712,7 @@
        lis     31,KERNEL_SEGMENT@h
        ori     31,31,KERNEL_SEGMENT@l
        mtsr    KERNEL_SR,31
+       CPU601_KERN_ENTRY(30,31)
 /* Obliterate SRs so BAT spills work correctly */
        lis     31,EMPTY_SEGMENT@h
        ori     31,31,EMPTY_SEGMENT@l
@@ -849,6 +880,7 @@
        mtsr    5,3;                                                    \
        mtsr    6,3;                                                    \
        mtsr    7,3;                                                    \
+       CPU601_KERN_ENTRY(3,4);                                         \
 /* interrupts are recoverable here, and enable translation */          \
        lis     3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@h;                 \
        ori     3,3,(KERNEL_SEGMENT|SR_SUKEY|SR_PRKEY)@l;               \
@@ -906,8 +938,9 @@
        mtsr    6,4                     /* Restore SR6 */
        lwz     4,PM_SR+28(3)
        mtsr    7,4                     /* Restore SR7 */
-       lwz     3,PM_KERNELSR(3)
-       mtsr    KERNEL_SR,3             /* Restore kernel SR */
+       lwz     4,PM_KERNELSR(3)
+       mtsr    KERNEL_SR,4             /* Restore kernel SR */
+       CPU601_KERN_LEAVE(3,4)
        lis     3,_C_LABEL(astpending)@ha /* Test AST pending */
        lwz     4,_C_LABEL(astpending)@l(3)
        andi.   4,4,1



Home | Main Index | Thread Index | Old Index