Print this page
armv6: bit 2 (0x4) enables the dcache
This fixes a pretty simple typo.  Sadly, this still isn't enough to get
bcm2835 past mutex_enter.


  42 
  43         .data
  44         .comm   t0stack, DEFAULTSTKSZ, 32
  45         .comm   t0, 4094, 32
  46 
  47 #if defined(__lint)
  48 
  49 /* ARGSUSED */
  50 void
  51 _locore_start(struct boot_syscalls *sysp, struct bootops *bop)
  52 {}
  53 
  54 #else   /* __lint */
  55 
  56         /*
  57          * We got here from _kobj_init() via exitto().  We have a few different
  58          * tasks that we need to take care of before we hop into mlsetup and
  59          * then main. We're never going back so we shouldn't feel compelled to
  60          * preserve any registers.
  61          *
  62          *  o Enable unaligned access
  63          *  o Enable our I/D-caches
  64          *  o Save the boot syscalls and bootops for later
  65          *  o Set up our stack to be the real stack of t0stack.
  66          *  o Save t0 as curthread
  67          *  o Set up a struct REGS for mlsetup
  68          *  o Make sure that we're 8 byte aligned for the call
  69          */
  70 
  71         ENTRY(_locore_start)
  72 
  73 
  74         /*
  75          * We've been running in t0stack anyway, up to this point, but
  76          * _locore_start represents what is in effect a fresh start in the
  77          * real kernel -- We'll never return back through here.
  78          *
  79          * So reclaim those few bytes
  80          */
  81         ldr     sp, =t0stack
  82         ldr     r4, =(DEFAULTSTKSZ - REGSIZE)


  94         str     r4, [sp, #REGOFF_CPSR]
  95 
  96         /*
  97          * Save back the bootops and boot_syscalls.
  98          */
  99         ldr     r2, =sysp
 100         str     r0, [r2]
 101         ldr     r2, =bootops
 102         str     r1, [r2]
 103         ldr     r2, =bootopsp
 104         ldr     r2, [r2]
 105         str     r1, [r2]
 106 
 107         /*
 108          * Set up our curthread pointer
 109          */
 110         ldr     r0, =t0
 111         mcr     p15, 0, r0, c13, c0, 4
 112 
 113         /*
 114          * Go ahead now and enable unaligned access, the L1 I/D caches.
 115          *
 116          * Bit 2 is for the D cache
 117          * Bit 12 is for the I cache
 118          * Bit 22 is for unaligned access
 119          */
 120         mrc     p15, 0, r0, c1, c0, 0
 121         orr     r0, #0x02
 122         orr     r0, #0x1000
 123         orr     r0, #0x400000
 124         mcr     p15, 0, r0, c1, c0, 0
 125 
 126         /*
 127          * mlsetup() takes the struct regs as an argument. main doesn't take
 128          * any and should never return. Currently, we have an 8-byte aligned
 129          * stack.  We want to push a zero frame pointer to terminate any
 130          * stack walking, but that would cause us to end up with only a
 131          * 4-byte aligned stack.  So, to keep things nice and correct, we
 132          * push a zero value twice - it's similar to a typical function
 133          * entry:
 134          *      push { r9, lr }
 135          */
 136         mov     r9,#0
 137         push    { r9 }          /* link register */
 138         push    { r9 }          /* frame pointer */
 139         mov     r0, sp
 140         bl      mlsetup
 141         bl      main
 142         /* NOTREACHED */
 143         ldr     r0,=__return_from_main


  42 
  43         .data
  44         .comm   t0stack, DEFAULTSTKSZ, 32
  45         .comm   t0, 4094, 32
  46 
  47 #if defined(__lint)
  48 
  49 /* ARGSUSED */
  50 void
  51 _locore_start(struct boot_syscalls *sysp, struct bootops *bop)
  52 {}
  53 
  54 #else   /* __lint */
  55 
  56         /*
  57          * We got here from _kobj_init() via exitto().  We have a few different
  58          * tasks that we need to take care of before we hop into mlsetup and
  59          * then main. We're never going back so we shouldn't feel compelled to
  60          * preserve any registers.
  61          *

  62          *  o Enable our I/D-caches
  63          *  o Save the boot syscalls and bootops for later
  64          *  o Set up our stack to be the real stack of t0stack.
  65          *  o Save t0 as curthread
  66          *  o Set up a struct REGS for mlsetup
  67          *  o Make sure that we're 8 byte aligned for the call
  68          */
  69 
  70         ENTRY(_locore_start)
  71 
  72 
  73         /*
  74          * We've been running in t0stack anyway, up to this point, but
  75          * _locore_start represents what is in effect a fresh start in the
  76          * real kernel -- We'll never return back through here.
  77          *
  78          * So reclaim those few bytes
  79          */
  80         ldr     sp, =t0stack
  81         ldr     r4, =(DEFAULTSTKSZ - REGSIZE)


  93         str     r4, [sp, #REGOFF_CPSR]
  94 
  95         /*
  96          * Save back the bootops and boot_syscalls.
  97          */
  98         ldr     r2, =sysp
  99         str     r0, [r2]
 100         ldr     r2, =bootops
 101         str     r1, [r2]
 102         ldr     r2, =bootopsp
 103         ldr     r2, [r2]
 104         str     r1, [r2]
 105 
 106         /*
 107          * Set up our curthread pointer
 108          */
 109         ldr     r0, =t0
 110         mcr     p15, 0, r0, c13, c0, 4
 111 
 112         /*
 113          * Go ahead now and enable the L1 I/D caches.  




 114          */
 115         mrc     p15, 0, r0, c1, c0, 0
 116         orr     r0, #0x04       /* D-cache */
 117         orr     r0, #0x1000     /* I-cache */

 118         mcr     p15, 0, r0, c1, c0, 0
 119 
 120         /*
 121          * mlsetup() takes the struct regs as an argument. main doesn't take
 122          * any and should never return. Currently, we have an 8-byte aligned
 123          * stack.  We want to push a zero frame pointer to terminate any
 124          * stack walking, but that would cause us to end up with only a
 125          * 4-byte aligned stack.  So, to keep things nice and correct, we
 126          * push a zero value twice - it's similar to a typical function
 127          * entry:
 128          *      push { r9, lr }
 129          */
 130         mov     r9,#0
 131         push    { r9 }          /* link register */
 132         push    { r9 }          /* frame pointer */
 133         mov     r0, sp
 134         bl      mlsetup
 135         bl      main
 136         /* NOTREACHED */
 137         ldr     r0,=__return_from_main